alols / xcape

Linux utility to configure modifier keys to act as other keys when pressed and released on their own.
GNU General Public License v3.0
2.1k stars 117 forks source link

Can't map alt_r to space, but I can map space to alt_r #131

Closed viasux closed 3 years ago

viasux commented 3 years ago
# 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="space"
xmodmap -e "keycode 65 = $spare_modifier"
xmodmap -e "remove mod4 = $spare_modifier" # hyper_l is mod4 by default
xmodmap -e "add Control = $spare_modifier"

# Map space to an unused keycode (to keep it around for xcape to
# use).
xmodmap -e "keycode 255 = Alt_r"

# Finally use xcape to cause the space bar to generate a space when tapped.
# xcape -e 'Alt_R=KP_Space'
xcape -e "$spare_modifier=Alt_r"

gives this

xmodmap:  commandline:1:  bad keysym name 'Alt_r' in keysym list
xmodmap:  1 error encountered, aborting.
Invalid key: Alt_r
Failed to parse_mapping