Last active
April 23, 2024 18:32
-
-
Save edliaw/11005709 to your computer and use it in GitHub Desktop.
Custom keyboard layout for GNOME
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Name=Keyboard Layout | |
Type=Application | |
Exec=sh -c "sleep 10 && [ -f \\$HOME/.Xkeymap ] && xkbcomp \\$HOME/.Xkeymap \\$DISPLAY 2> /dev/null" | |
Terminal=false | |
NoDisplay=true | |
X-GNOME-Autostart-enabled=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xkb_keymap { | |
xkb_keycodes { include "evdev+aliases(qwerty)" }; | |
xkb_types { include "complete" }; | |
xkb_compat { include "complete" }; | |
xkb_symbols { include "pc+us_custom+inet(evdev)" }; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
default partial alphanumeric_keys modifier_keys | |
xkb_symbols "us_custom" { | |
include "us(basic)" | |
name[Group1]= "English (custom layout)"; | |
key.type[Group1]="ONE_LEVEL"; | |
key <ESC> { [ Caps_Lock ] }; | |
key <CAPS> { [ Control_L ] }; | |
key <LCTL> { [ Escape ] }; | |
}; |
Alternatively, with the symbol file at $HOME/.xkb/symbols/us_custom
and keymap at $HOME/.xkb/keymap.xkb
:
Running xkbcomp -I$HOME/.xkb $HOME/.xkb/keymap.xkb $DISPLAY
will compile and load the keymap.
You can also dump the current keymap using xkbcomp $DISPLAY $HOME/.Xkeymap
and create a GNOME desktop file to autoload it on boot in ~/.config/autostart/custom_xkb.desktop
.
References:
http://www.x.org/wiki/XKB/
https://wiki.archlinux.org/index.php/X_KeyBoard_extension
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Custom symbol file goes into
/usr/share/X11/xkb/symbols/us_custom
Then, add to
/usr/share/X11/xkb/rules/evdev.xml
: