rofi 2.1.2
Run
Collaboration diagram for Run:

Variables

Mode run_mode
Mode run_mode
#define G_LOG_DOMAIN   "Modes.Run"
#define RUN_CACHE_FILE   "rofi-4.runcache"
static gboolean exec_cmd (const char *cmd, int run_in_term, const char *orig)
static void delete_entry (const RunEntry *cmd)
static int sort_func (const void *a, const void *b, G_GNUC_UNUSED void *data)
static RunEntry * get_apps_external (RunEntry *retv, unsigned int *length, unsigned int num_favorites)
static RunEntry * get_apps (unsigned int *length)
static int run_mode_init (Mode *sw)
static void run_mode_destroy (Mode *sw)
static unsigned int run_mode_get_num_entries (const Mode *sw)
static ModeMode run_mode_result (Mode *sw, int mretv, char **input, unsigned int selected_line)
static char * _get_display_value (const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **list, int get_entry)
static int run_token_match (const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
static char * run_get_message (const Mode *sw)
static cairo_surface_t * _get_icon (const Mode *sw, unsigned int selected_line, unsigned int height)

Detailed Description

This mode uses the following options from the config object:

Macro Definition Documentation

◆ G_LOG_DOMAIN

#define G_LOG_DOMAIN   "Modes.Run"

The log domain of this dialog.

Definition at line 34 of file run.c.

◆ RUN_CACHE_FILE

#define RUN_CACHE_FILE   "rofi-4.runcache"

Name of the history file where previously chosen commands are stored.

Definition at line 64 of file run.c.

Referenced by delete_entry(), exec_cmd(), and get_apps().

Function Documentation

◆ _get_display_value()

char * _get_display_value ( const Mode * sw,
unsigned int selected_line,
G_GNUC_UNUSED int * state,
G_GNUC_UNUSED GList ** list,
int get_entry )
static

◆ _get_icon()

cairo_surface_t * _get_icon ( const Mode * sw,
unsigned int selected_line,
unsigned int height )
static

◆ delete_entry()

void delete_entry ( const RunEntry * cmd)
static
Parameters
cmdThe command to remove from history

Remove command from history.

Definition at line 147 of file run.c.

References cache_dir, delete_entry(), RunEntry::entry, RunEntry::exec, history_remove(), and RUN_CACHE_FILE.

Referenced by delete_entry(), and run_mode_result().

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

◆ exec_cmd()

gboolean exec_cmd ( const char * cmd,
int run_in_term,
const char * orig )
static
Parameters
cmdThe cmd to execute
run_in_termIndicate if command should be run in a terminal
origThe cmd to store in history

Execute command and add to history. Exact entries should be stored unquoted any custom or with filename should be saved in history quoted.

This happens in non-critical time (After launching app) It is allowed to be a bit slower.

Definition at line 104 of file run.c.

References cache_dir, exec_cmd(), helper_execute_command(), history_remove(), history_set(), and RUN_CACHE_FILE.

Referenced by exec_cmd(), and run_mode_result().

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

◆ get_apps()

RunEntry * get_apps ( unsigned int * length)
static

Internal spider used to get list of executables.

Definition at line 247 of file run.c.

References cache_dir, config, RunEntry::entry, RunEntry::exec, RunEntry::from_history, get_apps_external(), history_get_list(), RunEntry::icon, RunEntry::icon_fetch_scale, RunEntry::icon_fetch_size, RunEntry::icon_fetch_uid, rofi_expand_path(), RUN_CACHE_FILE, Settings::run_list_command, sort_func(), and TICK_N.

Referenced by run_mode_init().

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

◆ get_apps_external()

RunEntry * get_apps_external ( RunEntry * retv,
unsigned int * length,
unsigned int num_favorites )
static

External spider to get list of executables.

Definition at line 185 of file run.c.

References config, RunEntry::entry, RunEntry::exec, execute_generator(), RunEntry::from_history, get_apps_external(), RunEntry::icon, RunEntry::icon_fetch_scale, RunEntry::icon_fetch_size, RunEntry::icon_fetch_uid, and Settings::run_list_command.

Referenced by get_apps(), and get_apps_external().

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

◆ run_get_message()

char * run_get_message ( const Mode * sw)
static

◆ run_mode_destroy()

void run_mode_destroy ( Mode * sw)
static

◆ run_mode_get_num_entries()

unsigned int run_mode_get_num_entries ( const Mode * sw)
static

Definition at line 447 of file run.c.

References rofi_mode::_get_num_entries, RunModePrivateData::cmd_list_length, RunModePrivateData::completer, RunModePrivateData::file_complete, rofi_mode::private_data, and run_mode_get_num_entries().

Referenced by run_mode_get_num_entries().

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

◆ run_mode_init()

int run_mode_init ( Mode * sw)
static

Definition at line 415 of file run.c.

References RunModePrivateData::cmd_list, RunModePrivateData::cmd_list_length, RunModePrivateData::completer, get_apps(), rofi_mode::private_data, and run_mode_init().

Referenced by run_mode_init(), and run_mode_result().

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

◆ run_mode_result()

◆ run_token_match()

int run_token_match ( const Mode * sw,
rofi_int_matcher ** tokens,
unsigned int index )
static

Definition at line 552 of file run.c.

References rofi_mode::_token_match, RunModePrivateData::cmd_list, RunModePrivateData::completer, RunEntry::entry, RunModePrivateData::file_complete, helper_token_match(), rofi_mode::private_data, and run_token_match().

Referenced by run_token_match().

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

◆ sort_func()

int sort_func ( const void * a,
const void * b,
G_GNUC_UNUSED void * data )
static
Parameters
aThe First key to compare
bThe second key to compare
dataUnused.

Function used for sorting.

Returns
returns less then, equal to and greater than zero is a is less than, is a match or greater than b.

Definition at line 166 of file run.c.

References RunEntry::entry, and sort_func().

Referenced by get_apps(), and sort_func().

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

Variable Documentation

◆ run_mode [1/2]

Mode run_mode
extern

Mode object representing the run dialog.

Definition at line 607 of file run.c.

Referenced by rofi_collect_modes().

◆ run_mode [2/2]

Mode run_mode
Initial value:
= {.name = "run",
.cfg_name_key = "display-run",
._init = run_mode_init,
._get_num_entries = run_mode_get_num_entries,
._result = run_mode_result,
._destroy = run_mode_destroy,
._token_match = run_token_match,
._get_message = run_get_message,
._get_display_value = _get_display_value,
._get_icon = _get_icon,
._get_completion = NULL,
._preprocess_input = NULL,
.private_data = NULL,
.free = NULL,
static int run_token_match(const Mode *sw, rofi_int_matcher **tokens, unsigned int index)
Definition run.c:552
static char * run_get_message(const Mode *sw)
Definition run.c:560
static cairo_surface_t * _get_icon(const Mode *sw, unsigned int selected_line, unsigned int height)
Definition run.c:578
static void run_mode_destroy(Mode *sw)
Definition run.c:425
static unsigned int run_mode_get_num_entries(const Mode *sw)
Definition run.c:447
static ModeMode run_mode_result(Mode *sw, int mretv, char **input, unsigned int selected_line)
Definition run.c:455
static char * _get_display_value(const Mode *sw, unsigned int selected_line, G_GNUC_UNUSED int *state, G_GNUC_UNUSED GList **list, int get_entry)
Definition run.c:541
static int run_mode_init(Mode *sw)
Definition run.c:415
@ MODE_TYPE_SWITCHER

Mode object representing the run dialog.

Definition at line 607 of file run.c.

Referenced by rofi_collect_modes().