Blame


1 912fd0cc 2023-05-29 aa .Dd May 29, 2023
2 912fd0cc 2023-05-29 aa .Dt XITEMS 1
3 912fd0cc 2023-05-29 aa .Os
4 912fd0cc 2023-05-29 aa .Sh NAME
5 912fd0cc 2023-05-29 aa .Nm xitems
6 912fd0cc 2023-05-29 aa .Nd menu for X
7 912fd0cc 2023-05-29 aa .Sh SYNOPSIS
8 912fd0cc 2023-05-29 aa .Nm
9 912fd0cc 2023-05-29 aa .Op Fl font Ar font
10 912fd0cc 2023-05-29 aa .Op Fl bg Ar colour
11 912fd0cc 2023-05-29 aa .Op Fl fg Ar colour
12 912fd0cc 2023-05-29 aa .Op Fl sbg Ar colour
13 912fd0cc 2023-05-29 aa .Op Fl sfg Ar colour
14 912fd0cc 2023-05-29 aa .Op Fl bc Ar colour
15 912fd0cc 2023-05-29 aa .Op Fl bw Ar width
16 912fd0cc 2023-05-29 aa .Op Fl hp Ar pad
17 912fd0cc 2023-05-29 aa .Op Fl vp Ar pad
18 912fd0cc 2023-05-29 aa .Op Fl x Ar x
19 912fd0cc 2023-05-29 aa .Op Fl y Ar x
20 912fd0cc 2023-05-29 aa .Sh DESCRIPTION
21 912fd0cc 2023-05-29 aa The X utility
22 912fd0cc 2023-05-29 aa .Nm
23 912fd0cc 2023-05-29 aa draws a menu, based on stdin
24 912fd0cc 2023-05-29 aa (here refer to a later section)
25 912fd0cc 2023-05-29 aa and prints the user's choice to stdout.
26 912fd0cc 2023-05-29 aa The options are as follows:
27 912fd0cc 2023-05-29 aa .Bl -tag -width Ds
28 912fd0cc 2023-05-29 aa .It Fl font Ar font
29 912fd0cc 2023-05-29 aa The font to be used for displaying text.
30 912fd0cc 2023-05-29 aa Corresponds to the resource font.
31 912fd0cc 2023-05-29 aa Default is
32 77968eb5 2023-05-29 aa .Dq DejaVu Sans Mono-10 .
33 912fd0cc 2023-05-29 aa .It Fl bg Ar colour
34 912fd0cc 2023-05-29 aa Specifies the normal background colour.
35 912fd0cc 2023-05-29 aa Corresponds to the resource background.
36 912fd0cc 2023-05-29 aa Default is
37 912fd0cc 2023-05-29 aa .Dq white .
38 912fd0cc 2023-05-29 aa .It Fl fg Ar colour
39 912fd0cc 2023-05-29 aa Specifies the normal foreground colour.
40 912fd0cc 2023-05-29 aa Corresponds to the resource foreground.
41 912fd0cc 2023-05-29 aa Default is
42 912fd0cc 2023-05-29 aa .Dq black .
43 912fd0cc 2023-05-29 aa .It Fl sbg Ar colour
44 912fd0cc 2023-05-29 aa Specifies the background colour for selected item.
45 912fd0cc 2023-05-29 aa Corresponds to the resource selectedBackground.
46 912fd0cc 2023-05-29 aa Default is
47 912fd0cc 2023-05-29 aa .Dq black .
48 912fd0cc 2023-05-29 aa .It Fl sfg Ar colour
49 912fd0cc 2023-05-29 aa Specifies the foreground colour for selected item.
50 912fd0cc 2023-05-29 aa Corresponds to the resource selectedForeground.
51 912fd0cc 2023-05-29 aa Default is
52 912fd0cc 2023-05-29 aa .Dq white .
53 912fd0cc 2023-05-29 aa .It Fl bc Ar colour
54 912fd0cc 2023-05-29 aa Specifies the border colour.
55 912fd0cc 2023-05-29 aa Corresponds to the resource borderColour.
56 912fd0cc 2023-05-29 aa Default is
57 912fd0cc 2023-05-29 aa .Dq black .
58 912fd0cc 2023-05-29 aa .It Fl bw Ar width
59 912fd0cc 2023-05-29 aa Specifies the border width.
60 912fd0cc 2023-05-29 aa Corresponds to the resource borderWidth.
61 912fd0cc 2023-05-29 aa Default is 1.
62 912fd0cc 2023-05-29 aa .It Fl hp Ar pad
63 912fd0cc 2023-05-29 aa Specifies the horizontal padding.
64 912fd0cc 2023-05-29 aa Corresponds to the resource horizontalPadding.
65 912fd0cc 2023-05-29 aa Default is 2.
66 912fd0cc 2023-05-29 aa .It Fl vp Ar pad
67 912fd0cc 2023-05-29 aa Specifies the vertical padding.
68 912fd0cc 2023-05-29 aa Corresponds to the resource verticalPadding.
69 912fd0cc 2023-05-29 aa Default is 1.
70 912fd0cc 2023-05-29 aa .It Fl x Ar x
71 912fd0cc 2023-05-29 aa The horizontal position to spawn the window at.
72 912fd0cc 2023-05-29 aa Default corresponds to the horizontal position of the pointer.
73 912fd0cc 2023-05-29 aa .It Fl y Ar y
74 912fd0cc 2023-05-29 aa The vertical position to spawn the window at.
75 912fd0cc 2023-05-29 aa Default corresponds to the vertical position of the pointer.
76 912fd0cc 2023-05-29 aa .El
77 912fd0cc 2023-05-29 aa .Pp
78 912fd0cc 2023-05-29 aa The options, which correspond to a resource take precedence over that
79 912fd0cc 2023-05-29 aa resource.
80 912fd0cc 2023-05-29 aa .Pp
81 912fd0cc 2023-05-29 aa .Nm
82 912fd0cc 2023-05-29 aa reads contents of the menu on stdin.
83 912fd0cc 2023-05-29 aa The input consists of one, or several newline-separated entries (items).
84 912fd0cc 2023-05-29 aa Each entry has the following format:
85 912fd0cc 2023-05-29 aa .Pp
86 912fd0cc 2023-05-29 aa .Dl ITEM := [KEYS] TAB LABEL
87 912fd0cc 2023-05-29 aa .Pp
88 912fd0cc 2023-05-29 aa The optional KEYS field consists of one or more space-separated key
89 912fd0cc 2023-05-29 aa strings, such that can be used with
90 912fd0cc 2023-05-29 aa .Xr XStringToKeysym 3 .
91 912fd0cc 2023-05-29 aa Pressing any of these keys immediately select this item.
92 912fd0cc 2023-05-29 aa Keys are configured case-insensitively.
93 912fd0cc 2023-05-29 aa .Ss Key and button bindings
94 912fd0cc 2023-05-29 aa .Nm
95 912fd0cc 2023-05-29 aa can be intuitively controlled with mouse by bringing the pointer over
96 912fd0cc 2023-05-29 aa the desired item and clicking.
97 912fd0cc 2023-05-29 aa Additional key and button bindings are as follows:
98 912fd0cc 2023-05-29 aa .Bl -tag -width Ds
99 912fd0cc 2023-05-29 aa .It Scroll down , j , down , control-n
100 912fd0cc 2023-05-29 aa Move selection one item down.
101 912fd0cc 2023-05-29 aa .It Scroll up , k , up , control-p
102 912fd0cc 2023-05-29 aa Move selection one item up.
103 912fd0cc 2023-05-29 aa .It Escape , control-c
104 912fd0cc 2023-05-29 aa Quit, outputting nothing.
105 912fd0cc 2023-05-29 aa .It Return , control-m , control-j
106 912fd0cc 2023-05-29 aa Quit, outputting the selected item.
107 912fd0cc 2023-05-29 aa .It Button 1, button 2, button 3
108 912fd0cc 2023-05-29 aa Quit.
109 912fd0cc 2023-05-29 aa If the pointer is inside the window, output the selected item,
110 912fd0cc 2023-05-29 aa otherwise output nothing.
111 912fd0cc 2023-05-29 aa .El
112 912fd0cc 2023-05-29 aa .Sh RESOURCES
113 912fd0cc 2023-05-29 aa .Nm
114 912fd0cc 2023-05-29 aa understands the following resources:
115 912fd0cc 2023-05-29 aa .Bl -tag -width Ds
116 912fd0cc 2023-05-29 aa .It Ic xitems.font
117 912fd0cc 2023-05-29 aa Specifies the font to be used for displaying text.
118 912fd0cc 2023-05-29 aa .It Ic xitems.foreground , xitems,background
119 912fd0cc 2023-05-29 aa Specifies the normal foreground and background colours.
120 912fd0cc 2023-05-29 aa .It Ic xitems.selectedForeground , xitems,selectedBackground
121 912fd0cc 2023-05-29 aa Specifies the foreground and background colours for selected items.
122 912fd0cc 2023-05-29 aa .It Ic xitems.borderColour
123 912fd0cc 2023-05-29 aa Specifies the border colour.
124 912fd0cc 2023-05-29 aa .It Ic xitems.borderWidth
125 912fd0cc 2023-05-29 aa Specifies the border width.
126 912fd0cc 2023-05-29 aa .It Ic xitems.verticalPadding , xitems.horizontalPadding
127 912fd0cc 2023-05-29 aa Specifies the vertical and horizontal padding.
128 912fd0cc 2023-05-29 aa .El
129 912fd0cc 2023-05-29 aa .Sh EXAMPLES
130 912fd0cc 2023-05-29 aa The following script displays a menu with items
131 912fd0cc 2023-05-29 aa .Dq Monitor ,
132 912fd0cc 2023-05-29 aa .Dq xTerm
133 912fd0cc 2023-05-29 aa and
134 912fd0cc 2023-05-29 aa .Dq xCalc .
135 912fd0cc 2023-05-29 aa Each can be selected by pressing the key, corresponding to the capital
136 912fd0cc 2023-05-29 aa letter, or the Cyrillic key, sharing the same position.
137 912fd0cc 2023-05-29 aa Selecting
138 912fd0cc 2023-05-29 aa .Dq Monitor
139 912fd0cc 2023-05-29 aa creates a similar menu, and selecting anything else runs the
140 912fd0cc 2023-05-29 aa corresponding command.
141 912fd0cc 2023-05-29 aa .Bd -literal -offset indent
142 912fd0cc 2023-05-29 aa #!/bin/sh
143 912fd0cc 2023-05-29 aa
144 912fd0cc 2023-05-29 aa topmenu() {
145 912fd0cc 2023-05-29 aa xitems <<-x
146 912fd0cc 2023-05-29 aa m Cyrillic_softsign Monitor
147 912fd0cc 2023-05-29 aa t Cyrillic_e xTerm
148 912fd0cc 2023-05-29 aa e Cyrillic_u xCalc
149 912fd0cc 2023-05-29 aa x
150 912fd0cc 2023-05-29 aa }
151 912fd0cc 2023-05-29 aa
152 912fd0cc 2023-05-29 aa monitormenu() {
153 912fd0cc 2023-05-29 aa xitems <<-x
154 912fd0cc 2023-05-29 aa b Cyrillic_i xBiff
155 912fd0cc 2023-05-29 aa c Cyrillic_es xConsole
156 912fd0cc 2023-05-29 aa x
157 912fd0cc 2023-05-29 aa }
158 912fd0cc 2023-05-29 aa
159 912fd0cc 2023-05-29 aa s=$(topmenu)
160 912fd0cc 2023-05-29 aa
161 912fd0cc 2023-05-29 aa [ -z "$s" ] && exit
162 912fd0cc 2023-05-29 aa
163 912fd0cc 2023-05-29 aa if [ "$s" = Monitor ]; then
164 912fd0cc 2023-05-29 aa monitormenu
165 912fd0cc 2023-05-29 aa else
166 912fd0cc 2023-05-29 aa echo $s
167 912fd0cc 2023-05-29 aa fi | tr '[A-Z]' '[a-z]' | sh
168 912fd0cc 2023-05-29 aa .Ed
169 912fd0cc 2023-05-29 aa .Sh AUTHORS
170 912fd0cc 2023-05-29 aa .An Alexander Arkhipov Aq Mt aa@manpager.net .
171 912fd0cc 2023-05-29 aa .Sh EXIT STATUS
172 912fd0cc 2023-05-29 aa .Ex -std