Make -plugin-path commandline flag be read before loading plugins

This commit is contained in:
Dave Davenport 2017-10-16 18:25:16 +02:00
parent f9cf9c6b87
commit 12e7b67ddd
5 changed files with 6 additions and 5 deletions

View File

@ -15,6 +15,7 @@ Command line only options:
-show [mode] Show the mode 'mode' and exit. The mode has to be enabled.
-no-lazy-grab Disable lazy grab that, when fail to grab keyboard, does not block but retry later.
-no-plugins Disable loading of external plugins.
-plugin-path Directory used to search for rofi plugins.
-dump-config Dump the current configuration in rasi format and exit.
-dump-theme Dump the current theme in rasi format and exit.
DMENU command line options:

View File

@ -106,8 +106,6 @@ rofi.scroll-method: 0
! rofi.color-active:
! "Color scheme window" Set from: Default
! rofi.color-window:
! "Directory containing plugins" Set from: File
rofi.plugin-path: /usr/lib/rofi
! "Max history size (WARNING: can cause slowdowns when set to high)." Set from: Default
! rofi.max-history-size: 25
! "Pidfile location" Set from: File

View File

@ -3,6 +3,7 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
pluginsdir=@libdir@/rofi/
Name: rofi
Description: Header files for rofi plugins

View File

@ -274,6 +274,7 @@ static void print_main_application_options ( int is_term )
print_help_msg ( "-show", "[mode]", "Show the mode 'mode' and exit. The mode has to be enabled.", NULL, is_term );
print_help_msg ( "-no-lazy-grab", "", "Disable lazy grab that, when fail to grab keyboard, does not block but retry later.", NULL, is_term );
print_help_msg ( "-no-plugins", "", "Disable loading of external plugins.", NULL, is_term );
print_help_msg ( "-plugin-path", "", "Directory used to search for rofi plugins.", NULL, is_term );
print_help_msg ( "-dump-config", "", "Dump the current configuration in rasi format and exit.", NULL, is_term );
print_help_msg ( "-dump-theme", "", "Dump the current theme in rasi format and exit.", NULL, is_term );
}
@ -488,7 +489,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
if ( !g_str_has_suffix ( dn, G_MODULE_SUFFIX ) ) {
continue;
}
char *fn = g_build_filename ( PLUGIN_PATH, dn, NULL );
char *fn = g_build_filename ( base_dir, dn, NULL );
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
if ( mod ) {
Mode *m = NULL;
@ -536,6 +537,8 @@ static void rofi_collect_modi ( void )
rofi_collect_modi_add ( &help_keys_mode );
if ( find_arg ( "-no-plugins" ) < 0 ) {
find_arg_str ( "-plugin-path", &(config.plugin_path) );
g_debug ( "Parse plugin path: %s", config.plugin_path );
rofi_collect_modi_dir ( config.plugin_path );
}
}

View File

@ -202,8 +202,6 @@ static XrmOption xrmOptions[] = {
"Color scheme for active row", CONFIG_DEFAULT },
{ xrm_String, "color-window", { .str = &config.color_window }, NULL,
"Color scheme window", CONFIG_DEFAULT },
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
"Directory containing plugins", CONFIG_DEFAULT },
{ xrm_Number, "max-history-size", { .num = &config.max_history_size }, NULL,
"Max history size (WARNING: can cause slowdowns when set to high).", CONFIG_DEFAULT },
};