1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-18 13:54:36 -05:00

[Plugins] Add -no-plugins and -plugin-path options

* -no-plugins disables the loading of plugins.
* -plugin-path specifies the directory used by rofi to look for plugins.
This commit is contained in:
Dave Davenport 2017-04-21 09:48:03 +02:00
parent 01159b29f0
commit 04e764c8e6
6 changed files with 32 additions and 3 deletions

View file

@ -116,4 +116,5 @@ Settings config = {
.color_active = NULL, .color_active = NULL,
.color_urgent = NULL, .color_urgent = NULL,
.color_window = NULL, .color_window = NULL,
.plugin_path = PLUGIN_PATH,
}; };

View file

@ -222,6 +222,15 @@ Hide the indicator that shows what part of the string is matched.
Disables lazy grab, this forces the keyboard being grabbed before gui is shown. Disables lazy grab, this forces the keyboard being grabbed before gui is shown.
`-no-plugins`
Disable plugin loading.
`-plugin-path` *directory*
Specify the directory where *rofi* should look for plugins.
### Matching ### Matching
`-matching` *method* `-matching` *method*

View file

@ -312,6 +312,18 @@ Hide the indicator that shows what part of the string is matched\.
.P .P
Disables lazy grab, this forces the keyboard being grabbed before gui is shown\. Disables lazy grab, this forces the keyboard being grabbed before gui is shown\.
. .
.P
\fB\-no\-plugins\fR
.
.P
Disable plugin loading\.
.
.P
\fB\-plugin\-path\fR \fIdirectory\fR
.
.P
Specify the directory where \fIrofi\fR should look for plugins\.
.
.SS "Matching" .SS "Matching"
\fB\-matching\fR \fImethod\fR \fB\-matching\fR \fImethod\fR
. .

View file

@ -165,6 +165,8 @@ typedef struct
gboolean show_match; gboolean show_match;
char *theme; char *theme;
/** Path where plugins can be found. */
char * plugin_path;
} Settings; } Settings;
/** Global Settings structure. */ /** Global Settings structure. */
extern Settings config; extern Settings config;

View file

@ -305,6 +305,7 @@ static void print_main_application_options ( int is_term )
print_help_msg ( "-normal-window", "", "In dmenu mode, behave as a normal window. (experimental)", NULL, is_term ); print_help_msg ( "-normal-window", "", "In dmenu mode, behave as a normal window. (experimental)", NULL, 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 ( "-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-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 );
} }
static void help ( G_GNUC_UNUSED int argc, char **argv ) static void help ( G_GNUC_UNUSED int argc, char **argv )
{ {
@ -547,7 +548,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
Mode *m = NULL; Mode *m = NULL;
if ( g_module_symbol ( mod, "mode", (gpointer *) &m ) ) { if ( g_module_symbol ( mod, "mode", (gpointer *) &m ) ) {
if ( m->abi_version != ABI_VERSION ) { if ( m->abi_version != ABI_VERSION ) {
g_warning ( "ABI version of plugin does not match: %08X expecting: %08X", m->abi_version, ABI_VERSION ); g_warning ( "ABI version of plugin: '%s' does not match: %08X expecting: %08X", dn, m->abi_version, ABI_VERSION );
g_module_close ( mod ); g_module_close ( mod );
} }
else { else {
@ -558,7 +559,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
} }
} }
else { else {
g_warning ( "Symbol 'mode' not found in module: %s", fn ); g_warning ( "Symbol 'mode' not found in module: %s", dn );
g_module_close ( mod ); g_module_close ( mod );
} }
} }
@ -585,7 +586,9 @@ static void rofi_collect_modi ( void )
rofi_collect_modi_add ( &combi_mode ); rofi_collect_modi_add ( &combi_mode );
rofi_collect_modi_add ( &help_keys_mode ); rofi_collect_modi_add ( &help_keys_mode );
rofi_collect_modi_dir ( PLUGIN_PATH ); if ( find_arg ( "-no-plugins" ) < 0 ) {
rofi_collect_modi_dir ( config.plugin_path );
}
} }
/** /**

View file

@ -180,6 +180,8 @@ static XrmOption xrmOptions[] = {
"Color scheme for active row", CONFIG_DEFAULT }, "Color scheme for active row", CONFIG_DEFAULT },
{ xrm_String, "color-window", { .str = &config.color_window }, NULL, { xrm_String, "color-window", { .str = &config.color_window }, NULL,
"Color scheme window", CONFIG_DEFAULT }, "Color scheme window", CONFIG_DEFAULT },
{ xrm_String, "plugin-path", { .str = &config.plugin_path }, NULL,
"Directory containing plugins", CONFIG_DEFAULT },
}; };
/** Dynamic array of extra options */ /** Dynamic array of extra options */