mirror of https://github.com/davatorium/rofi.git
Issue #66, allow keybindings for navigation to be changed.
up,down,left,right
This commit is contained in:
parent
638b5e022f
commit
25633ca4dc
|
@ -32,6 +32,11 @@ typedef enum _KeyBindingAction
|
||||||
CUSTOM_7,
|
CUSTOM_7,
|
||||||
CUSTOM_8,
|
CUSTOM_8,
|
||||||
CUSTOM_9,
|
CUSTOM_9,
|
||||||
|
ROW_LEFT,
|
||||||
|
ROW_RIGHT,
|
||||||
|
ROW_UP,
|
||||||
|
ROW_DOWN,
|
||||||
|
ROW_TAB,
|
||||||
NUM_ABE
|
NUM_ABE
|
||||||
} KeyBindingAction;
|
} KeyBindingAction;
|
||||||
|
|
||||||
|
|
|
@ -182,6 +182,31 @@ DefaultBinding bindings[NUM_ABE] =
|
||||||
.name = "kb-custom-9",
|
.name = "kb-custom-9",
|
||||||
.keybinding = "Alt+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"
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -571,11 +571,10 @@ static void menu_keyboard_navigation ( MenuState *state, KeySym key, unsigned in
|
||||||
state->quit = TRUE;
|
state->quit = TRUE;
|
||||||
}
|
}
|
||||||
// Up, Ctrl-p or Shift-Tab
|
// Up, Ctrl-p or Shift-Tab
|
||||||
else if ( key == XK_Up || ( key == XK_Tab && modstate & ShiftMask ) ||
|
else if ( abe_test_action ( ROW_UP, modstate, key ) ) {
|
||||||
( key == XK_p && modstate & ControlMask ) ) {
|
|
||||||
menu_nav_up ( state );
|
menu_nav_up ( state );
|
||||||
}
|
}
|
||||||
else if ( key == XK_Tab ) {
|
else if ( abe_test_action ( ROW_TAB, modstate, key ) ) {
|
||||||
if ( state->filtered_lines == 1 ) {
|
if ( state->filtered_lines == 1 ) {
|
||||||
state->retv = MENU_OK;
|
state->retv = MENU_OK;
|
||||||
*( state->selected_line ) = state->line_map[state->selected];
|
*( 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;
|
state->quit = TRUE;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
state->selected = state->selected < state->filtered_lines - 1 ? MIN (
|
menu_nav_down ( state );
|
||||||
state->filtered_lines - 1, state->selected + 1 ) : 0;
|
|
||||||
state->update = TRUE;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Down, Ctrl-n
|
// Down, Ctrl-n
|
||||||
else if ( key == XK_Down ||
|
else if ( abe_test_action ( ROW_DOWN, modstate, key ) ) {
|
||||||
( key == XK_n && ( modstate & ControlMask ) ) ) {
|
|
||||||
menu_nav_down ( state );
|
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 );
|
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 );
|
menu_nav_right ( state );
|
||||||
}
|
}
|
||||||
else if ( key == XK_Page_Up ) {
|
else if ( key == XK_Page_Up ) {
|
||||||
|
|
Loading…
Reference in New Issue