rofi 1.7.5
Mode

Typedefs

typedef struct rofi_mode Mode
 

Enumerations

enum  ModeMode {
  MODE_EXIT = 1000 , NEXT_DIALOG = 1001 , RELOAD_DIALOG = 1002 , PREVIOUS_DIALOG = 1003 ,
  RESET_DIALOG = 1004
}
 
enum  MenuReturn {
  MENU_OK = 0x00010000 , MENU_CANCEL = 0x00020000 , MENU_NEXT = 0x00040000 , MENU_CUSTOM_INPUT = 0x00080000 ,
  MENU_ENTRY_DELETE = 0x00100000 , MENU_QUICK_SWITCH = 0x00200000 , MENU_CUSTOM_COMMAND = 0x00800000 , MENU_PREVIOUS = 0x00400000 ,
  MENU_COMPLETE = 0x01000000 , MENU_CUSTOM_ACTION = 0x10000000 , MENU_LOWER_MASK = 0x0000FFFF
}
 

Functions

void mode_destroy (Mode *mode)
 
unsigned int mode_get_num_entries (const Mode *mode)
 
char * mode_get_display_value (const Mode *mode, unsigned int selected_line, int *state, GList **attribute_list, int get_entry)
 
cairo_surface_t * mode_get_icon (Mode *mode, unsigned int selected_line, unsigned int height)
 
char * mode_get_completion (const Mode *mode, unsigned int selected_line)
 
ModeMode mode_result (Mode *mode, int menu_retv, char **input, unsigned int selected_line)
 
int mode_token_match (const Mode *mode, rofi_int_matcher **tokens, unsigned int selected_line)
 
const char * mode_get_name (const Mode *mode)
 
void mode_free (Mode **mode)
 
void * mode_get_private_data (const Mode *mode)
 
void mode_set_private_data (Mode *mode, void *pd)
 
const char * mode_get_display_name (const Mode *mode)
 
void mode_set_config (Mode *mode)
 
char * mode_preprocess_input (Mode *mode, const char *input)
 
char * mode_get_message (const Mode *mode)
 
int mode_init (Mode *mode)
 

Detailed Description

The 'object' that makes a mode in rofi.

Typedef Documentation

◆ Mode

typedef struct rofi_mode Mode

Type of a mode. Access should be done via mode_* functions.

Definition at line 44 of file mode.h.

Enumeration Type Documentation

◆ MenuReturn

enum MenuReturn

State returned by the rofi window.

Enumerator
MENU_OK 

Entry is selected.

MENU_CANCEL 

User canceled the operation. (e.g. pressed escape)

MENU_NEXT 

User requested a mode switch

MENU_CUSTOM_INPUT 

Custom (non-matched) input was entered.

MENU_ENTRY_DELETE 

User wanted to delete entry from history.

MENU_QUICK_SWITCH 

User wants to jump to another switcher.

MENU_CUSTOM_COMMAND 

User wants to jump to custom command.

MENU_PREVIOUS 

Go to the previous menu.

MENU_COMPLETE 

Go to the complete.

MENU_CUSTOM_ACTION 

Bindings specifics

MENU_LOWER_MASK 

Mask

Definition at line 65 of file mode.h.

◆ ModeMode

enum ModeMode

Enum used to sum the possible states of ROFI.

Enumerator
MODE_EXIT 

Exit.

NEXT_DIALOG 

Skip to the next cycle-able dialog.

RELOAD_DIALOG 

Reload current DIALOG

PREVIOUS_DIALOG 

Previous dialog

RESET_DIALOG 

Reloads the dialog and unset user input

Definition at line 49 of file mode.h.

Function Documentation

◆ mode_destroy()

void mode_destroy ( Mode * mode)
Parameters
modeThe mode to destroy

Destroy the mode

Definition at line 52 of file mode.c.

References rofi_mode::_destroy.

Referenced by cleanup(), combi_mode_destroy(), dmenu_finish(), and run_mode_destroy().

Here is the caller graph for this function:

◆ mode_free()

void mode_free ( Mode ** mode)
Parameters
modeThe mode to query

Free the resources allocated for this mode.

Definition at line 150 of file mode.c.

Referenced by rofi_collectmodes_destroy().

Here is the caller graph for this function:

◆ mode_get_completion()

char * mode_get_completion ( const Mode * mode,
unsigned int selected_line )
Parameters
modeThe mode to query
selected_lineThe entry to query

Return a string that can be used for completion. It has should have no markup.

Returns
allocated string.

Definition at line 109 of file mode.c.

References rofi_mode::_get_completion, and rofi_mode::_get_display_value.

Referenced by combi_get_completion(), filter_elements(), and rofi_view_nav_row_select().

Here is the caller graph for this function:

◆ mode_get_display_name()

const char * mode_get_display_name ( const Mode * mode)
Parameters
modeThe mode to query

Get the name of the mode as it should be presented to the user.

Returns
the user visible name of the mode

Find the widget

Check string property

Definition at line 172 of file mode.c.

References rofi_mode::display_name, rofi_mode::name, P_STRING, rofi_config_find_widget(), rofi_theme_find_property(), _PropertyValue::s, Property::type, and Property::value.

Referenced by combi_mgrv(), rofi_view_add_widget(), rofi_view_create(), rofi_view_switch_mode(), and rofi_view_update_prompt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mode_get_display_value()

char * mode_get_display_value ( const Mode * mode,
unsigned int selected_line,
int * state,
GList ** attribute_list,
int get_entry )
Parameters
modeThe mode to query
selected_lineThe entry to query
stateThe state of the entry [out]
attribute_listList of extra (pango) attribute to apply when displaying. [out][null]
get_entryIf the should be returned.

Returns the string as it should be displayed for the entry and the state of how it should be displayed.

Returns
allocated new string and state when get_entry is TRUE otherwise just the state.

Definition at line 64 of file mode.c.

References rofi_mode::_get_display_value.

Referenced by combi_mgrv(), selection_changed_callback(), and update_callback().

Here is the caller graph for this function:

◆ mode_get_icon()

cairo_surface_t * mode_get_icon ( Mode * mode,
unsigned int selected_line,
unsigned int height )
Parameters
modeThe mode to query
selected_lineThe entry to query
heightThe desired height of the icon.

Returns the icon for the selected_line

Returns
allocated new cairo_surface_t if applicable

Load user entires

Definition at line 75 of file mode.c.

References rofi_mode::_get_icon, rofi_mode::fallback_icon_fetch_uid, rofi_mode::fallback_icon_not_found, rofi_mode::name, P_STRING, rofi_config_find_widget(), rofi_icon_fetcher_get(), rofi_icon_fetcher_query(), rofi_theme_find_property(), _PropertyValue::s, Property::type, and Property::value.

Referenced by combi_get_icon(), selection_changed_callback(), and update_callback().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mode_get_message()

char * mode_get_message ( const Mode * mode)
Parameters
modeThe mode to query

Query the mode for a user display.

Returns
a new allocated (valid pango markup) message to display (user should free).

Definition at line 201 of file mode.c.

References rofi_mode::_get_message.

Referenced by rofi_view_reload_message_bar(), and run_get_message().

Here is the caller graph for this function:

◆ mode_get_name()

const char * mode_get_name ( const Mode * mode)
Parameters
modeThe mode to query

Get the name of the mode.

Returns
the name of the mode.

Definition at line 145 of file mode.c.

References rofi_mode::name.

Referenced by combi_get_completion(), combi_mode_result(), combi_preprocess_input(), and mode_lookup().

Here is the caller graph for this function:

◆ mode_get_num_entries()

unsigned int mode_get_num_entries ( const Mode * mode)
Parameters
modeThe mode to query

Get the number of entries in the mode.

Returns
an unsigned int with the number of entries.

Definition at line 58 of file mode.c.

References rofi_mode::_get_num_entries.

Referenced by _rofi_view_reload_row(), combi_mode_get_num_entries(), rofi_view_create(), and rofi_view_reload_idle().

Here is the caller graph for this function:

◆ mode_get_private_data()

◆ mode_init()

int mode_init ( Mode * mode)
Parameters
modeThe mode to initialize

Initialize mode

Returns
FALSE if there was a failure, TRUE if successful

Definition at line 43 of file mode.c.

References rofi_mode::_init, rofi_mode::fallback_icon_fetch_uid, and rofi_mode::fallback_icon_not_found.

Referenced by combi_mode_init(), dmenu_mode_dialog(), run_mode_index(), and run_mode_result().

Here is the caller graph for this function:

◆ mode_preprocess_input()

char * mode_preprocess_input ( Mode * mode,
const char * input )
Parameters
modeThe mode to query
inputThe input to process

This processes the input so it can be used for matching and sorting. This includes removing pango markup.

Returns
a newly allocated string

Definition at line 195 of file mode.c.

References rofi_mode::_preprocess_input.

Referenced by rofi_view_refilter_real().

Here is the caller graph for this function:

◆ mode_result()

ModeMode mode_result ( Mode * mode,
int menu_retv,
char ** input,
unsigned int selected_line )
Parameters
modeThe mode to query
menu_retvThe menu return value.
inputPointer to the user input string. [in][out]
selected_linethe line selected by the user.

Acts on the user interaction.

Returns
the next ModeMode.

Definition at line 119 of file mode.c.

References rofi_mode::_result, MENU_LOWER_MASK, MENU_NEXT, MENU_PREVIOUS, MENU_QUICK_SWITCH, NEXT_DIALOG, and PREVIOUS_DIALOG.

Referenced by combi_mode_result(), and process_result().

Here is the caller graph for this function:

◆ mode_set_config()

void mode_set_config ( Mode * mode)
Parameters
modeThe mode to query

Should be called once for each mode. This adds the display-name configuration option for the mode.

Definition at line 188 of file mode.c.

References rofi_mode::cfg_name_key, config_parser_add_option(), rofi_mode::display_name, rofi_mode::name, and xrm_String.

Referenced by add_mode(), and rofi_collectmodes_setup().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mode_set_private_data()

void mode_set_private_data ( Mode * mode,
void * pd )
Parameters
modeThe mode to query
pdPointer to private data to attach to the mode.

Helper functions for mode. Set the private data object.

Definition at line 164 of file mode.c.

References rofi_mode::private_data.

Referenced by combi_mode_destroy(), combi_mode_init(), dmenu_mode_free(), dmenu_mode_init(), file_browser_mode_destroy(), file_browser_mode_init(), help_keys_mode_destroy(), help_keys_mode_init(), ssh_mode_destroy(), and ssh_mode_init().

Here is the caller graph for this function:

◆ mode_token_match()

int mode_token_match ( const Mode * mode,
rofi_int_matcher ** tokens,
unsigned int selected_line )
Parameters
modeThe mode to query
tokensThe set of tokens to match against
selected_lineThe index of the entry to match

Match entry against the set of tokens.

Returns
TRUE if matches

Definition at line 138 of file mode.c.

References rofi_mode::_token_match.

Referenced by combi_mode_match(), and filter_elements().

Here is the caller graph for this function: