1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-25 13:55:34 -05:00

Fix #67 Allow alt-<num> to switch between modis

This commit is contained in:
QC 2014-07-21 23:19:45 +02:00
parent 60e23568d8
commit bd4aa3d2fa
5 changed files with 23 additions and 1 deletions

View file

@ -52,7 +52,8 @@ typedef enum
/** Custom (non-matched) input was entered. */ /** Custom (non-matched) input was entered. */
MENU_CUSTOM_INPUT = -3, MENU_CUSTOM_INPUT = -3,
/** 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,
} MenuReturn; } MenuReturn;

View file

@ -1373,6 +1373,12 @@ MenuReturn menu ( char **lines, unsigned int num_lines, char **input, char *prom
break; break;
} }
} }
else if ( ( ( ev.xkey.state & Mod1Mask ) == Mod1Mask ) &&
key >= XK_1 && key <= XK_9 ) {
*selected_line = ( key - XK_1 );
retv = MENU_QUICK_SWITCH;
break;
}
int rc = textbox_keypress ( text, &ev ); int rc = textbox_keypress ( text, &ev );
@ -1653,6 +1659,9 @@ SwitcherMode run_switcher_window ( char **input, void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line;
}
else if ( mretv == MENU_OK && list[selected_line] ) { else if ( mretv == MENU_OK && list[selected_line] ) {
#ifdef HAVE_I3_IPC_H #ifdef HAVE_I3_IPC_H
@ -1726,6 +1735,9 @@ static void run_switcher ( int do_fork, SwitcherMode mode )
else if ( retv == RELOAD_DIALOG ) { else if ( retv == RELOAD_DIALOG ) {
// do nothing. // do nothing.
} }
else if ( retv < DMENU_DIALOG ) {
mode = ( retv ) % num_switchers;
}
else { else {
mode = retv; mode = retv;
} }

View file

@ -218,6 +218,9 @@ SwitcherMode run_switcher_dialog ( char **input, void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line;
}
else if ( mretv == MENU_OK && cmd_list[selected_line] != NULL ) { else if ( mretv == MENU_OK && cmd_list[selected_line] != NULL ) {
exec_cmd ( cmd_list[selected_line], shift ); exec_cmd ( cmd_list[selected_line], shift );
} }

View file

@ -134,6 +134,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_QUICK_SWITCH ) {
retv = selected_line;
}
else if ( mretv == MENU_OK && list[selected_line] != NULL ) { else if ( mretv == MENU_OK && list[selected_line] != NULL ) {
new_list = execute_executor ( options, list[selected_line], &new_length ); new_list = execute_executor ( options, list[selected_line], &new_length );
} }

View file

@ -235,6 +235,9 @@ SwitcherMode ssh_switcher_dialog ( char **input, void *data )
if ( mretv == MENU_NEXT ) { if ( mretv == MENU_NEXT ) {
retv = NEXT_DIALOG; retv = NEXT_DIALOG;
} }
else if ( mretv == MENU_QUICK_SWITCH ) {
retv = selected_line;
}
else if ( mretv == MENU_OK && cmd_list[selected_line] != NULL ) { else if ( mretv == MENU_OK && cmd_list[selected_line] != NULL ) {
exec_ssh ( cmd_list[selected_line] ); exec_ssh ( cmd_list[selected_line] );
} }