1XCAPE(1) xcape Manual XCAPE(1)
2
3
4
6 xcape - use a modifier key as another key
7
8
10 xcape [-d] [-f] [-t timeout] [-e map-expression]
11
12
14 xcape allows a modifier key to be used as another key when it is
15 pressed and released on its own. The default behaviour is to generate
16 the Escape key in place of Control_L (Left Control).
17
18
20 -d Debug mode. Will run as a foreground process and print debug
21 information.
22
23 -f Foreground mode. Will run as a foreground process.
24
25 -t timeout
26 Give a timeout in milliseconds. If you hold a key longer than
27 timeout a key event will not be generated.
28
29 -e map-expression
30 Use map-expression as the expression(s).
31
32
34 Expression syntax is ´ModKey=Key[|OtherKey]´. Multiple expressions can
35 be passed, delimited by semi-colons (;).
36
37 A list of keysyms can be found in the header file <X11/keysymdef.h>
38 (without the XK_ prefix).
39
40 Note that shifted keys must be specified as a shift key followed by the
41 key to be pressed rather than the actual name of the character. For
42 example to generate "{" the expression ´ModKey=Shift_L|bracketleft´
43 could be used (assuming that you have a key with ´{´ above ´[´).
44
45 You can also specify ModKey in decimal (prefix #), octal (#0), or hexa‐
46 decimal (#0x). It will be interpreted as a keycode unless no corre‐
47 sponding key name is found.
48
49
51 Make Left Shift generate Escape when pressed and released on it's own,
52 and Left Control generate Ctrl-O combination when pressed and released
53 on it's own:
54 xcape -e 'Shift_L=Escape;Control_L=Control_L|O'
55
56 In conjugation with xmodmap it is possible to make an ordinary key act
57 as an extra modifier. First map the key to the modifier with xmodmap
58 and then the modifier back to the key with xcape. As an example, we can
59 make the space bar work as an additional ctrl key when held with the
60 following sequence of commands:
61
62 First, map an unused modifier's keysym to the spacebar's keycode and
63 make it a control modifier. It needs to be an existing key so that
64 emacs won't spazz out when you press it. Hyper_L is a good candidate.
65
66 spare_modifier="Hyper_L"
67 xmodmap -e "keycode 65 = $spare_modifier"
68 xmodmap -e "remove mod4 = $spare_modifier"
69 # hyper_l is mod4 by default
70 xmodmap -e "add Control = $spare_modifier"
71
72 Next, map space to an unused keycode (to keep it around for xcape to
73 use).
74
75 xmodmap -e "keycode any = space"
76
77 Finally use xcape to cause the space bar to generate a space when
78 tapped.
79
80 xcape -e "$spare_modifier=space"
81
82
84 xmodmap(1), xev(1)
85
86
88 xcape was written by Albin Olsson (albin dot olsson at gmail dot com)
89
90
91
92John Hill 2017-07-03 XCAPE(1)