XCAPE(1)
π XCAPE π
okay bestie, welcome to the xcape manual page (section 1 of the xcape Manual, if we're being official about it) πΈ
β¨ NAME β¨
xcape β use a modifier key as another key π
π SYNOPSIS π
xcape [-d] [-t timeout] [-e map-expression]
π DESCRIPTION π
so here's the tea π: xcape lets a modifier key do a whole other job when you press it and let it go all by itself. like, tapped solo, no other key invited to the party.
the default behaviour? genuinely iconic: it generates the Escape key instead of Control_L (that's Left Control, the one on the left, yes).
π OPTIONS π
-dβ Debug mode π. it will run as a foreground process, so it's right there in your terminal being loud and proud.-t timeoutβ give a timeout in milliseconds β±οΈ. if you hold a key longer than timeout, a key event will not be generated. so hold it too long and, nope, nothing, sorry babe.-e map-expressionβ use map-expression as the expression(s) π«.
π¦ EXPRESSION SYNTAX π¦
the expression syntax is Β΄ModKey=Key[|OtherKey]Β΄ β yes, that's the shape of it, that's the vibe β¨
you can pass multiple expressions, and you delimit them with semi-colons (;). stack 'em up, bestie.
a whole list of keysyms lives in the header file <X11/keysymdef.h> β and psst, you drop the XK_ prefix when you use them π«Ά
β οΈ important caveat, do not skip this: shifted keys have to be specified as a shift key followed by the key to be pressed, not the actual name of the character. so if you wanna generate{, you'd use the expressionΒ΄ModKey=Shift_L|bracketleftΒ΄β that's assuming you've got a key withΒ΄{Β΄sitting aboveΒ΄[Β΄, iykyk π
you can also specify ModKey in decimal (prefix #), octal (#0), or hexadecimal (#0x) π’. it'll be interpreted as a keycode unless no corresponding key name is found. that last bit matters, fr fr.
π₯ EXAMPLES π₯
make Left Shift pop off as Escape, and Left Control do a Ctrl-O combo
make Left Shift generate Escape when it's pressed and released on its own, and make Left Control generate a Ctrl-O combination when it's pressed and released on its own π
xcape -e 'Shift_L=Escape;Control_L=Control_L|O'
the xmodmap collab π€
in conjugation with xmodmap it is possible to make an ordinary key act as an extra modifier. the move is: first map the key to the modifier with xmodmap, and then map the modifier back to the key with xcape π
as an example, we can make the space bar work as an additional ctrl key when held, with the following sequence of commands π
step one: give the modifier a home
first, map an unused modifier's keysym to the spacebar's keycode, and make it a control modifier. it needs to be an existing key so that emacs won't spazz out when you press it π. Hyper_L is a good candidate π
spare_modifier="Hyper_L"
xmodmap -e "keycode 65 = $spare_modifier"
xmodmap -e "remove mod4 = $spare_modifier"
# hyper_l is mod4 by default
xmodmap -e "add Control = $spare_modifier"
step two: stash space somewhere safe
next, map space to an unused keycode β this is so it's kept around for xcape to use π§
xmodmap -e "keycode any = space"
step three: the actual xcape moment β¨
finally, use xcape to cause the space bar to generate a space when tapped π«Ά
xcape -e "$spare_modifier=space"
πΈ SEE ALSO πΈ
π AUTHOR π
xcape was written by Albin Olsson (albin dot olsson at gmail dot com) π
and that's a wrap, bestie π this page came from John Hill, dated 2014-02-13, for XCAPE(1) β periodt. ππ¦
π¦ where this page comes from
- arch rolling: xcape 1.2-5 Β· GPL3
- debian bookworm: xcape 1.2-3+b1 Β· GPL-3.0-or-later
- debian trixie: xcape 1.2-3+b2 Β· GPL-3.0-or-later
- nixpkgs unstable: xcape 1.2
- opensuse-leap 16.0: xcape 1.2-bp160.1.3 Β· GPL-3.0
- opensuse-leap 16.0: xcape 1.2-bp160.1.3 Β· GPL-3.0
- opensuse-leap 16.0: xcape 1.2-bp160.1.3 Β· GPL-3.0
- opensuse-leap 16.0: xcape 1.2-bp160.1.3 Β· GPL-3.0
- ubuntu jammy: xcape 1.2-3 Β· GPL-3.0-or-later
- ubuntu noble: xcape 1.2-3build1 Β· GPL-3.0-or-later
- ubuntu questing: xcape 1.2-3build1
- ubuntu resolute: xcape 1.2-3build2 Β· GPL-3.0-or-later
- ubuntu stonking: xcape 1.2-3build2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms