[hackers] [dmenu] add Mod1Mask keybindings || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Sun, 1 Jan 2012 20:32:52 +0100 (CET)

changeset: 477:67b08ceca1f3
tag: tip
parent: 475:4a931af2d6f0
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Sun Jan 01 20:32:40 2012 +0100
files: dmenu.1 dmenu.c
description:
add Mod1Mask keybindings


diff -r 4a931af2d6f0 -r 67b08ceca1f3 dmenu.1
--- a/dmenu.1 Mon Dec 19 16:52:48 2011 +0100
+++ b/dmenu.1 Sun Jan 01 20:32:40 2012 +0100
_AT_@ -33,7 +33,7 @@
 .B dmenu_run
 is a script used by
 .IR dwm (1)
-which lists programs in the user's $PATH and executes the selected item.
+which lists programs in the user's $PATH and runs the result in their $SHELL.
 .SH OPTIONS
 .TP
 .B \-b
_AT_@ -73,28 +73,90 @@
 .B \-v
 prints version information to stdout, then exits.
 .SH USAGE
-dmenu is completely controlled by the keyboard. Besides standard Unix line
-editing and item selection (arrow keys, page up/down, home and end), the
-following keys are recognized:
+dmenu is completely controlled by the keyboard. Items are selected using the
+arrow keys, page up, page down, home, and end.
 .TP
-.B Tab (Ctrl\-i)
+.B Tab
 Copy the selected item to the input field.
 .TP
-.B Return (Ctrl\-j)
+.B Return
 Confirm selection. Prints the selected item to stdout and exits, returning
 success.
 .TP
-.B Shift\-Return (Ctrl\-Shift\-j)
+.B Shift\-Return
 Confirm input. Prints the input text to stdout and exits, returning success.
 .TP
-.B Escape (Ctrl\-c)
+.B Escape
 Exit without selecting an item, returning failure.
 .TP
-.B Ctrl\-y
-Paste the primary X selection into the input field.
+C\-a
+Home
 .TP
-.B Ctrl-Shift-y
-Paste the X clipboard into the input field.
+C\-b
+Left
+.TP
+C\-c
+Escape
+.TP
+C\-d
+Delete
+.TP
+C\-e
+End
+.TP
+C\-f
+Right
+.TP
+C\-h
+Backspace
+.TP
+C\-i
+Tab
+.TP
+C\-j
+Return
+.TP
+C\-k
+Delete line right
+.TP
+C\-m
+Return
+.TP
+C\-n
+Down
+.TP
+C\-p
+Up
+.TP
+C\-u
+Delete line left
+.TP
+C\-w
+Delete word left
+.TP
+C\-y
+Paste from primary X selection
+.TP
+C\-Y
+Paste from X clipboard
+.TP
+M\-g
+Home
+.TP
+M\-G
+End
+.TP
+M\-h
+Page up
+.TP
+M\-j
+Up
+.TP
+M\-k
+Down
+.TP
+M\-l
+Page down
 .SH SEE ALSO
 .IR dwm (1),
-.IR lsx (1)
+.IR stest (1)
diff -r 4a931af2d6f0 -r 67b08ceca1f3 dmenu.c
--- a/dmenu.c Mon Dec 19 16:52:48 2011 +0100
+++ b/dmenu.c Sun Jan 01 20:32:40 2012 +0100
_AT_@ -243,11 +243,8 @@
         len = XmbLookupString(xic, ev, buf, sizeof buf, &ksym, &status);
         if(status == XBufferOverflow)
                 return;
- if(ev->state & ControlMask) {
- KeySym lower, upper;
-
- XConvertCase(ksym, &lower, &upper);
- switch(lower) {
+ if(ev->state & ControlMask)
+ switch(ksym) {
                 case XK_a: ksym = XK_Home; break;
                 case XK_b: ksym = XK_Left; break;
                 case XK_c: ksym = XK_Escape; break;
_AT_@ -281,7 +278,17 @@
                 default:
                         return;
                 }
- }
+ else if(ev->state & Mod1Mask)
+ switch(ksym) {
+ case XK_g: ksym = XK_Home; break;
+ case XK_G: ksym = XK_End; break;
+ case XK_h: ksym = XK_Prior; break;
+ case XK_j: ksym = XK_Up; break;
+ case XK_k: ksym = XK_Down; break;
+ case XK_l: ksym = XK_Next; break;
+ default:
+ return;
+ }
         switch(ksym) {
         default:
                 if(!iscntrl(*buf))
Received on Sun Jan 01 2012 - 20:32:52 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 01 2012 - 20:36:05 CET