Added vim like keybindings

This commit is contained in:
Marco Raber 2021-12-14 16:17:26 +01:00
parent 705316fabe
commit 34302812fe

12
xmenu.c
View File

@ -1345,8 +1345,8 @@ enteritem:
break; break;
} }
/* esc closes xmenu when current menu is the root menu */ /* esc (or h) closes xmenu when current menu is the root menu */
if (ksym == XK_Escape && currmenu->parent == NULL) if ( (ksym == XK_h || ksym == XK_Escape) && currmenu->parent == NULL)
return; return;
/* Shift-Tab = ISO_Left_Tab */ /* Shift-Tab = ISO_Left_Tab */
@ -1372,7 +1372,7 @@ enteritem:
break; break;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case XK_Up: case XK_Up: case XK_k:
select = itemcycle(currmenu, ITEMPREV); select = itemcycle(currmenu, ITEMPREV);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW; action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break; break;
@ -1383,7 +1383,7 @@ enteritem:
break; break;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
case XK_Down: case XK_Down: case XK_j:
select = itemcycle(currmenu, ITEMNEXT); select = itemcycle(currmenu, ITEMNEXT);
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW; action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break; break;
@ -1397,13 +1397,13 @@ enteritem:
select = item; select = item;
action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW; action = ACTION_CLEAR | ACTION_SELECT | ACTION_DRAW;
break; break;
case XK_Return: case XK_Right: case XK_Return: case XK_Right: case XK_l:
if (currmenu->selected) { if (currmenu->selected) {
item = currmenu->selected; item = currmenu->selected;
goto enteritem; goto enteritem;
} }
break; break;
case XK_Escape: case XK_Left: case XK_Escape: case XK_Left: case XK_h:
if (currmenu->parent) { if (currmenu->parent) {
select = currmenu->parent->selected; select = currmenu->parent->selected;
currmenu = currmenu->parent; currmenu = currmenu->parent;