keyd, Dvorak and Fcitx

2026-01-03

I managed to get keyd to toggle between Qwerty and Dvorak with ctrl-alt-space while having alt-space toggle between Fcitx input methods. This whole rabbit-hole started because I bought a Dell laptop that came with the infamous Copilot key which I wanted to remap back to right control.

I'm using the following /etc/keyd/default.conf file:

[ids]

*

include layouts/dvorak

[global]
default_layout = dvorak

[main]
capslock = esc
# Copilot key
# There is an implicit layer for control, which maps it to the C modifier.
# It's best to map to layer(control) rather than directly to a key.
leftshift+leftmeta = layer(control)

[control+alt+dvorak]
space = setlayout(main)

[control+alt+main]
space = setlayout(dvorak)

[alt+main]
# Toggle fcitx input methods.
# It's done here in keyd instead of fcitx, as fcitx will register alt-space
# even when ctrl-alt-space is pressed. This is triggered in both layouts, and
# I'm not sure how to have it trigger only in main. 
space = command(sudo -u k fcitx5-remote -t)
I removed the shortcut from fcitx itself for toggling input methods, as it is now handled by keyd. An issue with this setup is that I needed to configure my keyboard layout to Qwerty in the KDE settings, as otherwise, I experienced a mish-mash of keymaps at the login screen.