Skip to content

Instantly share code, notes, and snippets.

@f-ilic
Last active November 25, 2023 18:29
Show Gist options
  • Save f-ilic/5d14f13f2b6d7237eac255cbd9498466 to your computer and use it in GitHub Desktop.
Save f-ilic/5d14f13f2b6d7237eac255cbd9498466 to your computer and use it in GitHub Desktop.
Remaping keyboard files

Remapping keys

  • Download .zip file, unzip, and cd into extracted
  • Run setup.sh
  • changes the US layout option to 21st century keyboard navigation
  • tldr; Capslock disabled, Capslock used as new modifier key
  • navigation with
    • caps + j, k, l, i = arrows in arrow layout
    • caps + u, o = home, end
    • caps + h, ; = backspace, delete
    • caps + y, n = PgUp, PgDown
  • caps + shift, cntrl behaviour as you would expect
default xkb_compatibility "complete" {
include "basic"
augment "iso9995"
augment "mousekeys"
augment "accessx(full)"
augment "misc"
augment "xfree86"
augment "level5"
augment "caps(caps_lock)"
interpret Caps_Lock+AnyOfOrNone(all) {
action= SetMods(modifiers=Lock);
};
};
#!/bin/bash
# Set the repeat on for the remapped keys in /usr/share/X11/xkb/
xset r 65 # space
xset r 30 # u
xset r 31 # i
xset r 32 # o
xset r 43 # h
xset r 44 # j
xset r 45 # k
xset r 46 # l
xset r 47 # ;
#!/bin/bash
sudo cp compat_complete /usr/share/X11/xkb/compat/complete
sudo cp types_complete /usr/share/X11/xkb/types/complete
sudo cp symbols_us /usr/share/X11/xkb/symbols/us
setxkbmap -layout us
default partial alphanumeric_keys modifier_keys
xkb_symbols "basic" {
name[Group1]= "English (US)";
key <TLDE> { [ grave, asciitilde ] };
key <AE01> { [ 1, exclam ] };
key <AE02> { [ 2, at ] };
key <AE03> { [ 3, numbersign ] };
key <AE04> { [ 4, dollar ] };
key <AE05> { [ 5, percent ] };
key <AE06> { [ 6, asciicircum ] };
key <AE07> { [ 7, ampersand ] };
key <AE08> { [ 8, asterisk ] };
key <AE09> { [ 9, parenleft ] };
key <AE10> { [ 0, parenright ] };
key <AE11> { [ minus, underscore ] };
key <AE12> { [ equal, plus ] };
key <AD01> {type= "CUST_CAPSLOCK",
symbols[Group1]=[q, Q, Escape],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<ESC>) ]
};
key <AD02> { [ w, W ] };
key <AD03> { [ e, E ] };
key <AD04> { [ r, R ] };
key <AD05> { [ t, T ] };
key <AD06> {type= "CUST_CAPSLOCK",
symbols[Group1]=[y, Y, Page_Up],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<PGUP>) ]
};
key <AD07> {type= "CUST_CAPSLOCK",
symbols[Group1]=[u, U, Home],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<HOME>) ]
};
key <AD08> {type= "CUST_CAPSLOCK",
symbols[Group1]=[ i, I, Up ],
actions[Group1]=[ NoAction(), NoAction(), RedirectKey(keycode=<UP>) ]
};
key <AD09> {type= "CUST_CAPSLOCK",
symbols[Group1]=[o, O, End],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<END>) ]
};
key <AD10> { [ p, P ] };
key <AD11> { [ bracketleft, braceleft ] };
key <AD12> { [ bracketright, braceright ] };
key <AC01> { [ a, A ] };
key <AC02> { [ s, S ] };
key <AC03> { [ d, D ] };
key <AC04> { [ f, F ] };
key <AC05> { [ g, G ] };
key <AC06> {type= "CUST_CAPSLOCK",
symbols[Group1]=[h, H, BackSpace],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<BKSP>) ]
};
key <AC07> {type= "CUST_CAPSLOCK",
symbols[Group1]=[ j, J, Left ],
actions[Group1]=[ NoAction(), NoAction(), RedirectKey(keycode=<LEFT>) ]
};
key <AC08> {type= "CUST_CAPSLOCK",
symbols[Group1]=[ k, K, Down ],
actions[Group1]=[ NoAction(), NoAction(), RedirectKey(keycode=<DOWN>) ]
};
key <AC09> {type= "CUST_CAPSLOCK",
symbols[Group1]=[l, L, Right ],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<RGHT>) ]
};
key <AC10> {type= "CUST_CAPSLOCK",
symbols[Group1]=[semicolon, colon, Delete ],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<DELE>) ]
};
key <AC11> { [ apostrophe, quotedbl ] };
key <AB01> { [ z, Z ] };
key <AB02> { [ x, X ] };
key <AB03> { [ c, C ] };
key <AB04> { [ v, V ] };
key <AB05> { [ b, B ] };
key <AB06> {type= "CUST_CAPSLOCK",
symbols[Group1]=[n, N, Page_Down],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<PGDN>) ]
};
key <AB07> { [ m, M ] };
key <AB08> { [ comma, less ] };
key <AB09> { [ period, greater ] };
key <AB10> { [ slash, question ] };
key <BKSL> { [ backslash, bar ] };
key <SPCE> {type= "CUST_CAPSLOCK",
symbols[Group1]=[space, space, Return],
actions[Group1]=[NoAction(), NoAction(), RedirectKey(keycode=<RTRN>) ]
};
};
default xkb_types "complete" {
include "basic"
include "mousekeys"
include "pc"
include "iso9995"
include "level5"
include "extra"
include "numpad"
type "CUST_CAPSLOCK" {
modifiers= Shift+Lock;
map[Shift] = Level2; //maps shift and no Lock. Shift+Alt goes here, too, because Alt isn't in modifiers.
map[Lock] = Level3;
map[Shift+Lock] = Level3; //maps shift and Lock. Shift+Lock+Alt goes here, too.
level_name[Level1]= "Base";
level_name[Level2]= "Shift";
level_name[Level3]= "Lock";
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment