Skip to content

Instantly share code, notes, and snippets.

@yapudpill
Last active December 26, 2025 22:00
Show Gist options
  • Select an option

  • Save yapudpill/9c4fdddd0e39a556dfe1b47a50121ab9 to your computer and use it in GitHub Desktop.

Select an option

Save yapudpill/9c4fdddd0e39a556dfe1b47a50121ab9 to your computer and use it in GitHub Desktop.
This gist contains the necessary files to transform the Copilot key into a Compose key under X or
Wayland. This is done by creating a custom keyboard option that simply needs to be enabled in your
system's settings.
Bonus: if your keyboard has a level 3 key (AltGr) then AltGr+Copilot gives you greek letters!
How to:
1. Place each files in `~/.config/xkb/<folder indicated on the first line>`.
2. Restart your X/Wayland session (simply logout then login)
3. Enable the option using your system's setting software. (In KDE's system settings app it is
located under Keyboard > Key bindings (top right corner) > Position of Compose key, check the box
"Compose on Copilot, greek on AltGr+Copilot")
4. Enjoy having made the Copilot key useful. Tip: `/usr/share/X11/locale/<your locale>/Compose`
lists the available compose sequences. (<your locale> defaults to `en_US.UTF-8` if the
corresponding folder does not exists)
NOTES:
- Despite the name of everything starting with X, this indeed works for Wayland.
(Short story: Wayland doesn't have its own way to handle keyboard layout so it reuses things from X)
- I assume that you use a recent version of X/Wayland that uses libxkbcommon to handle keyboard
layouts. If yours doesn't, you may need to edit the files under `/usr/share/X11/xkb` as root.
However, beware that every update of the package `xkeyboard-config` may override your changes.
- This does not actually remap the copilot key but rather the combination super+shift+F23 because
this is how Copilot keys are physically wired inside keyboards.
- I made this almost exclusively using the documentation for libxkbcommon (https://xkbcommon.org/doc/current/),
in particular the section "User-configuration". So if you want more info on how this works, head
over there.
// Place this in the `symbols` folder
partial alphanumeric_keys modifier_keys
xkb_symbols "copilot" {
key <FK23> {
type[Group1] = "CUSTOM_SHIFT_SUPER_ALTGR",
[ NoSymbol, Multi_key, dead_greek ]
};
};
// Place this in the `types` folder
default partial xkb_types "default" {
virtual_modifiers LevelThree, Super;
type "CUSTOM_SHIFT_SUPER_ALTGR" {
modifiers = Shift + LevelThree + Super;
map[None] = Level1;
map[Super + Shift] = Level2;
map[Super + Shift + LevelThree] = Level3;
level_name[Level1] = "Base";
level_name[Level2] = "Super";
level_name[Level3] = "Super AltGr";
};
};
// Place this in the `rules` folder
! include %S/evdev
! option = symbols
compose:copilot = +compose(copilot)
! option = types
compose:copilot = +custom
<!-- Place this in the `rules` folder -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd">
<xkbConfigRegistry version="1.1">
<optionList>
<group allowMultipleSelection="true">
<!-- Extend the options for the compose key -->
<configItem>
<name>Compose key</name>
</configItem>
<option>
<configItem>
<name>compose:copilot</name>
<description>Compose on Copilot, greek on AltGr+Copilot</description>
</configItem>
</option>
</group>
</optionList>
</xkbConfigRegistry>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment