Support for 1-9 numbers to select specific item
This commit is contained in:
parent
45115feb15
commit
2b0484b11c
2
xmenu.1
2
xmenu.1
|
@ -96,7 +96,7 @@ but can also be controlled by the keyboard.
|
|||
Items can be selected using the arrow keys,
|
||||
Tab (with and without Shift),
|
||||
Home, End,
|
||||
Enter and Esc.
|
||||
Enter and Esc, and 1-9 keys.
|
||||
.TP
|
||||
.BR Home
|
||||
Select the first item in the menu.
|
||||
|
|
7
xmenu.c
7
xmenu.c
|
@ -1280,6 +1280,13 @@ selectitem:
|
|||
item = itemcycle(currmenu, ITEMPREV);
|
||||
} else if (ksym == XK_Tab || ksym == XK_Down || ksym == KSYMDOWN) {
|
||||
item = itemcycle(currmenu, ITEMNEXT);
|
||||
} else if (ksym >= XK_1 && ksym <= XK_9){
|
||||
item = itemcycle(currmenu, ITEMFIRST);
|
||||
currmenu->selected = item;
|
||||
for(int i = ksym-XK_1; i > 0; i-=1){
|
||||
item = itemcycle(currmenu, ITEMNEXT);
|
||||
currmenu->selected = item;
|
||||
}
|
||||
} else if ((ksym == XK_Return || ksym == XK_Right || ksym == KSYMRIGHT) &&
|
||||
currmenu->selected != NULL) {
|
||||
item = currmenu->selected;
|
||||
|
|
Loading…
Reference in New Issue
Block a user