diff --git a/include/keyb.h b/include/keyb.h index b700bea6..c2213d85 100644 --- a/include/keyb.h +++ b/include/keyb.h @@ -32,6 +32,11 @@ typedef enum _KeyBindingAction CUSTOM_7, CUSTOM_8, CUSTOM_9, + ROW_LEFT, + ROW_RIGHT, + ROW_UP, + ROW_DOWN, + ROW_TAB, NUM_ABE } KeyBindingAction; diff --git a/source/keyb.c b/source/keyb.c index ff1b1e6b..b8474f65 100644 --- a/source/keyb.c +++ b/source/keyb.c @@ -182,6 +182,31 @@ DefaultBinding bindings[NUM_ABE] = .name = "kb-custom-9", .keybinding = "Alt+9" }, + { + .id = ROW_LEFT, + .name = "kb-row-left", + .keybinding = "Control+Page_Up" + }, + { + .id = ROW_RIGHT, + .name = "kb-row-right", + .keybinding = "Control+Page_Down" + }, + { + .id = ROW_UP, + .name = "kb-row-up", + .keybinding = "Up,Control+p,Shift+Tab" + }, + { + .id = ROW_DOWN, + .name = "kb-row-down", + .keybinding = "Down,Control+n" + }, + { + .id = ROW_TAB, + .name = "kb-row-tab", + .keybinding = "Tab" + } }; diff --git a/source/rofi.c b/source/rofi.c index bbe94e33..92e067b4 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -571,11 +571,10 @@ static void menu_keyboard_navigation ( MenuState *state, KeySym key, unsigned in state->quit = TRUE; } // Up, Ctrl-p or Shift-Tab - else if ( key == XK_Up || ( key == XK_Tab && modstate & ShiftMask ) || - ( key == XK_p && modstate & ControlMask ) ) { + else if ( abe_test_action ( ROW_UP, modstate, key ) ) { menu_nav_up ( state ); } - else if ( key == XK_Tab ) { + else if ( abe_test_action ( ROW_TAB, modstate, key ) ) { if ( state->filtered_lines == 1 ) { state->retv = MENU_OK; *( state->selected_line ) = state->line_map[state->selected]; @@ -590,20 +589,17 @@ static void menu_keyboard_navigation ( MenuState *state, KeySym key, unsigned in state->quit = TRUE; } else{ - state->selected = state->selected < state->filtered_lines - 1 ? MIN ( - state->filtered_lines - 1, state->selected + 1 ) : 0; - state->update = TRUE; + menu_nav_down ( state ); } } // Down, Ctrl-n - else if ( key == XK_Down || - ( key == XK_n && ( modstate & ControlMask ) ) ) { + else if ( abe_test_action ( ROW_DOWN, modstate, key ) ) { menu_nav_down ( state ); } - else if ( key == XK_Page_Up && ( modstate & ControlMask ) ) { + else if ( abe_test_action ( ROW_LEFT, modstate, key ) ) { menu_nav_left ( state ); } - else if ( key == XK_Page_Down && ( modstate & ControlMask ) ) { + else if ( abe_test_action ( ROW_RIGHT, modstate, key ) ) { menu_nav_right ( state ); } else if ( key == XK_Page_Up ) {