how to use klfc to generate a valid ~/.Xmodmap
Closed this issue · 2 comments
hi @noctuid
I've switched from mac to linux (thinkpad t460s) and I'm using bspwm with sxhkd.
I had some trouble getting xmodmap to work. Actually a lot of trouble.
specifically, I could not swap the windows key and the left alt key.
could klfc help me in this case?
here's my full xmodmap:
! -*- mode: xmodmap -*-
! capslock now is escape
remove Lock = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
! Right Alt is Right Control
remove Mod1 = Alt_R
keycode 108 = Control_R
add Control = Control_R
Klfc doesn't generate an Xmodmap config but an XKB one (XKB is less buggy and can do more; xmodmap is technically deprecated I think, but people still use it anyway in part because the configuration format is a lot less convoluted). I'd try klfc. The documentation is very good. See singletonKeys. You could use ...[ "Win_L", "Alt" ], [ "Alt_L", "Win" ]...
to swap win and alt.
@noctuid, what a breakthrough.
my god his program is absolutely amazing! It's a hidden gem. Oh the pains I went through trying to properly setup my keyboard configuration (I'm a native portuguese speaker using an US keyboard on thinkpad T460s). Using klfc was just a breeze.
All I had to do was:
- create the simplest build script:
#!/usr/bin/env bash
SCRIPTPATH=$(cd $(dirname $0); pwd -P) && cd $SCRIPTPATH
DIST=dist
rm -rf $DIST
mkdir -p $DIST
klfc --from-json qwerty.json deadkeys.json --xkb $DIST
-
grab the plain qwerty.json from the examples and strip the keys I wanted to change
-
create a
deadkeys
.json where I've put my portuguese and customization stuff
{
"singletonKeys": [
["Alt_R", "Control"],
["CapsLock", "Escape"]
],
"shiftlevels": [ "None", "Shift" ],
"keys": [
{ "pos": "~", "letters": [ "grave", "tilde" ] },
{ "pos": "6", "letters": [ "6", "circumflex" ] },
{ "pos": "'", "letters": [ "acute", "\"" ] }
]
}
-
run
build.sh
-
run the generated install script and call it day.
AMAZING!!!
thanks a TON for this recommendation.