rofi
1.7.0
|
#include <config.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <errno.h>
#include <signal.h>
#include <string.h>
#include <strings.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include "dialogs/drun.h"
#include "dialogs/filebrowser.h"
#include "helper.h"
#include "history.h"
#include "mode-private.h"
#include "rofi.h"
#include "settings.h"
#include "timings.h"
#include "widgets/textbox.h"
#include "xcb.h"
#include "rofi-icon-fetcher.h"
Go to the source code of this file.
Data Structures | |
struct | DRunModeEntry |
struct | DRunEntryField |
struct | _DRunModePrivateData |
struct | RegexEvalArg |
Macros | |
#define | G_LOG_DOMAIN "Dialogs.DRun" |
#define | DRUN_CACHE_FILE "rofi3.druncache" |
#define | DRUN_DESKTOP_CACHE_FILE "rofi-drun-desktop.cache" |
#define | CACHE_VERSION 2 |
Typedefs | |
typedef struct _DRunModePrivateData | DRunModePrivateData |
Functions | |
static gboolean | drun_helper_eval_cb (const GMatchInfo *info, GString *res, gpointer data) |
static void | launch_link_entry (DRunModeEntry *e) |
static void | exec_cmd_entry (DRunModeEntry *e, const char *path) |
static gboolean | rofi_strv_contains (const char *const *categories, const char *const *field) |
static void | read_desktop_file (DRunModePrivateData *pd, const char *root, const char *path, const gchar *basename, const char *action) |
static void | walk_dir (DRunModePrivateData *pd, const char *root, const char *dirname) |
static void | delete_entry_history (const DRunModeEntry *entry) |
static void | get_apps_history (DRunModePrivateData *pd) |
static gint | drun_int_sort_list (gconstpointer a, gconstpointer b, G_GNUC_UNUSED gpointer user_data) |
static void | drun_write_str (FILE *fd, const char *str) |
static void | drun_write_integer (FILE *fd, int32_t val) |
static void | drun_read_integer (FILE *fd, int32_t *type) |
static void | drun_read_string (FILE *fd, char **str) |
static void | drun_write_strv (FILE *fd, char **str) |
static void | drun_read_stringv (FILE *fd, char ***str) |
static void | write_cache (DRunModePrivateData *pd, const char *cache_file) |
static gboolean | drun_read_cache (DRunModePrivateData *pd, const char *cache_file) |
static void | get_apps (DRunModePrivateData *pd) |
static void | drun_mode_parse_entry_fields () |
static void | drun_mode_parse_display_format () |
static int | drun_mode_init (Mode *sw) |
static void | drun_entry_clear (DRunModeEntry *e) |
static ModeMode | drun_mode_result (Mode *sw, int mretv, char **input, unsigned int selected_line) |
static void | drun_mode_destroy (Mode *sw) |
static char * | _get_display_value (const Mode *sw, unsigned int selected_line, int *state, G_GNUC_UNUSED GList **list, int get_entry) |
static cairo_surface_t * | fallback_icon (DRunModePrivateData *pd, int height) |
static cairo_surface_t * | _get_icon (const Mode *sw, unsigned int selected_line, int height) |
static char * | drun_get_completion (const Mode *sw, unsigned int index) |
static int | drun_token_match (const Mode *data, rofi_int_matcher **tokens, unsigned int index) |
static unsigned int | drun_mode_get_num_entries (const Mode *sw) |
static char * | drun_get_message (const Mode *sw) |
Variables | |
char * | DRUN_GROUP_NAME = "Desktop Entry" |
static DRunEntryField | matching_entry_fields [DRUN_MATCH_NUM_FIELDS] |
Mode | drun_mode |
#define CACHE_VERSION 2 |
#define DRUN_CACHE_FILE "rofi3.druncache" |
#define DRUN_DESKTOP_CACHE_FILE "rofi-drun-desktop.cache" |
#define G_LOG_DOMAIN "Dialogs.DRun" |
typedef struct _DRunModePrivateData DRunModePrivateData |
enum DRunDesktopEntryType |
enum DRunMatchingFields |
The fields that can be displayed and used for matching
|
static |
Definition at line 1270 of file drun.c.
References rofi_mode::_get_display_value, DRunModeEntry::categories, DRunModeEntry::comment, _DRunModePrivateData::completer, config, Settings::drun_display_format, _DRunModePrivateData::entry_list, DRunModeEntry::exec, _DRunModePrivateData::file_complete, DRunModeEntry::generic_name, helper_string_replace_if_exists(), DRunModeEntry::keywords, MARKUP, mode_get_private_data(), and DRunModeEntry::name.
|
static |
Definition at line 1341 of file drun.c.
References rofi_mode::_get_icon, _DRunModePrivateData::completer, _DRunModePrivateData::entry_list, fallback_icon(), _DRunModePrivateData::file_complete, DRunModeEntry::icon_fetch_uid, DRunModeEntry::icon_name, mode_get_private_data(), rofi_icon_fetcher_get(), and rofi_icon_fetcher_query().
|
static |
entry | The command entry to remove from history |
Remove command from history.
Definition at line 777 of file drun.c.
References cache_dir, DRunModeEntry::desktop_id, DRUN_CACHE_FILE, and history_remove().
Referenced by drun_mode_result().
|
static |
Definition at line 1130 of file drun.c.
References DRunModeEntry::action, DRunModeEntry::app_id, DRunModeEntry::categories, DRunModeEntry::comment, DRunModeEntry::desktop_id, DRUN_GROUP_NAME, DRunModeEntry::exec, DRunModeEntry::generic_name, DRunModeEntry::icon, DRunModeEntry::icon_name, DRunModeEntry::key_file, DRunModeEntry::keywords, DRunModeEntry::name, DRunModeEntry::path, and DRunModeEntry::root.
Referenced by drun_mode_destroy(), and drun_mode_result().
|
static |
Definition at line 1366 of file drun.c.
References _DRunModePrivateData::entry_list, DRunModeEntry::generic_name, mode_get_private_data(), and DRunModeEntry::name.
|
static |
Definition at line 1451 of file drun.c.
References _DRunModePrivateData::cmd_list_length, _DRunModePrivateData::completer, _DRunModePrivateData::entry_list, _DRunModePrivateData::file_complete, mode_get_message(), DRunModeEntry::name, rofi_mode::private_data, and _DRunModePrivateData::selected_line.
|
static |
Definition at line 228 of file drun.c.
References RegexEvalArg::e, DRunModeEntry::icon, DRunModeEntry::icon_name, DRunModeEntry::name, and DRunModeEntry::path.
Referenced by exec_cmd_entry().
|
static |
Definition at line 806 of file drun.c.
References DRunModeEntry::name, and DRunModeEntry::sort_index.
Referenced by get_apps().
|
static |
Definition at line 1250 of file drun.c.
References _DRunModePrivateData::cmd_list_length, _DRunModePrivateData::completer, _DRunModePrivateData::current_desktop_list, _DRunModePrivateData::disabled_entries, drun_entry_clear(), _DRunModePrivateData::entry_list, mode_destroy(), mode_get_private_data(), mode_set_private_data(), _DRunModePrivateData::old_completer_input, _DRunModePrivateData::old_input, and _DRunModePrivateData::show_categories.
|
static |
Definition at line 1443 of file drun.c.
References rofi_mode::_get_num_entries, _DRunModePrivateData::cmd_list_length, _DRunModePrivateData::completer, _DRunModePrivateData::file_complete, and mode_get_private_data().
|
static |
Definition at line 1105 of file drun.c.
References _DRunModePrivateData::completer, config, create_new_file_browser(), _DRunModePrivateData::current_desktop_list, _DRunModePrivateData::disabled_entries, Settings::drun_categories, drun_mode_parse_display_format(), drun_mode_parse_entry_fields(), get_apps(), mode_get_private_data(), mode_init(), mode_set_private_data(), and _DRunModePrivateData::show_categories.
|
static |
Definition at line 1091 of file drun.c.
References config, Settings::drun_display_format, DRUN_MATCH_NUM_FIELDS, DRunEntryField::enabled_match, and matching_entry_fields.
Referenced by drun_mode_init().
|
static |
Definition at line 1055 of file drun.c.
References config, Settings::drun_match_fields, DRUN_MATCH_NUM_FIELDS, DRunEntryField::enabled_display, DRunEntryField::enabled_match, DRunEntryField::entry_field_name, and matching_entry_fields.
Referenced by drun_mode_init().
|
static |
Definition at line 1153 of file drun.c.
References _DRunModePrivateData::cmd_list_length, _DRunModePrivateData::completer, delete_entry_history(), DRUN_DESKTOP_ENTRY_TYPE_APPLICATION, DRUN_DESKTOP_ENTRY_TYPE_LINK, DRUN_DESKTOP_ENTRY_TYPE_SERVICE, drun_entry_clear(), _DRunModePrivateData::entry_list, DRunModeEntry::exec, exec_cmd_entry(), file_browser_mode_completer(), _DRunModePrivateData::file_complete, helper_execute_command(), launch_link_entry(), MENU_CANCEL, MENU_COMPLETE, MENU_CUSTOM_ACTION, MENU_CUSTOM_COMMAND, MENU_CUSTOM_INPUT, MENU_ENTRY_DELETE, MENU_LOWER_MASK, MENU_OK, MODE_EXIT, mode_get_private_data(), RofiHelperExecuteContext::name, _DRunModePrivateData::old_completer_input, _DRunModePrivateData::old_input, RELOAD_DIALOG, _DRunModePrivateData::selected_line, DRunModeEntry::sort_index, and DRunModeEntry::type.
|
static |
Read cache file. returns FALSE when success.
Definition at line 932 of file drun.c.
References DRunModeEntry::action, DRunModeEntry::app_id, CACHE_VERSION, DRunModeEntry::categories, _DRunModePrivateData::cmd_list_length, _DRunModePrivateData::cmd_list_length_actual, DRunModeEntry::comment, config, DRunModeEntry::desktop_id, drun_read_integer(), drun_read_string(), drun_read_stringv(), Settings::drun_reload_desktop_cache, Settings::drun_use_desktop_cache, _DRunModePrivateData::entry_list, DRunModeEntry::exec, DRunModeEntry::generic_name, DRunModeEntry::icon_name, DRunModeEntry::keywords, DRunModeEntry::name, DRunModeEntry::path, DRunModeEntry::root, TICK_N, and DRunModeEntry::type.
Referenced by get_apps().
|
static |
Definition at line 844 of file drun.c.
Referenced by drun_read_cache().
|
static |
Definition at line 850 of file drun.c.
Referenced by drun_read_cache(), and drun_read_stringv().
|
static |
Definition at line 874 of file drun.c.
References drun_read_string().
Referenced by drun_read_cache().
|
static |
Definition at line 1376 of file drun.c.
References rofi_mode::_token_match, DRunModeEntry::categories, DRunModeEntry::comment, _DRunModePrivateData::completer, DRUN_MATCH_FIELD_CATEGORIES, DRUN_MATCH_FIELD_COMMENT, DRUN_MATCH_FIELD_EXEC, DRUN_MATCH_FIELD_GENERIC, DRUN_MATCH_FIELD_KEYWORDS, DRUN_MATCH_FIELD_NAME, _DRunModePrivateData::entry_list, DRunModeEntry::exec, _DRunModePrivateData::file_complete, DRunModeEntry::generic_name, helper_token_match(), rofi_int_matcher_t::invert, DRunModeEntry::keywords, matching_entry_fields, mode_get_private_data(), and DRunModeEntry::name.
|
static |
Definition at line 841 of file drun.c.
Referenced by write_cache().
|
static |
Definition at line 832 of file drun.c.
Referenced by drun_write_strv(), and write_cache().
|
static |
Definition at line 867 of file drun.c.
References drun_write_str().
Referenced by write_cache().
|
static |
Definition at line 324 of file drun.c.
References DRunModeEntry::action, DRunModeEntry::app_id, cache_dir, DRunModeEntry::desktop_id, DRUN_CACHE_FILE, drun_helper_eval_cb(), RegexEvalArg::e, DRunModeEntry::exec, helper_execute_command(), history_set(), DRunModeEntry::icon_name, DRunModeEntry::key_file, RofiHelperExecuteContext::name, DRunModeEntry::name, DRunModeEntry::path, RegexEvalArg::path, RegexEvalArg::success, and RofiHelperExecuteContext::wmclass.
Referenced by drun_mode_result().
|
static |
Definition at line 1330 of file drun.c.
References Settings::application_fallback_icon, config, _DRunModePrivateData::fallback_icon_fetch_uid, rofi_icon_fetcher_get(), and rofi_icon_fetcher_query().
Referenced by _get_icon().
|
static |
Load user entires
Load application entires
Definition at line 1004 of file drun.c.
References _PropertyValue::b, cache_dir, _DRunModePrivateData::cmd_list_length, DRUN_DESKTOP_CACHE_FILE, drun_int_sort_list(), drun_mode, drun_read_cache(), _DRunModePrivateData::entry_list, get_apps_history(), rofi_mode::name, P_BOOLEAN, rofi_config_find_widget(), rofi_theme_find_property(), TICK_N, Property::type, Property::value, walk_dir(), and write_cache().
Referenced by drun_mode_init().
|
static |
Definition at line 783 of file drun.c.
References cache_dir, _DRunModePrivateData::cmd_list_length, DRunModeEntry::desktop_id, DRUN_CACHE_FILE, _DRunModePrivateData::entry_list, history_get_list(), DRunModeEntry::sort_index, and TICK_N.
Referenced by get_apps().
|
static |
Definition at line 287 of file drun.c.
References DRunModeEntry::action, DRunModeEntry::app_id, cache_dir, config, DRunModeEntry::desktop_id, DRUN_CACHE_FILE, Settings::drun_url_launcher, RegexEvalArg::e, helper_execute_command(), history_set(), DRunModeEntry::key_file, DRunModeEntry::path, and RegexEvalArg::path.
Referenced by drun_mode_result().
|
static |
This function absorbs/freeÅ› path, so this is no longer available afterwards.
Definition at line 422 of file drun.c.
References DRunModeEntry::action, DRunModeEntry::app_id, DRunModeEntry::categories, _DRunModePrivateData::cmd_list_length, _DRunModePrivateData::cmd_list_length_actual, DRunModeEntry::comment, config, _DRunModePrivateData::current_desktop_list, DRunModeEntry::desktop_id, _DRunModePrivateData::disabled_entries, DRUN_DESKTOP_ENTRY_TYPE_APPLICATION, DRUN_DESKTOP_ENTRY_TYPE_LINK, DRUN_DESKTOP_ENTRY_TYPE_SERVICE, DRUN_DESKTOP_ENTRY_TYPE_UNDETERMINED, DRUN_GROUP_NAME, DRUN_MATCH_FIELD_CATEGORIES, DRUN_MATCH_FIELD_COMMENT, DRUN_MATCH_FIELD_KEYWORDS, Settings::drun_show_actions, _DRunModePrivateData::entry_list, DRunModeEntry::exec, DRunModeEntry::generic_name, DRunModeEntry::icon, DRunModeEntry::icon_fetch_uid, DRunModeEntry::icon_name, DRunModeEntry::icon_size, DRunModeEntry::key_file, DRunModeEntry::keywords, matching_entry_fields, DRunModeEntry::name, DRunModeEntry::path, RegexEvalArg::path, rofi_strv_contains(), DRunModeEntry::root, _DRunModePrivateData::show_categories, DRunModeEntry::sort_index, and DRunModeEntry::type.
Referenced by walk_dir().
|
static |
Definition at line 408 of file drun.c.
Referenced by read_desktop_file().
|
static |
Internal spider used to get list of executables.
Definition at line 714 of file drun.c.
References DRUN_GROUP_NAME, and read_desktop_file().
Referenced by get_apps().
|
static |
Definition at line 890 of file drun.c.
References DRunModeEntry::action, DRunModeEntry::app_id, CACHE_VERSION, DRunModeEntry::categories, _DRunModePrivateData::cmd_list_length, DRunModeEntry::comment, config, DRunModeEntry::desktop_id, Settings::drun_use_desktop_cache, drun_write_integer(), drun_write_str(), drun_write_strv(), _DRunModePrivateData::entry_list, DRunModeEntry::exec, DRunModeEntry::generic_name, DRunModeEntry::icon_name, DRunModeEntry::keywords, DRunModeEntry::name, DRunModeEntry::path, DRunModeEntry::root, TICK_N, and DRunModeEntry::type.
Referenced by get_apps().
char* DRUN_GROUP_NAME = "Desktop Entry" |
The group name used in desktop files
Definition at line 67 of file drun.c.
Referenced by drun_entry_clear(), read_desktop_file(), and walk_dir().
Mode drun_mode |
The DRun Mode interface.
Definition at line 1471 of file drun.c.
Referenced by get_apps(), and rofi_collect_modi().
|
static |
Stores what fields should be matched on user input. based on user setting.
Definition at line 163 of file drun.c.
Referenced by drun_mode_parse_display_format(), drun_mode_parse_entry_fields(), drun_token_match(), and read_desktop_file().