This commit is contained in:
phillbush 2020-12-31 05:47:06 -03:00
parent 8239f1f155
commit 28f784a7a4
4 changed files with 27 additions and 4 deletions

View File

@ -34,6 +34,9 @@ static struct Config config = {
/* area around the icon, the triangle and the separator */
.horzpadding = 8,
/* if nonzero, enable type-to-select feature, can be togglet with -t */
.typetoselect = 0
};
/*

20
xmenu.1
View File

@ -3,7 +3,7 @@
xmenu \- menu utility for X
.SH SYNOPSIS
.B xmenu
.RB [ \-irw ]
.RB [ \-irtw ]
.RB [ -p
.IR position ]
.RI [ title ]
@ -58,6 +58,10 @@ must spawn at the position 100x500 of the monitor 0.
If this option is set, the right mouse button is disabled;
so pressing it will not trigger any menu item.
.TP
.B -t
If this option is set, the type-to-select feature is enabled,
so typing a string will select the first item matching it.
.TP
.B -w
Asks the window manager to draw a border around the menus.
This option may be buggy in some window managers,
@ -108,12 +112,22 @@ Select the first item in the menu.
.BR End
Select the last item in the menu.
.TP
.BR Down ", " Tab
.BR Down
Cycle through the items in the regular direction.
.TP
.BR Up ", " Shift-Tab
.BR Tab
Cycle through the items in the regular direction.
If the type-to-select feature is enabled, and there is a typed string in memory,
cycle through matching items instead.
.TP
.BR Up
Cycle through the items in the reverse direction.
.TP
.BR Shift-Tab
Cycle through the items in the reverse direction.
If the type-to-select feature is enabled, and there is a typed string in memory,
cycle through matching items instead.
.TP
.BR Right ", " Enter
Select the highlighted item.
.TP

View File

@ -141,7 +141,7 @@ getoptions(int argc, char *argv[])
{
int ch;
while ((ch = getopt(argc, argv, "ip:rw")) != -1) {
while ((ch = getopt(argc, argv, "ip:rtw")) != -1) {
switch (ch) {
case 'i':
iflag = 1;
@ -153,6 +153,9 @@ getoptions(int argc, char *argv[])
case 'r':
rflag = 1;
break;
case 't':
config.typetoselect = !config.typetoselect;
break;
case 'w':
wflag = 1;
break;
@ -1373,6 +1376,8 @@ enteritem:
break;
default:
append:
if (!config.typetoselect)
break;
for (i = 0; i < 2; i++) {
append(text, buf, sizeof text, len);
if ((item = matchitem(currmenu, text, 0)))

View File

@ -50,6 +50,7 @@ struct Config {
int iconpadding;
int horzpadding;
int alignment;
int typetoselect;
/* the values below are set by options */
int monitor;