Skip to content

Instantly share code, notes, and snippets.

@pawitp
Last active June 22, 2019 14:13
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 pawitp/666208230ef8cd63d426dd80afbf0cc2 to your computer and use it in GitHub Desktop.
Save pawitp/666208230ef8cd63d426dd80afbf0cc2 to your computer and use it in GitHub Desktop.
Setup keyboard on Arch. Map <Win>+Left to Home, etc.
# This will map:
# <Win> + Left to Home
# <Win> + Right to End
# <Win> + Up to Page Up
# <Win> + Down to Page Down
# Modify /usr/share/X11/xkb/symbols/pc, replace the definition of <LEFT>, <RGHT>, <UP> and <DOWN>
key <LEFT> {
type[Group1]= "PC_SUPER_LEVEL2",
symbols[Group1]= [ Left, Home ]
};
key <RGHT> {
type= "PC_SUPER_LEVEL2",
symbols[Group1]= [ Right, End ]
};
key <UP> {
type= "PC_SUPER_LEVEL2",
symbols[Group1]= [ Up, Prior ]
};
key <DOWN> {
type= "PC_SUPER_LEVEL2",
symbols[Group1]= [ Down, Next ]
};
# Note: GNOME settings related to Super + Arrow need to be removed for this to work
# HACK: We also need to patch libX11 for this to work properly in Chrome
# Edit src/XlibInt.c
# In _XWireToEvent in KeyRelease, add the following at the end of the case (after ev->kekeycode)
#define REMAP(from, to) if (ev->keycode == from && ev->state & 0x40) {ev->state = ev->state & ~0x40;ev->keycode=to;}
REMAP(114, 115);
REMAP(113, 110);
REMAP(111, 112);
REMAP(116, 117);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment