23 draws a menu, based on stdin
24 (here refer to a later section)
25 and prints the user's choice to stdout.
26 The options are as follows:
29 The font to be used for displaying text.
30 Corresponds to the resource font.
32 .Dq DejaVu Sans Mono-10 .
34 Specifies the normal background colour.
35 Corresponds to the resource background.
39 Specifies the normal foreground colour.
40 Corresponds to the resource foreground.
44 Specifies the background colour for selected item.
45 Corresponds to the resource selectedBackground.
49 Specifies the foreground colour for selected item.
50 Corresponds to the resource selectedForeground.
54 Specifies the border colour.
55 Corresponds to the resource borderColour.
59 Specifies the border width.
60 Corresponds to the resource borderWidth.
63 Specifies the horizontal padding.
64 Corresponds to the resource horizontalPadding.
67 Specifies the vertical padding.
68 Corresponds to the resource verticalPadding.
71 The horizontal position to spawn the window at.
72 Default corresponds to the horizontal position of the pointer.
74 The vertical position to spawn the window at.
75 Default corresponds to the vertical position of the pointer.
78 The options, which correspond to a resource take precedence over that
82 reads contents of the menu on stdin.
83 The input consists of one, or several newline-separated entries (items).
84 Each entry has the following format:
86 .Dl ITEM := [KEYS] TAB LABEL
88 The optional KEYS field consists of one or more space-separated key
89 strings, such that can be used with
90 .Xr XStringToKeysym 3 .
91 Pressing any of these keys immediately select this item.
92 Keys are configured case-insensitively.
93 .Ss Key and button bindings
95 can be intuitively controlled with mouse by bringing the pointer over
96 the desired item and clicking.
97 Additional key and button bindings are as follows:
99 .It Scroll down , j , down , control-n
100 Move selection one item down.
101 .It Scroll up , k , up , control-p
102 Move selection one item up.
103 .It Escape , control-c
104 Quit, outputting nothing.
105 .It Return , control-m , control-j
106 Quit, outputting the selected item.
107 .It Button 1, button 2, button 3
109 If the pointer is inside the window, output the selected item,
110 otherwise output nothing.
114 understands the following resources:
117 Specifies the font to be used for displaying text.
118 .It Ic xitems.foreground , xitems,background
119 Specifies the normal foreground and background colours.
120 .It Ic xitems.selectedForeground , xitems,selectedBackground
121 Specifies the foreground and background colours for selected items.
122 .It Ic xitems.borderColour
123 Specifies the border colour.
124 .It Ic xitems.borderWidth
125 Specifies the border width.
126 .It Ic xitems.verticalPadding , xitems.horizontalPadding
127 Specifies the vertical and horizontal padding.
130 The following script displays a menu with items
135 Each can be selected by pressing the key, corresponding to the capital
136 letter, or the Cyrillic key, sharing the same position.
139 creates a similar menu, and selecting anything else runs the
140 corresponding command.
141 .Bd -literal -offset indent
146 m Cyrillic_softsign Monitor
155 c Cyrillic_es xConsole
163 if [ "$s" = Monitor ]; then
167 fi | tr '[A-Z]' '[a-z]' | sh
170 .An Alexander Arkhipov Aq Mt aa@manpager.net .