diff --git a/configure.ac b/configure.ac index 96a2faca..74538e17 100644 --- a/configure.ac +++ b/configure.ac @@ -102,7 +102,7 @@ PKG_PROG_PKG_CONFIG dnl --------------------------------------------------------------------- dnl PKG_CONFIG based dependencies dnl --------------------------------------------------------------------- -PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0]) +PKG_CHECK_MODULES([glib], [glib-2.0 >= 2.40 gio-unix-2.0 gmodule-2.0]) GW_CHECK_XCB([xcb-aux xcb-xkb xkbcommon >= 0.5.0 xkbcommon-x11 xcb-ewmh xcb-icccm xcb-xrm xcb-randr xcb-xinerama]) PKG_CHECK_MODULES([pango], [pango pangocairo]) PKG_CHECK_MODULES([cairo], [cairo cairo-xcb]) diff --git a/include/rofi.h b/include/rofi.h index bfa66d28..87e571e4 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -5,7 +5,6 @@ #include #include #include -#include "timings.h" #include "keyb.h" #include "mode.h" #include "view.h" diff --git a/source/dialogs/run.c b/source/dialogs/run.c index 9324a995..6138e2d1 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -49,6 +49,8 @@ #include "dialogs/run.h" #include "mode-private.h" + +#include "timings.h" /** * Name of the history file where previously choosen commands are stored. */ diff --git a/source/rofi.c b/source/rofi.c index 4dfa58fe..3019853d 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,8 @@ #include "theme.h" +#include "timings.h" + // Pidfile. char *pidfile = NULL; const char *cache_dir = NULL; @@ -441,6 +444,26 @@ static int add_mode ( const char * token ) modi[num_modi] = &combi_mode; num_modi++; } + else if ( g_str_has_suffix ( token, G_MODULE_SUFFIX ) ) + { + TICK_N("Loading module"); + // Load module. + GModule *mod = g_module_open ( token, G_MODULE_BIND_LAZY|G_MODULE_BIND_LOCAL ); + if ( mod ) { + gpointer m = NULL; + if ( g_module_symbol ( mod, "mode", &m) ){ + modi[num_modi] = m; + num_modi++; + } else { + fprintf(stderr, "Symbol 'mode' not found in module: %s\n", token); + g_module_close ( mod ); + } + + } else { + fprintf ( stderr, "Failed to open module: %s\n", token); + } + TICK_N("Loading module done"); + } else { // If not build in, use custom modi. Mode *sw = script_switcher_parse_setup ( token ); diff --git a/source/view.c b/source/view.c index 385b857d..d00a8b47 100644 --- a/source/view.c +++ b/source/view.c @@ -45,6 +45,7 @@ #define SN_API_NOT_YET_FROZEN #include +#include "timings.h" #include "settings.h" #include "rofi.h"