Skip to content

Instantly share code, notes, and snippets.

@tomdaley92
Last active September 5, 2021 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomdaley92/7a97231fd70ef89eedd0879296b82a3d to your computer and use it in GitHub Desktop.
Save tomdaley92/7a97231fd70ef89eedd0879296b82a3d to your computer and use it in GitHub Desktop.
Debian Caps-lock Re-purposing
hyper-caps() {
xmodmap ~/.Xmodmap -verbose
}
normal-caps() {
setxkbmap -layout us
}
keycode 66 = Mode_switch
keysym j = j J Left
keysym l = l L Right
keysym i = i I Up
keysym k = k K Down
keysym u = u U Home
keysym o = o O End
@tomdaley92
Copy link
Author

tomdaley92 commented Sep 5, 2021

Orignal solution of creating an entry in startup applications works on reboot but the key bindings reset when resuming from suspend (sleep states). I tried installing a script in /lib/systemd/system-sleep/ which works sometimes but fails a lot and feels super race-condition-y. Looking into setxkbmap instead of xmodmap, as these two conflict and have the potential to reset each other.

https://wiki.linuxquestions.org/wiki/Configuring_keyboards
https://utcc.utoronto.ca/~cks/space/blog/unix/XKeyboardRemappingNotes

Edit: I'm running Elementary OS 6 Odin

@tomdaley92
Copy link
Author

For now, I'm not even bothering with any automation and just ended up creating some quick and dirty convenience functions in my ~/.bashrc

hyper-caps() {
    xmodmap ~/.Xmodmap -verbose
}

normal-caps() {
    setxkbmap -layout us
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment