Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage xkb options in addition to layout and variant #705

Open
danielzgtg opened this issue Jan 29, 2023 · 0 comments · May be fixed by #712
Open

Manage xkb options in addition to layout and variant #705

danielzgtg opened this issue Jan 29, 2023 · 0 comments · May be fixed by #712

Comments

@danielzgtg
Copy link

Describe the feature

I want fcitx5 to update the xkb options when switching groups. It properly switches the xkb layout and variant, but xkb options is right next to them and is neglected by fcitx5.

It is surprising that things were working when fcitx5 did not connect to Wayland and I managed layouts using KDE's keyboard layout switcher in plasmashell. I had "lv3:ralt_switch_multikey" enabled for my us layout, and French accents were working. In my custom jp symbols file, I tried to undo the lv3 ralt so that my Henkan would work, and it did work for some reason. There might have been cases where my keyboard would be weird if I logged out without switching back to the us layout, but that would require me to go debug. The setxkbmap -v 10 behavior is different between KDE's control and fcitx5's control. With KDE, it is strange that the setxkbmap does not change when switching layouts, while in fcitx5 the setxkbmap updates to display the current layout. That might have been why it was working for me before. An alternative solution would be to tell me how to get a layout variant file to have precedence over and override the level3 file. However, I think the proper way would be to complete fcitx5 to manage the xkb options.

To Reproduce
Steps to reproduce the behavior:

  1. Have a us layout where I want Options=lv3:ralt_switch_multikey so that RALT lets me type French accents
  2. Have a custom jp layout where I want Options= (empty options) so that RALT becomes Henkan (I don't like space or arrow keys, and it was working before fcitx) so that I can choose words
  3. Observe that there is no way to get fcitx5 to change the xkb options to automatically support my setup.

Expected behavior

I should be able to configure the xkb options for each input group. It should support setting the options to empty. It should support options like "lv3:ralt_switch_multikey", but it should support other users' options as well and not hardcode this. Whenever fcitx5 switches to a new xkb layout and variant, it should ensure that the newly configurable xkb options are switched as well.

Analysis

Options=something should be written by fcitx5, possible somewhere here:

readAsIni(config, StandardPath::Type::Config, "kxkbrc");
config.setValueByPath("Layout/LayoutList", layoutAndVariant.first);
config.setValueByPath("Layout/VariantList",
layoutAndVariant.second);
config.setValueByPath("Layout/DisplayNames", "");
config.setValueByPath("Layout/Use", "true");
safeSaveAsIni(config, StandardPath::Type::Config, "kxkbrc");

New keys should be added to ~/.config/fcitx5/profile. "Default Layout Options" should be added next to "Default Layout" under "Groups/0". "Layout Options" should be added next to "Groups/0/Items/0". The options written to kxkbrc should match the values for these keys, including writing an empty value there for empty values here.

There does not need to be a config GUI in the first version. This is an advanced feature, and advanced users are fine editing the file. "System Settings > Input Devices > Keyboard > Advanced > Key to choose the 3rd level" is a somewhat complicated GUI to implement, so I was thinking some time and effort could be saved by leaving out the config GUI.

Desktop (please complete the following information):

This is a continuation of #704.

@danielzgtg danielzgtg linked a pull request Feb 5, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant