From 4579a62b2dc61273963bbbf497041461bafe2e93 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Thu, 12 Mar 2015 17:57:00 +0100 Subject: [PATCH] Add ctrl-(shift)-tab for switching modi. --- Changelog | 2 ++ doc/rofi-manpage.markdown | 2 ++ doc/rofi.1 | 4 ++++ source/rofi.c | 11 +++++++++++ 4 files changed, 19 insertions(+) diff --git a/Changelog b/Changelog index 5962aff0..8b526fae 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,8 @@ 0.15.3: (unreleased) New feature: - Number mode for dmenu. allows user to get index back instead of content. + Improvements: + - Add Ctrl(Shift)Tab to switch modi's. Cleanup: - Do not lug argc,argv around everywhere. diff --git a/doc/rofi-manpage.markdown b/doc/rofi-manpage.markdown index bc82fb1b..fd112515 100644 --- a/doc/rofi-manpage.markdown +++ b/doc/rofi-manpage.markdown @@ -451,6 +451,8 @@ Rofi supports the following keybindings: * `Shift-Enter`: Return the selected entry and move to the next item while keeping Rofi open. (in dmenu) * `Shift-Right`: Switch to the next modi. The list can be customized with the `-switchers` argument. * `Shift-Left`: Switch to the previous modi. The list can be customized with the `-switchers` argument. +* `Ctrl-Tab`: Switch to the next modi. The list can be customized with the `-switchers` argument. +* `Ctrl-Shift-Tab`: Switch to the previous modi. The list can be customized with the `-switchers` argument. * `Ctrl-space`: Set selected item as input text. * `Shift-Del`: Delete entry from history. * `grave`: Toggle case sensitivity. diff --git a/doc/rofi.1 b/doc/rofi.1 index 2c6b3a50..fc3b494f 100644 --- a/doc/rofi.1 +++ b/doc/rofi.1 @@ -577,6 +577,10 @@ Rofi supports the following keybindings: .IP \(bu 2 \fB\fCShift\-Left\fR: Switch to the previous modi. The list can be customized with the \fB\fC\-switchers\fR argument. .IP \(bu 2 +\fB\fCCtrl\-Tab\fR: Switch to the next modi. The list can be customized with the \fB\fC\-switchers\fR argument. +.IP \(bu 2 +\fB\fCCtrl\-Shift\-Tab\fR: Switch to the previous modi. The list can be customized with the \fB\fC\-switchers\fR argument. +.IP \(bu 2 \fB\fCCtrl\-space\fR: Set selected item as input text. .IP \(bu 2 \fB\fCShift\-Del\fR: Delete entry from history. diff --git a/source/rofi.c b/source/rofi.c index 0c7b1e32..ed2ba0a5 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -1144,6 +1144,17 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom state.quit = TRUE; break; } + else if ( ( ( ev.xkey.state & ControlMask ) == ControlMask ) && key == XK_Tab ) { + if ( ( ev.xkey.state & ShiftMask ) == ShiftMask ) { + state.retv = MENU_PREVIOUS; + } + else{ + state.retv = MENU_NEXT; + } + *( state.selected_line ) = 0; + state.quit = TRUE; + break; + } // Menu navigation. else if ( ( ( ev.xkey.state & ShiftMask ) == ShiftMask ) && key == XK_Right ) {