Remap the CapsLock key to Exit and Super or Ctrl

1

The position of CapsLock is valuable. I would like to add 3 functions to it. This idea is inspired by lucksmith's i3-gap settings which only add 2 functions to it (see remapSuper and remapCtrl script below)

My window manager is i3wm, My OS is Arch Linux. I use the following scripts to remap the CapsLock key

Remap the CapLock into Super and Esc

#remapSuper script: remap the Caslock to Super key (i3wm uses a lot Super key) 
setxkbmap -option caps:super

#remapEsc script: But when it is pressed only once, treat it as escape (Vim uses a lot exit)
killall xcape 2>/dev/null ; xcape -e 'Super_L=Escape'

Remap the CapLock key into Ctrl

#remapCtrl script: remap the Caps to Ctrl, for tmux + Vim + fzf/Ctrlp/ 
setxbmap -option caps:ctrl

What I need to achieve:

From appearance, user taps CapsLock+Tab keys, but functionally:

Ctrl + Tab --> call Remap1 rules (change the Ctrl, positioned at CapsLock into Super)

Super + Tap --> call Remap3 rules (change the Super key, positioned at CapsLock into Ctrl key)

My solution for switch mapping between remapSuper and remapCtrl is

# the switch function between remapCtrl and remapSuper in i3wm
bindsym $mod+Tab exec --no-startup-id remapCtrl
bindsym Ctrl+Tab exec --no-startup-id remapSuper

Issues I have:

The remapSuper and remapEsc are called when i3wm is started. They work fine. But the switch mapping between remapSuper and remapCtrl is not work.

Question:

How should I solve it?

SLN

Posted 2019-04-12T09:07:24.377

Reputation: 111

What OS? There are plenty of questions about remapping keys on SuperUser, but I don't recall if any of them are about the i3 Window Manager. Have you looked at those and do you have to use this particular application? Please use the EDIT button to add this and other necessary information to your question. – music2myear – 2019-05-03T14:27:08.253

1@music2myear Arch Linux is my OS. I've added the information to the question – SLN – 2019-05-03T15:09:22.753

xmodmap: https://bbs.archlinux.org/viewtopic.php?id=107959

– Biswapriyo – 2019-05-03T15:28:59.823

No answers