rofi
1.5.4
|
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdint.h>
#include <errno.h>
#include <time.h>
#include <locale.h>
#include <gmodule.h>
#include <xcb/xcb.h>
#include <sys/types.h>
#include <sysexits.h>
#include <glib-unix.h>
#include <libgwater-xcb.h>
#include "resources.h"
#include "rofi.h"
#include "display.h"
#include "settings.h"
#include "mode.h"
#include "helper.h"
#include "widgets/textbox.h"
#include "xrmoptions.h"
#include "dialogs/dialogs.h"
#include "view.h"
#include "view-internal.h"
#include "theme.h"
#include "rofi-icon-fetcher.h"
#include "timings.h"
#include "mode-private.h"
Go to the source code of this file.
Macros | |
#define | G_LOG_DOMAIN "Rofi" |
Functions | |
static void | rofi_collect_modi_destroy (void) |
void | rofi_add_error_message (GString *str) |
void | process_result (RofiViewState *state) |
void | rofi_set_return_code (int code) |
unsigned int | rofi_get_num_enabled_modi (void) |
const Mode * | rofi_get_mode (unsigned int index) |
static int | switcher_get (const char *name) |
static void | teardown (int pfd) |
static void | run_switcher (ModeMode mode) |
static void | print_list_of_modi (int is_term) |
static void | print_main_application_options (int is_term) |
static void | help (G_GNUC_UNUSED int argc, char **argv) |
static void | help_print_disabled_mode (const char *mode) |
static void | help_print_mode_not_found (const char *mode) |
static void | help_print_no_arguments (void) |
static void | cleanup () |
Mode * | rofi_collect_modi_search (const char *name) |
static gboolean | rofi_collect_modi_add (Mode *mode) |
static void | rofi_collect_modi_dir (const char *base_dir) |
static void | rofi_collect_modi (void) |
static void | rofi_collect_modi_setup (void) |
static int | add_mode (const char *token) |
static gboolean | setup_modi (void) |
void | rofi_quit_main_loop (void) |
static gboolean | main_loop_signal_handler_int (G_GNUC_UNUSED gpointer data) |
static void | show_error_dialog () |
static gboolean | startup (G_GNUC_UNUSED gpointer data) |
static gboolean | record (G_GNUC_UNUSED void *data) |
int | main (int argc, char *argv[]) |
Variables | |
char * | pidfile = NULL |
const char * | cache_dir = NULL |
GList * | list_of_error_msgs = NULL |
G_MODULE_EXPORT char * | config_path = NULL |
G_MODULE_EXPORT char * | config_path_new = NULL |
Mode ** | modi = NULL |
Mode ** | available_modi = NULL |
unsigned int | num_available_modi = 0 |
unsigned int | num_modi = 0 |
unsigned int | curr_switcher = 0 |
NkBindings * | bindings = NULL |
GMainLoop * | main_loop = NULL |
static int | dmenu_mode = FALSE |
int | return_code = EXIT_SUCCESS |
|
static |
Parse the switcher string, into internal array of type Mode.
String is split on separator ',' First the three build-in modi are checked: window, run, ssh if that fails, a script-switcher is created.
Definition at line 591 of file rofi.c.
References modi, num_modi, rofi_collect_modi_add(), rofi_collect_modi_search(), script_switcher_is_valid(), and script_switcher_parse_setup().
Referenced by setup_modi(), and startup().
|
static |
Cleanup globally allocated memory.
Definition at line 420 of file rofi.c.
References bindings, config_path, config_path_new, config_xresource_free(), display_cleanup(), list_of_error_msgs, main_loop, mode_destroy(), modi, num_modi, rofi_collect_modi_destroy(), rofi_icon_fetcher_destroy(), rofi_theme, rofi_theme_free(), rofi_view_workers_finalize(), and TIMINGS_STOP.
Referenced by main().
|
static |
Definition at line 287 of file rofi.c.
References color_bold, color_green, color_red, color_reset, config_path, config_path_new, display_dump_monitor_layout(), find_arg(), print_dmenu_options(), print_list_of_modi(), print_main_application_options(), and print_options().
Referenced by main().
|
static |
Definition at line 348 of file rofi.c.
References color_green, color_red, color_reset, config, and Settings::modi.
Referenced by startup().
|
static |
Definition at line 362 of file rofi.c.
References available_modi, modi, num_available_modi, num_modi, and rofi_add_error_message().
Referenced by setup_modi(), and startup().
|
static |
Definition at line 381 of file rofi.c.
References available_modi, color_bold, color_green, color_red, color_reset, modi, num_available_modi, and num_modi.
Referenced by startup().
int main | ( | int | argc, |
char * | argv[] | ||
) |
argc | number of input arguments. |
argv | array of the input arguments. |
Main application entry point.
dirty hack for dmenu compatibility
Make small commandline changes to the current theme.
Definition at line 755 of file rofi.c.
References bindings, Settings::cache_dir, cache_dir, cleanup(), cmd_set_arguments(), color_bold, color_reset, config, config_parse_cmd_options(), config_parse_dump_config_rasi_format(), config_parse_xresource_dump(), config_parse_xresource_options(), config_parse_xresource_options_file(), config_parser_add_option(), config_path, config_path_new, create_pid_file(), display_late_setup(), display_setup(), dmenu_mode, find_arg(), find_arg_str(), find_arg_strv(), find_arg_uint(), help(), list_of_error_msgs, main_loop, main_loop_signal_handler_int(), Settings::monitor, parse_keys_abe(), pidfile, record(), return_code, rofi_collect_modi(), rofi_collect_modi_setup(), rofi_expand_path(), rofi_icon_fetcher_init(), rofi_theme, rofi_theme_free(), rofi_theme_is_empty(), rofi_theme_parse_file(), rofi_theme_parse_string(), rofi_theme_print(), rofi_view_workers_initialize(), setup_abe(), setup_modi(), startup(), teardown(), textbox_setup(), Settings::theme, TICK, TICK_N, TIMINGS_START, xcb, and xrm_String.
|
static |
|
static |
Help function.
Definition at line 251 of file rofi.c.
References available_modi, color_green, color_red, color_reset, modi, num_available_modi, and num_modi.
Referenced by help().
|
static |
Definition at line 269 of file rofi.c.
References print_help_msg().
Referenced by help().
void process_result | ( | RofiViewState * | state | ) |
state | The Menu Handle |
Check if a finalize function is set, and if sets executes it.
Load in the new mode.
Definition at line 199 of file rofi.c.
References curr_switcher, MODE_EXIT, mode_result(), modi, NEXT_DIALOG, num_modi, PREVIOUS_DIALOG, RELOAD_DIALOG, RESET_DIALOG, rofi_view_clear_input(), rofi_view_free(), rofi_view_get_return_value(), rofi_view_get_selected_line(), rofi_view_get_user_input(), rofi_view_set_active(), rofi_view_switch_mode(), and RofiViewState::sw.
Referenced by rofi_view_error_dialog(), and run_switcher().
|
static |
Definition at line 742 of file rofi.c.
References rofi_capture_screenshot().
Referenced by main().
|
static |
Find all available modi.
Definition at line 537 of file rofi.c.
References combi_mode, config, find_arg(), find_arg_str(), help_keys_mode, Settings::plugin_path, rofi_collect_modi_add(), rofi_collect_modi_dir(), run_mode, and ssh_mode.
Referenced by main().
|
static |
mode | Add mode to list. |
Definition at line 482 of file rofi.c.
References available_modi, rofi_mode::name, num_available_modi, and rofi_collect_modi_search().
Referenced by add_mode(), rofi_collect_modi(), and rofi_collect_modi_dir().
|
static |
Definition at line 567 of file rofi.c.
References available_modi, mode_free(), rofi_mode::module, and num_available_modi.
Referenced by cleanup().
|
static |
Definition at line 495 of file rofi.c.
References ABI_VERSION, and rofi_collect_modi_add().
Referenced by rofi_collect_modi().
|
static |
Setup configuration for config.
Definition at line 561 of file rofi.c.
References available_modi, mode_set_config(), and num_available_modi.
Referenced by main().
|
static |
Definition at line 172 of file rofi.c.
References config, curr_switcher, ERROR_MSG_MARKUP, Settings::filter, main_loop, mode_init(), modi, num_modi, process_result(), rofi_view_create(), rofi_view_error_dialog(), rofi_view_get_active(), and rofi_view_set_active().
Referenced by startup().
|
static |
Definition at line 614 of file rofi.c.
References add_mode(), config, help_print_mode_not_found(), and Settings::modi.
Referenced by main().
|
static |
Definition at line 646 of file rofi.c.
References ERROR_MSG_MARKUP, list_of_error_msgs, rofi_set_return_code(), and rofi_view_error_dialog().
Referenced by startup().
|
static |
Definition at line 666 of file rofi.c.
References __create_window(), add_mode(), config, config_sanity_check(), dmenu_mode, dmenu_switcher_dialog(), find_arg(), find_arg_str(), help_print_disabled_mode(), help_print_mode_not_found(), help_print_no_arguments(), list_of_error_msgs, main_loop, MENU_NORMAL, MENU_NORMAL_WINDOW, num_modi, rofi_set_return_code(), rofi_view_error_dialog(), run_switcher(), show_error_dialog(), Settings::sidebar_mode, switcher_get(), and TICK_N.
Referenced by main().
|
static |
name | Name of the switcher to lookup. |
Find the index of the switcher with name.
Definition at line 146 of file rofi.c.
References mode_get_name(), modi, and num_modi.
Referenced by startup().
|
static |
Teardown the gui.
Definition at line 159 of file rofi.c.
References display_early_cleanup(), remove_pid_file(), rofi_view_cleanup(), and textbox_cleanup().
Referenced by main().
Mode** available_modi = NULL |
List of (possibly uninitialized) modi's
Definition at line 103 of file rofi.c.
Referenced by help_print_mode_not_found(), help_print_no_arguments(), print_list_of_modi(), rofi_collect_modi_add(), rofi_collect_modi_destroy(), rofi_collect_modi_search(), and rofi_collect_modi_setup().
NkBindings* bindings = NULL |
Handle to NkBindings object for input devices.
Definition at line 112 of file rofi.c.
Referenced by cleanup(), display_setup(), main(), and parse_keys_abe().
G_MODULE_EXPORT char* config_path = NULL |
G_MODULE_EXPORT char* config_path_new = NULL |
unsigned int curr_switcher = 0 |
Current selected mode
Definition at line 109 of file rofi.c.
Referenced by process_result(), and run_switcher().
|
static |
GList* list_of_error_msgs = NULL |
List of error messages.
Definition at line 87 of file rofi.c.
Referenced by cleanup(), main(), rofi_add_error_message(), show_error_dialog(), and startup().
GMainLoop* main_loop = NULL |
Glib main loop.
Definition at line 115 of file rofi.c.
Referenced by cleanup(), display_setup(), main(), main_loop_signal_handler_int(), rofi_quit_main_loop(), run_switcher(), and startup().
Mode** modi = NULL |
Array holding all activated modi.
Definition at line 100 of file rofi.c.
Referenced by add_mode(), cleanup(), help_print_mode_not_found(), help_print_no_arguments(), print_list_of_modi(), process_result(), rofi_get_mode(), run_switcher(), and switcher_get().
unsigned int num_available_modi = 0 |
Length of num_available_modi
Definition at line 105 of file rofi.c.
Referenced by help_print_mode_not_found(), help_print_no_arguments(), print_list_of_modi(), rofi_collect_modi_add(), rofi_collect_modi_destroy(), rofi_collect_modi_search(), and rofi_collect_modi_setup().
unsigned int num_modi = 0 |
Number of activated modi in modi array
Definition at line 107 of file rofi.c.
Referenced by add_mode(), cleanup(), help_print_mode_not_found(), help_print_no_arguments(), print_list_of_modi(), process_result(), rofi_get_num_enabled_modi(), run_switcher(), startup(), and switcher_get().
char* pidfile = NULL |
Location of pidfile for this instance.
Definition at line 82 of file rofi.c.
Referenced by create_pid_file(), and main().
int return_code = EXIT_SUCCESS |
Rofi's return code
Definition at line 120 of file rofi.c.
Referenced by main(), and rofi_set_return_code().