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

[SOLVED] Mapping CapsLock to Control_R when pressed and Esc when pressed once #129

Closed zenny closed 3 years ago

zenny commented 3 years ago

Hi,

I could successfully map CapsLock to Super_R when pressed and Esc when pressed and released at once with the follwoing:

xset r rate 300 50
setxkbmap -layout eu,us -option grp:alt_space_toggle,caps:super
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'
xmodmap -e 'keycode 135 = Super_R'

However, when I tried to map CapsLock to Control_R when pressed and Esc when pressed and released at once does NOT work with the following:

xset r rate 300 50
setxkbmap -layout eu,us -option grp:alt_space_toggle,caps:ctrl_modifier
killall xcape 2>/dev/null ; xcape -e 'Control_R=Escape'
xmodmap -e 'keycode 105 = Control_R'

What did I miss? Any clue appreciated. Cheers,

rafaeln commented 3 years ago

I gave up on using xcape to try and do that on Ubuntu 18.04 i3wm and have since happily switched to ctrl2esc.

zenny commented 3 years ago

I gave up on using xcape to try and do that on Ubuntu 18.04 i3wm and have since happily switched to ctrl2esc.

Thanks. I do not use Ubuntu myself . Currently on Voidlinux. I liked https://gitlab.com/interception/linux/plugins/dual-function-keys, but went with a working approach.

I did the following and it worked:

xset r rate 300 50
setxkbmap -layout eu,us -option grp:alt_space_toggle,caps:ctrl_modifier
killall xcape 2>/dev/null ; xcape -e 'Control_L=Escape'
xmodmap -e 'keycode 66 = Control_L'

Maybe this is helpful to someone. Cheers,