Add ctrl-/ as reverse tab.

This commit is contained in:
QC 2014-11-11 21:50:16 +01:00
parent cd8abd1153
commit f710912042
9 changed files with 37 additions and 4 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
LIGHT_HOST=192.150.0.106 LIGHT_HOST=192.150.0.113
LIGHT_PORT=8888 LIGHT_PORT=8888
prompt() { prompt() {

3
doc/generate-manpage.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
md2man-roff rofi-manpage.markdown > rofi.1

View File

@ -371,6 +371,7 @@ Rofi supports the following keybindings:
* `Ctrl-Page Up`: Go to the previous column * `Ctrl-Page Up`: Go to the previous column
* `Ctrl-Page Down`: Go to the next column * `Ctrl-Page Down`: Go to the next column
* `?`: Switch to the next modi. The list can be customized with the `-switchers` argument. * `?`: Switch to the next modi. The list can be customized with the `-switchers` argument.
* `ctrl-/`: Switch to the previous modi. The list can be customized with the `-switchers` argument.
* `Ctrl-space`: Set selected item as input text. * `Ctrl-space`: Set selected item as input text.
## FAQ ## FAQ

View File

@ -480,6 +480,8 @@ Rofi supports the following keybindings:
.IP \(bu 2 .IP \(bu 2
\fB\fC?\fR: Switch to the next modi. The list can be customized with the \fB\fC\-switchers\fR argument. \fB\fC?\fR: Switch to the next modi. The list can be customized with the \fB\fC\-switchers\fR argument.
.IP \(bu 2 .IP \(bu 2
\fB\fCctrl\-/\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. \fB\fCCtrl\-space\fR: Set selected item as input text.
.RE .RE
.SH FAQ .SH FAQ

View File

@ -15,11 +15,13 @@ extern const char *cache_dir;
typedef enum typedef enum
{ {
/** Exit. */ /** Exit. */
MODE_EXIT = 1000, MODE_EXIT = 1000,
/** Skip to the next cycle-able dialog. */ /** Skip to the next cycle-able dialog. */
NEXT_DIALOG = 1001, NEXT_DIALOG = 1001,
/** Reload current DIALOG */ /** Reload current DIALOG */
RELOAD_DIALOG = 1002 RELOAD_DIALOG = 1002,
/** Previous dialog */
PREVIOUS_DIALOG = 1003
} SwitcherMode; } SwitcherMode;
// switcher callback // switcher callback
@ -41,6 +43,7 @@ typedef enum
/** User wanted to delete entry from history. */ /** User wanted to delete entry from history. */
MENU_ENTRY_DELETE = -4, MENU_ENTRY_DELETE = -4,
MENU_QUICK_SWITCH = -5, MENU_QUICK_SWITCH = -5,
MENU_PREVIOUS = -6
} MenuReturn; } MenuReturn;

View File

@ -1730,6 +1730,12 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
XA_PRIMARY : netatoms[CLIPBOARD], XA_PRIMARY : netatoms[CLIPBOARD],
netatoms[UTF8_STRING], netatoms[UTF8_STRING], main_window, CurrentTime ); netatoms[UTF8_STRING], netatoms[UTF8_STRING], main_window, CurrentTime );
} }
else if ( ( ( ev.xkey.state & ControlMask ) == ControlMask ) && key == XK_slash ) {
state.retv = MENU_PREVIOUS;
*( state.selected_line ) = 0;
state.quit = TRUE;
break;
}
// Menu navigation. // Menu navigation.
else if ( ( ( ev.xkey.state & ShiftMask ) == ShiftMask ) && else if ( ( ( ev.xkey.state & ShiftMask ) == ShiftMask ) &&
key == XK_slash ) { key == XK_slash ) {
@ -2003,6 +2009,9 @@ SwitcherMode run_switcher_window ( char **input, G_GNUC_UNUSED void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_PREVIOUS ) {
retv = PREVIOUS_DIALOG;
}
else if ( mretv == MENU_QUICK_SWITCH ) { else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line; retv = selected_line;
} }
@ -2086,6 +2095,12 @@ static void run_switcher ( int do_fork, SwitcherMode mode )
if ( retv == NEXT_DIALOG ) { if ( retv == NEXT_DIALOG ) {
mode = ( mode + 1 ) % num_switchers; mode = ( mode + 1 ) % num_switchers;
} }
else if ( retv == PREVIOUS_DIALOG ) {
mode = ( mode - 1 ) % num_switchers;
if(mode < 0) {
mode = num_switchers-1;
}
}
else if ( retv == RELOAD_DIALOG ) { else if ( retv == RELOAD_DIALOG ) {
// do nothing. // do nothing.
} }

View File

@ -261,6 +261,9 @@ SwitcherMode run_switcher_dialog ( char **input, G_GNUC_UNUSED void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_PREVIOUS ) {
retv = PREVIOUS_DIALOG;
}
else if ( mretv == MENU_QUICK_SWITCH ) { else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line; retv = selected_line;
} }

View File

@ -127,6 +127,9 @@ SwitcherMode script_switcher_dialog ( char **input, void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_PREVIOUS ) {
retv = PREVIOUS_DIALOG;
}
else if ( mretv == MENU_QUICK_SWITCH ) { else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line; retv = selected_line;
} }

View File

@ -220,6 +220,9 @@ SwitcherMode ssh_switcher_dialog ( char **input, G_GNUC_UNUSED void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_PREVIOUS ) {
retv = PREVIOUS_DIALOG;
}
else if ( mretv == MENU_QUICK_SWITCH ) { else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line; retv = selected_line;
} }