I have the same issue. From the doc, one could guess that the correct syntax would be something like that :
$ setxkbmap -I$HOME/.config/xkb -option mine:accent
Note : ~
doesn't work with the -I
option
with
~/.config/xkb/symbols/azerty_altgr
partial default
xkb_symbols "accent" {
include "level3(ralt_switch)"
key <AE02> { [ NoSymbol, NoSymbol, eacute, NoSymbol ] };
key <AE07> { [ NoSymbol, NoSymbol, egrave, NoSymbol ] };
key <AE09> { [ NoSymbol, NoSymbol, asciicircum, NoSymbol ] };
key <AE10> { [ NoSymbol, NoSymbol, agrave, NoSymbol ] };
};
or whatever symbole file you have and
~/.config/xkb/rules/evdev
! option = symbols
mine:accent = +azerty_altgr(accent)
Unfortunately, it doesn't work.
The only solution I found is the following :
Use the same files described above. Set all native option using setxkbmap -option caps:swapescape,whatever
. Then :
$ setxkbmap -print > tempfile.txt
and edit tempfile.txt
in order to add your custom option in the xkb_symbols
line :
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us+fr:2+inet(evdev)+capslock(swapescape)+azerty_altgr(accent)" };
xkb_geometry { include "pc(pc104)" };
};
and finaly :
xkbcomp -I$HOME/.config/xkb tempfile.txt $DISPLAY
It can be generalised for any number of options.
This solution is deprecated according to Archlinux wiki.
I know this answer is a bit late, but i found Swoogans keyboard driver and modified it for our purpose. I recently bought a Asura K501 myself and went through the same trouble. Please note that my asura is 2017 model and chipset is 0x760b and not 0x7603
https://bitbucket.org/vipinmohan/redragon-asura-kb-ubuntu
Use this. My Asura works fine now
Best Answer
xmodmap
is obsolete; so indeed it should be done with thexkb
tools.The swap you want seems not to be included by default with X11 files; so you have to write it yourself.
The page https://web.archive.org/web/20170825051821/http://madduck.net/docs/extending-xkb/ helped me to understand and find a way to do it.
Create a file
~/.xkb/keymap/mykbd
where you put the output ofsetxkbmap
, it will be your base keyboard definition; eg:then, create a symbols file to define your key swapping, put it for example in
~/.xkb/symbols/myswap
there, put the following lines:
then, edit the
~/.xkb/keymap/mykbd
file, and change thexkb_symbols
line to addfinally, you can load it with
xkbcomp -I$HOME/.xkb ~/.xkb/keymap/mykbd $DISPLAY
(you cannot use "~" for the-I
parameter).It will probably spit a lot of warnings about undefined symbols for some rare keys, but you can ignore them (eg, redirect error to dave:
2> /dev/null
).If you want to be able to easily swap between a normal and your inverted ctrl/shift one; just create under
~/.xkb/keymap/
another file, without the extra "myswap" option, and load it withxkbcomp
. You can make two small scripts to load them.