diff options
author | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-06-02 14:56:59 +0200 |
---|---|---|
committer | Quentin Glidic <sardemff7+git@sardemff7.net> | 2017-06-02 14:56:59 +0200 |
commit | 0644f99b64ff150699bedd1a8263be66059530d7 (patch) | |
tree | 376434c6e4003a2bac5835f1604ff77231e4f571 | |
parent | 22fbaa0b50bc65f531a177a324d63e89702051db (diff) |
drun: Add startup notification support
Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
-rw-r--r-- | source/dialogs/drun.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index eea2a9d6..5360356c 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -185,15 +185,27 @@ static void exec_cmd_entry ( DRunModeEntry *e ) exec_path = NULL; } + RofiHelperExecuteContext context = { + .name = e->name, + .icon = e->icon_name, + .app_id = e->app_id, + }; + gboolean sn = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "StartupNotify", NULL ); + gchar *wmclass = NULL; + if ( sn && g_key_file_has_key ( e->key_file, "Desktop Entry", "StartupWMClass", NULL ) ) { + context.wmclass = wmclass = g_key_file_get_string ( e->key_file, "Desktop Entry", "StartupWMClass", NULL ); + } + // Returns false if not found, if key not found, we don't want run in terminal. gboolean terminal = g_key_file_get_boolean ( e->key_file, "Desktop Entry", "Terminal", NULL ); - if ( helper_execute_command ( exec_path, fp, terminal, NULL ) ) { + if ( helper_execute_command ( exec_path, fp, terminal, sn ? &context : NULL ) ) { char *path = g_build_filename ( cache_dir, DRUN_CACHE_FILE, NULL ); char *key = g_strdup_printf ( "%s:::%s", e->root, e->path ); history_set ( path, key ); g_free ( key ); g_free ( path ); } + g_free ( wmclass ); g_free ( exec_path ); g_free ( str ); g_free ( fp ); @@ -516,7 +528,9 @@ static ModeMode drun_mode_result ( Mode *sw, int mretv, char **input, unsigned i exec_cmd_entry ( &( rmpd->entry_list[selected_line] ) ); } else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) { - helper_execute_command ( NULL, *input, run_in_term, NULL ); + RofiHelperExecuteContext context = { .name = NULL }; + // FIXME: We assume startup notification in terminals, not in others + helper_execute_command ( NULL, *input, run_in_term, run_in_term ? &context : NULL ); } else if ( ( mretv & MENU_ENTRY_DELETE ) && selected_line < rmpd->cmd_list_length ) { if ( selected_line < rmpd->history_length ) { |