Skip to content

Commit

Permalink
Make -plugin-path commandline flag be read before loading plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveDavenport committed Oct 16, 2017
1 parent f9cf9c6 commit 12e7b67
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions doc/help-output.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions doc/test_xr.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pkgconfig/rofi.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

pluginsdir=@libdir@/rofi/

Name: rofi
Description: Header files for rofi plugins
Expand Down
5 changes: 4 additions & 1 deletion source/rofi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 );
}
}
Expand Down
2 changes: 0 additions & 2 deletions source/xrmoptions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
};
Expand Down

0 comments on commit 12e7b67

Please sign in to comment.