XKB workaround
Since your F# keys are coming across on a different logical device than the Ctrl+Alt keys, altering your XKB layout to generate those keysyms on some of your regular keys might be a reasonable workaround. Test keys with evdev
to make sure they're on the same input; the example below assumes the number keys will be. Caveats to consider:
xkbcomp
will not work under Wayland, and GNOME-based desktop environments may reset keyboard settings, so use a basic window manager for testing. If this solution works, it can be rewritten as an XKB option or layout variant, placed into the system XKB database, and configured by whatever means your DE provides.
You may be able to use ckbcomp
to generate a console keymap with these changes, or you may find the console's Ctrl+F2 functions properly so modifications are unneeded. Or you may need to get friendly with loadkeys
.
Some applications may already define hotkeys such as Ctrl+Alt+2; I don't know how they might interact with this layout.
Given all these factors, this is definitely an ugly hack. Fixing the issue at a lower layer (eg, by evdev
merging the two inputs into one before acting on them) would be preferable.
First, generate a basic keymap, with setxkbmap -print
; then we'll edit this file and add overrides to it, and finally load the altered keymap with xkbcomp [file] $DISPLAY
:
$ setxkbmap -print > mykeymap.xkb
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols { include "pc+us(altgr-intl)+inet(evdev)" };
xkb_geometry { include "pc(pc105)" };
};
Generate a full keymap with xkbcomp
to find the original symbols in your layout. Don't worry too much if symbols are a little different in your layout; as long as they are four-level or fewer this should work.
$ xkbcomp $DISPLAY - > origkeymap.xkb
# (from) (to)
// the # keys on a typical PC keyboard are AE01,AE02,...,AE09,AE10
// in the xkb_symbols section you'll find these:
key <AE01> {
type= "FOUR_LEVEL",
symbols[Group1]= [ 1, exclam, onesuperior, exclamdown ]
};
Now edit mykeymap.xkb
and place the overrides we need into it:
// Attempting to place XF86Switch_VT_N keysyms on 1-0.
//
// starting point: setxkbmap -layout us -variant altgr-intl -option '' -print
// load this file: xkbcomp mykeymap.xkb $DISPLAY
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
xkb_symbols {
include "pc"
include "us(altgr-intl)"
include "inet(evdev)"
// redefine numeric keys
key <AE01> {
type= "CTRL+ALT",
symbols[Group1]= [ 1, exclam, onesuperior, exclamdown, XF86Switch_VT_1 ]
};
key <AE02> {
type= "CTRL+ALT",
symbols[Group1]= [ 2, at, twosuperior, dead_doubleacute, XF86Switch_VT_2 ]
};
key <AE03> {
type= "CTRL+ALT",
symbols[Group1]= [ 3, numbersign, threesuperior, dead_macron, XF86Switch_VT_3 ]
};
key <AE04> {
type= "CTRL+ALT",
symbols[Group1]= [ 4, dollar, currency, sterling, XF86Switch_VT_4 ]
};
key <AE05> {
type= "CTRL+ALT",
symbols[Group1]= [ 5, percent, EuroSign, dead_cedilla, XF86Switch_VT_5 ]
};
key <AE06> {
type= "CTRL+ALT",
symbols[Group1]= [ 6, asciicircum, dead_circumflex, onequarter, XF86Switch_VT_6 ]
};
key <AE07> {
type= "CTRL+ALT",
symbols[Group1]= [ 7, ampersand, dead_horn, onehalf, XF86Switch_VT_7 ]
};
key <AE08> {
type= "CTRL+ALT",
symbols[Group1]= [ 8, asterisk, dead_ogonek, threequarters, XF86Switch_VT_8 ]
};
key <AE09> {
type= "CTRL+ALT",
symbols[Group1]= [ 9, parenleft, leftsinglequotemark, dead_breve, XF86Switch_VT_9 ]
};
key <AE10> {
type= "CTRL+ALT",
symbols[Group1]= [ 0, parenright, rightsinglequotemark, dead_abovering, XF86Switch_VT_10 ]
};
};
xkb_geometry { include "pc(pc105)" };
};
Now you can load this file and test the keys:
# load keymap for all keyboards
$ xkbcomp mykeymap.xkb $DISPLAY
# load only on device id=# (see `xinput -list`)
$ xkbcomp -i # mykeymap.xkb $DISPLAY
This won't change the console keymap, so switching back may require that other keyboard.
If testing shows that these keys work, and aren't trampling other uses of those key combinations, you can make this permanent by your favorite XKB modification method.
evtest
should be able to verify and determine which input devices are producing which keysyms.