add -t
This commit is contained in:
parent
8239f1f155
commit
28f784a7a4
3
config.h
3
config.h
|
@ -34,6 +34,9 @@ static struct Config config = {
|
||||||
|
|
||||||
/* area around the icon, the triangle and the separator */
|
/* area around the icon, the triangle and the separator */
|
||||||
.horzpadding = 8,
|
.horzpadding = 8,
|
||||||
|
|
||||||
|
/* if nonzero, enable type-to-select feature, can be togglet with -t */
|
||||||
|
.typetoselect = 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
20
xmenu.1
20
xmenu.1
|
@ -3,7 +3,7 @@
|
||||||
xmenu \- menu utility for X
|
xmenu \- menu utility for X
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.B xmenu
|
.B xmenu
|
||||||
.RB [ \-irw ]
|
.RB [ \-irtw ]
|
||||||
.RB [ -p
|
.RB [ -p
|
||||||
.IR position ]
|
.IR position ]
|
||||||
.RI [ title ]
|
.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;
|
If this option is set, the right mouse button is disabled;
|
||||||
so pressing it will not trigger any menu item.
|
so pressing it will not trigger any menu item.
|
||||||
.TP
|
.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
|
.B -w
|
||||||
Asks the window manager to draw a border around the menus.
|
Asks the window manager to draw a border around the menus.
|
||||||
This option may be buggy in some window managers,
|
This option may be buggy in some window managers,
|
||||||
|
@ -108,12 +112,22 @@ Select the first item in the menu.
|
||||||
.BR End
|
.BR End
|
||||||
Select the last item in the menu.
|
Select the last item in the menu.
|
||||||
.TP
|
.TP
|
||||||
.BR Down ", " Tab
|
.BR Down
|
||||||
Cycle through the items in the regular direction.
|
Cycle through the items in the regular direction.
|
||||||
.TP
|
.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.
|
Cycle through the items in the reverse direction.
|
||||||
.TP
|
.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
|
.BR Right ", " Enter
|
||||||
Select the highlighted item.
|
Select the highlighted item.
|
||||||
.TP
|
.TP
|
||||||
|
|
7
xmenu.c
7
xmenu.c
|
@ -141,7 +141,7 @@ getoptions(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "ip:rw")) != -1) {
|
while ((ch = getopt(argc, argv, "ip:rtw")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'i':
|
case 'i':
|
||||||
iflag = 1;
|
iflag = 1;
|
||||||
|
@ -153,6 +153,9 @@ getoptions(int argc, char *argv[])
|
||||||
case 'r':
|
case 'r':
|
||||||
rflag = 1;
|
rflag = 1;
|
||||||
break;
|
break;
|
||||||
|
case 't':
|
||||||
|
config.typetoselect = !config.typetoselect;
|
||||||
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
wflag = 1;
|
wflag = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -1373,6 +1376,8 @@ enteritem:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
append:
|
append:
|
||||||
|
if (!config.typetoselect)
|
||||||
|
break;
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
append(text, buf, sizeof text, len);
|
append(text, buf, sizeof text, len);
|
||||||
if ((item = matchitem(currmenu, text, 0)))
|
if ((item = matchitem(currmenu, text, 0)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user