From 4fd4fb89af7e1a73427edb46035f640cf267fdc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Gr=C3=A4b?= Date: Tue, 15 Jun 2021 14:43:30 +0200 Subject: [PATCH] New keybinding Ctrl-Shift-Enter (#874) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function combines accept-custom with the functionality to start the command in terminal Co-authored-by: Markus Gräb Co-authored-by: Dave Davenport --- doc/rofi.1.markdown | 1 + include/keyb.h | 1 + source/keyb.c | 1 + source/view.c | 7 +++++++ 4 files changed, 10 insertions(+) diff --git a/doc/rofi.1.markdown b/doc/rofi.1.markdown index 716167eb..8ee28f52 100644 --- a/doc/rofi.1.markdown +++ b/doc/rofi.1.markdown @@ -789,6 +789,7 @@ Please see **rofi-theme(5)** manpage for more information on theming. * `Ctrl-Page Down`: Go to next column * `Ctrl-Enter`: Use entered text as a command (in `ssh/run modi`) * `Shift-Enter`: Launch the application in a terminal (in run mode) + * `Ctrl-Shift-Enter`: As Ctrl-Enter and run the command in terminal (in run mode) * `Shift-Enter`: Return the selected entry and move to the next item while keeping **rofi** open. (in dmenu) * `Shift-Right`: Switch to the next mode. The list can be customized with the `-switchers` argument. * `Shift-Left`: Switch to the previous mode. The list can be customized with the `-switchers` argument. diff --git a/include/keyb.h b/include/keyb.h index 04e7067a..67c49432 100644 --- a/include/keyb.h +++ b/include/keyb.h @@ -91,6 +91,7 @@ typedef enum ACCEPT_ENTRY, ACCEPT_ALT, ACCEPT_CUSTOM, + ACCEPT_CUSTOM_ALT, MODE_NEXT, MODE_COMPLETE, MODE_PREVIOUS, diff --git a/source/keyb.c b/source/keyb.c index ff71f193..edda3b75 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -62,6 +62,7 @@ ActionBindingEntry rofi_bindings[] = { .id = REMOVE_TO_SOL, .name = "kb-remove-to-sol", .binding = "Control+u", .comment = "Delete till the start of line" }, { .id = ACCEPT_ENTRY, .name = "kb-accept-entry", .binding = "Control+j,Control+m,Return,KP_Enter", .comment = "Accept entry" }, { .id = ACCEPT_CUSTOM, .name = "kb-accept-custom", .binding = "Control+Return", .comment = "Use entered text as command (in ssh/run modi)" }, + { .id = ACCEPT_CUSTOM_ALT, .name = "kb-accept-custom-alt", .binding = "Control+Shift+Return", .comment = "Use entered text as command (in ssh/run modi)" }, { .id = ACCEPT_ALT, .name = "kb-accept-alt", .binding = "Shift+Return", .comment = "Use alternate accept command." }, { .id = DELETE_ENTRY, .name = "kb-delete-entry", .binding = "Shift+Delete", .comment = "Delete entry from history" }, { .id = MODE_NEXT, .name = "kb-mode-next", .binding = "Shift+Right,Control+Tab", .comment = "Switch to the next mode." }, diff --git a/source/view.c b/source/view.c index f9aa21f9..e419b000 100644 --- a/source/view.c +++ b/source/view.c @@ -1436,6 +1436,13 @@ static void rofi_view_trigger_global_action ( KeyBindingAction action ) state->quit = TRUE; break; } + case ACCEPT_CUSTOM_ALT: + { + state->selected_line = UINT32_MAX; + state->retv = MENU_CUSTOM_INPUT | MENU_CUSTOM_ACTION; + state->quit = TRUE; + break; + } case ACCEPT_ENTRY: { // If a valid item is selected, return that..