From 5f21ab80a8f54e6133140582fe59a2992021c29a Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 2 Jul 2017 19:34:31 +0200 Subject: [PATCH 1/2] Do not do an expand path on Exec field of desktop file. (#618) Fixes: #617 --- source/dialogs/drun.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index 952cc069..c3fff896 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -183,7 +183,8 @@ static void exec_cmd_entry ( DRunModeEntry *e ) g_warning ( "Nothing to execute after processing: %s.", e->exec );; return; } - gchar *fp = rofi_expand_path ( g_strstrip ( str ) ); + + const gchar *fp = g_strstrip ( str ); gchar *exec_path = g_key_file_get_string ( e->key_file, "Desktop Entry", "Path", NULL ); if ( exec_path != NULL && strlen ( exec_path ) == 0 ) { // If it is empty, ignore this property. (#529) @@ -214,7 +215,6 @@ static void exec_cmd_entry ( DRunModeEntry *e ) g_free ( wmclass ); g_free ( exec_path ); g_free ( str ); - g_free ( fp ); } /** * This function absorbs/freeÅ› path, so this is no longer available afterwards. From 7e1c02b04c364ed1e3638432eebabf2d6e50acec Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 3 Jul 2017 09:23:03 +0200 Subject: [PATCH 2/2] [OldTheme] Re-add the padding/bw option. --- config/config.c | 4 ++++ include/settings.h | 4 ++++ source/dialogs/drun.c | 2 +- source/helper.c | 2 +- source/rofi.c | 5 ++++- source/theme.c | 5 +++++ source/xrmoptions.c | 6 ++++++ 7 files changed, 25 insertions(+), 3 deletions(-) diff --git a/config/config.c b/config/config.c index aa938cb9..82ba390d 100644 --- a/config/config.c +++ b/config/config.c @@ -35,6 +35,8 @@ Settings config = { /** List of enabled modi. */ /** -modi */ .modi = "window,run,ssh", + /** Border width around the window. */ + .menu_bw = 1, /** The width of the switcher. (0100 in % > 100 in pixels) */ .menu_width = 50, /** Maximum number of options to show. */ @@ -74,6 +76,8 @@ Settings config = { * */ .location = WL_CENTER, + /** Padding between elements */ + .padding = 5, /** Y offset */ .y_offset = 0, /** X offset */ diff --git a/include/settings.h b/include/settings.h index bdaae4a1..35020bf2 100644 --- a/include/settings.h +++ b/include/settings.h @@ -82,6 +82,8 @@ typedef struct { /** List of enabled modi */ char *modi; + /** Border width */ + unsigned int menu_bw; /** Width (0-100 in %, > 100 in pixels, < 0 in char width.) */ int menu_width; /** # lines */ @@ -119,6 +121,8 @@ typedef struct /** Windows location/gravity */ WindowLocation location; + /** Padding between elements */ + unsigned int padding; /** Y offset */ int y_offset; /** X offset */ diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index c3fff896..0cc0a363 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -185,7 +185,7 @@ static void exec_cmd_entry ( DRunModeEntry *e ) } const gchar *fp = g_strstrip ( str ); - gchar *exec_path = g_key_file_get_string ( e->key_file, "Desktop Entry", "Path", NULL ); + gchar *exec_path = g_key_file_get_string ( e->key_file, "Desktop Entry", "Path", NULL ); if ( exec_path != NULL && strlen ( exec_path ) == 0 ) { // If it is empty, ignore this property. (#529) g_free ( exec_path ); diff --git a/source/helper.c b/source/helper.c index ec4c2397..6ef7498d 100644 --- a/source/helper.c +++ b/source/helper.c @@ -1103,7 +1103,7 @@ cairo_surface_t* cairo_image_surface_create_from_svg ( const gchar* file, int he g_object_unref ( handle ); /** Rendering fails */ - if ( G_UNLIKELY ( failed ) ){ + if ( G_UNLIKELY ( failed ) ) { g_warning ( "Failed to render file: '%s'", file ); cairo_surface_destroy ( surface ); surface = NULL; diff --git a/source/rofi.c b/source/rofi.c index 8179e1fe..e19d7b86 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -796,15 +796,18 @@ int main ( int argc, char *argv[] ) return EXIT_FAILURE; } + TICK_N ( "Setup Locale" ); rofi_collect_modi (); - rofi_collect_modi_setup (); TICK_N ( "Collect MODI" ); + rofi_collect_modi_setup (); + TICK_N ( "Setup MODI" ); main_loop = g_main_loop_new ( NULL, FALSE ); TICK_N ( "Setup mainloop" ); bindings = nk_bindings_new (); + TICK_N ( "NK Bindings" ); if ( !display_setup ( main_loop, bindings ) ) { g_warning ( "Connection has error" ); diff --git a/source/theme.c b/source/theme.c index b929a9ea..6e6e4cb3 100644 --- a/source/theme.c +++ b/source/theme.c @@ -691,6 +691,11 @@ static char * rofi_theme_convert_color ( char *col ) } void rofi_theme_convert_old ( void ) { + { + char *str = g_strdup_printf ( "#window { border: %d; padding: %d;}", config.menu_bw, config.padding ); + rofi_theme_parse_string ( str ); + g_free ( str ); + } if ( config.color_window ) { char **retv = g_strsplit ( config.color_window, ",", -1 ); const char * const conf[] = { diff --git a/source/xrmoptions.c b/source/xrmoptions.c index 0b3d138f..87556a37 100644 --- a/source/xrmoptions.c +++ b/source/xrmoptions.c @@ -94,10 +94,16 @@ static XrmOption xrmOptions[] = { { xrm_String, "font", { .str = &config.menu_font }, NULL, "Font to use", CONFIG_DEFAULT }, + { xrm_Number, "borderwidth", { .num = &config.menu_bw }, NULL, + "", CONFIG_DEFAULT }, + { xrm_Number, "bw", { .num = &config.menu_bw }, NULL, + "Border width", CONFIG_DEFAULT }, { xrm_Number, "location", { .num = &config.location }, NULL, "Location on screen", CONFIG_DEFAULT }, + { xrm_Number, "padding", { .num = &config.padding }, NULL, + "Padding", CONFIG_DEFAULT }, { xrm_SNumber, "yoffset", { .snum = &config.y_offset }, NULL, "Y-offset relative to location", CONFIG_DEFAULT }, { xrm_SNumber, "xoffset", { .snum = &config.x_offset }, NULL,