rofi  1.5.4
Mode

The 'object' that makes a mode in rofi. More...

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_PREVIOUS = 0x00400000, 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 (const Mode *mode, unsigned int selected_line, 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 32 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_PREVIOUS 

Go to the previous menu.

MENU_CUSTOM_ACTION 

Bindings specifics

MENU_LOWER_MASK 

Mask

Definition at line 66 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 49 of file mode.c.

References rofi_mode::_destroy.

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

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 118 of file mode.c.

Referenced by rofi_collect_modi_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 84 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

Definition at line 143 of file mode.c.

References rofi_mode::display_name, and rofi_mode::name.

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

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 63 of file mode.c.

References rofi_mode::_get_display_value.

Referenced by combi_mgrv(), and update_callback().

Here is the caller graph for this function:

◆ mode_get_icon()

cairo_surface_t* mode_get_icon ( const Mode mode,
unsigned int  selected_line,
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

Definition at line 72 of file mode.c.

References rofi_mode::_get_icon.

Referenced by combi_get_icon(), and update_callback().

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 164 of file mode.c.

References rofi_mode::_get_message.

Referenced by rofi_view_reload_message_bar().

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 112 of file mode.c.

References rofi_mode::name.

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

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 56 of file mode.c.

References rofi_mode::_get_num_entries.

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

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 42 of file mode.c.

References rofi_mode::_init.

Referenced by combi_mode_init(), dmenu_switcher_dialog(), and run_switcher().

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 157 of file mode.c.

References rofi_mode::_preprocess_input.

Referenced by rofi_view_refilter().

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 97 of file mode.c.

References rofi_mode::_result.

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 151 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 rofi_collect_modi_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 134 of file mode.c.

References rofi_mode::private_data.

Referenced by combi_mode_destroy(), combi_mode_init(), dmenu_mode_free(), dmenu_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 105 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: