diff options
Diffstat (limited to 'source/dialogs/window.c')
-rw-r--r-- | source/dialogs/window.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/dialogs/window.c b/source/dialogs/window.c index 1060068e..e0eff96a 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -697,6 +697,23 @@ static ModeMode window_mode_result ( Mode *sw, int mretv, G_GNUC_UNUSED char **i xcb_ewmh_request_close_window ( &( xcb->ewmh ), xcb->screen_nbr, rmpd->ids->array[selected_line], XCB_CURRENT_TIME, XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER ); xcb_flush ( xcb->connection ); } + else if ( ( mretv & MENU_CUSTOM_INPUT ) && *input != NULL && *input[0] != '\0' ) { + GError *error = NULL; + gboolean run_in_term = ( ( mretv & MENU_CUSTOM_ACTION ) == MENU_CUSTOM_ACTION ); + gsize lf_cmd_size = 0; + gchar *lf_cmd = g_locale_from_utf8 ( *input, -1, NULL, &lf_cmd_size, &error ); + if ( error != NULL ) { + g_warning ( "Failed to convert command to locale encoding: %s", error->message ); + g_error_free ( error ); + return RELOAD_DIALOG; + } + + RofiHelperExecuteContext context = { .name = NULL }; + if ( ! helper_execute_command ( NULL, lf_cmd, run_in_term, run_in_term ? &context : NULL ) ) { + retv = RELOAD_DIALOG; + } + g_free ( lf_cmd ); + } return retv; } |