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.
Let's try simplifying this a little.
I'm not aware of any symbols command keys.type=MULTI
, so I removed that line first.
I saved your file as keys
(minus that line) and ran xkbcomp -w 10 keys
. It reports:
Warning: No automatic type for 6 symbols
Using for the <TLDE> key (keycode 49)
Warning: Type "" is not defined
Using TWO_LEVEL for the <TLDE> key (keycode 49)
(and a lot more errors after that)
So, let's add a definition MULTI3
that mimics MULTI
but with 3 (6) levels:
type "MULTI3" {
modifiers = Shift+Mod3+Mod5;
map[Shift] = Level2;
map[Mod3] = Level3;
map[Shift+Mod3] = Level4;
map[Mod5] = Level5;
map[Shift+Mod5] = Level6;
level_name[Level1] = "Base";
level_name[Level2] = "Shift";
level_name[Level3] = "Alt";
level_name[Level4] = "Shift Alt";
level_name[Level5] = "Control";
level_name[Level6] = "Control Shift";
};
… and then assign it to TLDE
:
key <TLDE> {type="MULTI3", symbols=[grave, asciitilde, dead_grave, dead_tilde, dead_doublegrave, dead_belowtilde]};
OK, re-running xkbcomp -w 10 keys
confirms that this eliminates that error.
The same type of error affects 27 other keys … so, annotating them with the desired type, and/or creating new types to handle them, should eliminate those errors.
The case of having two groups defined (which, by the way, will interact in very unpleasant ways with most tools for picking a keyboard layout, eg in Gnome) in the same file, you will have to specify the symbols and types for each group. I've never tried this myself, but eg:
key <AD01> {type[group1]="NewTypeFor5Levels",
symbols[group1]=[q, Q, Greek_theta, Greek_THETA, U03D1],
type[group2]="TWO_LEVEL",
symbols[group2]=[Cyrillic_shorti, Cyrillic_SHORTI]};
// vartheta
key <AD02> {type[group1]="MULTI",
symbols[group1]=[w, W, a, A, b, B, c, C],
type[group2]="TWO_LEVEL",
symbols[group2]=[Cyrillic_tse, Cyrillic_TSE]};
Once the file can be compiled, you should have better success.
Best Answer
The problem is that when you use a common modifier like AltGr, programs actually see it as being pressed when you use the AltGr arrows. So Shift + AltGr + i actually appears to a program as if you are pressing
Shift + Alt + Up
and it's the addition of the extraAlt
that confuses the program. You can avoid this by either adding more shortcuts to the program if possible, soShift + Alt + Up
does the same action asShift + Up
, or you can use an uncommon modifier that the program is not aware of.There are other ways of doing this, but this was one of the simpler ways and works well for me. It creates a "Group2" overlay on the alphanumeric keys, such that when you switch to Group2 you will have arrows there instead of letters. You can switch to Group2 with a toggle (on/off like Caps Lock normally works) or a momentary (press to activate, like Shift normally works)
You can then pick a key to use as a Group2 activation key. You can see all the options (if you don't want to roll your own) with this:
Then pick an option, for example this one activates the arrows only while Caps Lock is being held. It also adds a new combination Alt + Caps Lock to actually switch caps lock on and off:
You can add this into your Xorg config file to make the change permanent - there are plenty of guides online about how to do this.
Note that:
key
is used, as opposed toreplace key
because we want to add to the existing definition, not replace it.ALPHANUMERIC
with extended modifiers (e.g. Hyper) to activate the arrow keys.