Open edgar-vincent opened 5 months ago
I was told keyboard layout settings should work, so I looked into this issue.
The problem is, that the xkb-data crate used by cosmic-settings, checks a hard coded path for the base.xml that lists available keyboard layouts. The hard coded path is /usr/share/X11/xkb/rules/base.xml
which is not nixos compatible.
A very hacky workaround to fix this would be the following:
sudo mkdir -p /usr/share/X11/xkb/rules/
sudo ln -s "$(nix-build --no-out-link '<nixpkgs>' -A xkeyboard_config)/share/X11/xkb/rules/base.xml" /usr/share/X11/xkb/rules/base.xml
After running this the input source options work for me, but don't use this as a permanent solution.
I prepared a patch for xkb-data to make the base.xml path configurable via an environment variable. https://github.com/man0lis/xkb-data/commit/47c87c4b19815c7fa965aaa138443c76b8a2de86
If there are no objections, I will open a pull request.
EDIT: opened PR https://github.com/pop-os/xkb-data/pull/3
EDIT2: I'm currently using this in my configuration.nix to work around the problem:
systemd.tmpfiles.rules = [
"L /usr/share/X11/xkb/rules/base.xml - - - - ${pkgs.xkeyboard_config}/share/X11/xkb/rules/base.xml"
];
EDIT3: updated the xkb-data PR to reflect recent changes
I was wondering whether it was a hard coded path somewhere. Thanks a lot for looking into this and for the patch, @man0lis!
Meanwhile, something like this also works:
# ~/.config/cosmic/com.system76.CosmicComp/v1/
(
rules: "",
model: "",
layout: "fr",
variant: "oss",
options: Some(",compose:rctrl,caps:escape"),
)
This issue also affects cosmic-greeter. The keyboard layout selection on the loginscreen does not work.
anyone figured out how to set a keyboard shortcut to switch input sources?
https://github.com/pop-os/xkb-data/pull/3 got merged and version 0.2.1 of xkb-data with the patch was released. We can now add a wrapper for the affected binaries which correctly sets X11_BASE_RULES_XML
and X11_EXTRA_RULES_XML
environment variables. (or set them globally, not sure about that one). With that, as soon as cosmic-settings and cosmic-greeter start using the new version of xkb-data, the problems should be gone.
anyone figured out how to set a keyboard shortcut to switch input sources?
@onsails, If you edit ~/.config/cosmic/com.system76.CosmicComp/v1/xkb_config
manually, you can use something like this:
(
rules: "",
model: "pc104",
layout: "us,ru",
variant: "",
options: Some("terminate:ctrl_alt_bksp,grp:alt_shift_toggle"),
repeat_delay: 600,
repeat_rate: 25,
)
The key lines here are layout (put codes for your layouts of choice), and "grp" in options. My example is for Alt+Shift key combination, there is also an option for Win+Space, grp:win_space_toggle
, and grp:caps_toggle
for using CapsLock key.
The problem is now fixed for cosmic-settings. cosmic-greeter, cosmic-applet-input-sources and cosmic-applet-tiling still use version 0.1 of xkb-data and should start working as soon as upstream bumps them to 0.2.1 or higher.
In cosmic-settings, clicking on
Add input source
in theInput Devices
section yields the following error:I presume that this is not expected, since support for keyboard layout configuration seems to have been implemented, but I may be wrong.
Thanks!