1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Add ROFI_PLUGIN_PATH environment variable.

This commit is contained in:
Dave Davenport 2020-04-19 11:34:28 +02:00
parent 3e64e4422d
commit 3a9c60804b

View file

@ -504,6 +504,7 @@ static gboolean rofi_collect_modi_add ( Mode *mode )
static void rofi_collect_modi_dir ( const char *base_dir ) static void rofi_collect_modi_dir ( const char *base_dir )
{ {
g_debug ( "Looking into: %s for plugins", base_dir );
GDir *dir = g_dir_open ( base_dir, 0, NULL ); GDir *dir = g_dir_open ( base_dir, 0, NULL );
if ( dir ) { if ( dir ) {
const char *dn = NULL; const char *dn = NULL;
@ -512,6 +513,7 @@ static void rofi_collect_modi_dir ( const char *base_dir )
continue; continue;
} }
char *fn = g_build_filename ( base_dir, dn, NULL ); char *fn = g_build_filename ( base_dir, dn, NULL );
g_debug ( "Trying to open: %s plugin", fn );
GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL ); GModule *mod = g_module_open ( fn, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL );
if ( mod ) { if ( mod ) {
Mode *m = NULL; Mode *m = NULL;
@ -562,6 +564,15 @@ static void rofi_collect_modi ( void )
find_arg_str ( "-plugin-path", &( config.plugin_path ) ); find_arg_str ( "-plugin-path", &( config.plugin_path ) );
g_debug ( "Parse plugin path: %s", config.plugin_path ); g_debug ( "Parse plugin path: %s", config.plugin_path );
rofi_collect_modi_dir ( config.plugin_path ); rofi_collect_modi_dir ( config.plugin_path );
/* ROFI_PLUGIN_PATH */
const char *path = g_getenv("ROFI_PLUGIN_PATH");
if ( path != NULL ) {
gchar ** paths = g_strsplit ( path, ":", -1 );
for ( unsigned int i = 0; paths[i]; i++ ) {
rofi_collect_modi_dir ( paths[i] );
}
g_strfreev ( paths );
}
} }
} }