aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2012-01-01 20:32:40 +0100
committerConnor Lane Smith <cls@lubutu.com>2012-01-01 20:32:40 +0100
commitb95fb20269f55c9fe649d971c53efb8040d3ceea (patch)
tree2c8b6b8607896b6a314a1b269c421de31145323f
parent6664e4233faa3d6b677a24196e9af4ac5b1920fd (diff)
add Mod1Mask keybindings
-rw-r--r--dmenu.188
-rw-r--r--dmenu.c19
2 files changed, 88 insertions, 19 deletions
diff --git a/dmenu.1 b/dmenu.1
index 5f74463..b221417 100644
--- a/dmenu.1
+++ b/dmenu.1
@@ -33,7 +33,7 @@ matching the tokens in the input.
33.B dmenu_run 33.B dmenu_run
34is a script used by 34is a script used by
35.IR dwm (1) 35.IR dwm (1)
36which lists programs in the user's $PATH and executes the selected item. 36which lists programs in the user's $PATH and runs the result in their $SHELL.
37.SH OPTIONS 37.SH OPTIONS
38.TP 38.TP
39.B \-b 39.B \-b
@@ -73,28 +73,90 @@ defines the selected foreground color.
73.B \-v 73.B \-v
74prints version information to stdout, then exits. 74prints version information to stdout, then exits.
75.SH USAGE 75.SH USAGE
76dmenu is completely controlled by the keyboard. Besides standard Unix line 76dmenu is completely controlled by the keyboard. Items are selected using the
77editing and item selection (arrow keys, page up/down, home and end), the 77arrow keys, page up, page down, home, and end.
78following keys are recognized:
79.TP 78.TP
80.B Tab (Ctrl\-i) 79.B Tab
81Copy the selected item to the input field. 80Copy the selected item to the input field.
82.TP 81.TP
83.B Return (Ctrl\-j) 82.B Return
84Confirm selection. Prints the selected item to stdout and exits, returning 83Confirm selection. Prints the selected item to stdout and exits, returning
85success. 84success.
86.TP 85.TP
87.B Shift\-Return (Ctrl\-Shift\-j) 86.B Shift\-Return
88Confirm input. Prints the input text to stdout and exits, returning success. 87Confirm input. Prints the input text to stdout and exits, returning success.
89.TP 88.TP
90.B Escape (Ctrl\-c) 89.B Escape
91Exit without selecting an item, returning failure. 90Exit without selecting an item, returning failure.
92.TP 91.TP
93.B Ctrl\-y 92C\-a
94Paste the primary X selection into the input field. 93Home
95.TP 94.TP
96.B Ctrl-Shift-y 95C\-b
97Paste the X clipboard into the input field. 96Left
97.TP
98C\-c
99Escape
100.TP
101C\-d
102Delete
103.TP
104C\-e
105End
106.TP
107C\-f
108Right
109.TP
110C\-h
111Backspace
112.TP
113C\-i
114Tab
115.TP
116C\-j
117Return
118.TP
119C\-k
120Delete line right
121.TP
122C\-m
123Return
124.TP
125C\-n
126Down
127.TP
128C\-p
129Up
130.TP
131C\-u
132Delete line left
133.TP
134C\-w
135Delete word left
136.TP
137C\-y
138Paste from primary X selection
139.TP
140C\-Y
141Paste from X clipboard
142.TP
143M\-g
144Home
145.TP
146M\-G
147End
148.TP
149M\-h
150Page up
151.TP
152M\-j
153Up
154.TP
155M\-k
156Down
157.TP
158M\-l
159Page down
98.SH SEE ALSO 160.SH SEE ALSO
99.IR dwm (1), 161.IR dwm (1),
100.IR lsx (1) 162.IR stest (1)
diff --git a/dmenu.c b/dmenu.c
index 019fa3e..9fa3e3c 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -243,11 +243,8 @@ keypress(XKeyEvent *ev) {
243 len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status); 243 len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
244 if(status == XBufferOverflow) 244 if(status == XBufferOverflow)
245 return; 245 return;
246 if(ev->state & ControlMask) { 246 if(ev->state & ControlMask)
247 KeySym lower, upper; 247 switch(ksym) {
248
249 XConvertCase(ksym, &lower, &upper);
250 switch(lower) {
251 case XK_a: ksym = XK_Home; break; 248 case XK_a: ksym = XK_Home; break;
252 case XK_b: ksym = XK_Left; break; 249 case XK_b: ksym = XK_Left; break;
253 case XK_c: ksym = XK_Escape; break; 250 case XK_c: ksym = XK_Escape; break;
@@ -281,7 +278,17 @@ keypress(XKeyEvent *ev) {
281 default: 278 default:
282 return; 279 return;
283 } 280 }
284 } 281 else if(ev->state & Mod1Mask)
282 switch(ksym) {
283 case XK_g: ksym = XK_Home; break;
284 case XK_G: ksym = XK_End; break;
285 case XK_h: ksym = XK_Prior; break;
286 case XK_j: ksym = XK_Up; break;
287 case XK_k: ksym = XK_Down; break;
288 case XK_l: ksym = XK_Next; break;
289 default:
290 return;
291 }
285 switch(ksym) { 292 switch(ksym) {
286 default: 293 default:
287 if(!iscntrl(*buf)) 294 if(!iscntrl(*buf))