-
Notifications
You must be signed in to change notification settings - Fork 0
/
remap_keys.sh
58 lines (45 loc) · 1.65 KB
/
remap_keys.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
# remaps keys:
# Return to ctrl when held, to return when released
# CapsLock to ctrl when held, to Esc when released
# left Ctrl to CapsLock
#
#
# depends xmodmap xcape
# https://github.com/alols/xcape
# referencs: https://www.reddit.com/r/vim/comments/4d6iym/what_do_you_all_do_with_caps_lock_control_and/
# https://www.emacswiki.org/emacs/MovingTheCtrlKey#h5o-5
# https://wiki.archlinux.org/title/Xmodmap#Keymap_table
# https://www.cnblogs.com/yinheyi/p/10146900.html
# https://my.oschina.net/swanf/blog/1549976
# This is read into window managers as follows:
# - exwm: in .xession
# - i3: in ~/.config/i3/config
# - xfce4: not done yet...
# clear all mappings:
setxkbmap -option '' # That's 2 single quotes...
# reset xcape
killall xcape
# Set basic keyboard variant (gb mac)
# Caps Lock to
# 1. Escape when tapped
# 2. Ctrl when held
# gb is layout US keyboard
# setxkbmap -layout gb -option caps:ctrl_modifier level3:rwin terminate:ctrl_alt_bksp compose:prsc
# xcape -e 'Caps_Lock=Escape'
setxkbmap -option ctrl:swapcaps
xcape -e 'Control_L=Escape'
# assign return to control on press, return on release
# remove all modiiers fun, shift/lock/control/mod1/mod2/mod3/mo4/mod5
xmodmap -e 'clear lock'
xmodmap -e 'keycode 66 = Control_L NoSymbol NoSymbol NoSymbol'
xmodmap -e 'add Control = Control_L'
# # make a fake escape key (so we can map it with xcape)
xmodmap -e 'keycode 999 = Escape'
xcape -e 'Control_L=Escape'
# assign return to control on press, return on release
xmodmap -e 'keycode 36 = 0x1234'
xmodmap -e 'add Control = 0x1234'
# make a fake return key (so we can map it with xcape)
xmodmap -e 'keycode any = Return'
xcape -e '0x1234=Return'