Modify the behaviour of fcitx5

I installed fcitx5 on my Xfce desktop environment. Now, I can type in all the languages I use, but I’m wondering if I can modify the behaviour of fcitx5.

The current behaviour (default, I guess):

  1. I can only switch between languages when a text box (e.g. browser search bar) is active.
  2. Suppose English is default, and I have installed input methods for languages A, B, and C, when a text box is active:
  • <super+space> switches to language A,
  • <super+space> again switches back to English,
  • say language B is currently chosen, to switch to language C, I must press <super+space+space+space+space>, where it cycles through English → A → B → C.

I find this behaviour rather inconvenient, can I modify it to something like this:

  1. switch between languages anywhere.
  2. cycle through languages in a continuous manner, i.e.
  • <super+space> always switches to the next language,
  • <super+space+space+…> cycles through languages, starting from the next language.

Thank you in advance!

Hello @Kaede,
I do not really feel the necessity of fcitx5 (perhaps some East-Asian layout is used).
Nevertheless I made an experiment using from AUR a package named
xkblayout-state-git

hopoff.sh
#!/bin/bash
xkblayout-state print "%c" > ~/.kblayout.txt   ## numeric value of kb layout 0..
echo >> ~/.kblayout.txt       ##crlf
hopon.sh
#!/bin/bash
KBLN=$(<~/.kblayout.txt)
xkblayout-state set "$KBLN"

The first tiny script puts the keyboard layout down at logout
and the second one picks it up at login time.

Optional Keyboard Application Shortcut to ‘toggle’ :
1687131182
This +1 can be an absolute value starting from 0 up to the layouts-1

Hello @eso ,
Thank you for your reply! I use quite a few Asian languages, so an input method manager is necessary for me :slight_smile: .
Regarding your kind suggestion, I actually use the same keyboard layout – en_US – to type all the languages (Japanese, Chinese_TW, Chinese_CN, and Korean), so I’m afraid the package you suggested may not help me here…
I also tried Ibus, at first it seemed better as it provided a somewhat more continuous cycling behaviour, until I realised its chewing input method (Chinese_TW) is buggy.
I’m getting used to the cycling behaviour of fcitx5 though, although I really wish I could switch languages even when my cursor is not in a text box, which is so much more convenient.

After toggling off “Enumerate when press[ing] trigger key repeatedly”, I have continuous cycling now. It’s left to figure out how to switch languages anywhere…

Morning @Kaede ,
As long as ‘Keyboard Layouts’ are reflected in the Panel the method above could work.
I’m ready to test it with fcitx5 although I have to figure out this fcitx5. Earlier I used ibus-mozc for Japanese but not under XFCE.
This 2 scripts do not make a mess. chmod +x is needed for them to make them runable.
Edit: There are two directions. It has a limited benefit to preserve the last keyboard layout during log-out and log-in.
I hope password is accepted in system keyboard layout. I’ll verify in a minute.
Or do not use special or ‘moving’ characters.
The original goal to move along A B C D languages more freely as far I understand.
Edit2:
yay -S ibus-mozc ## It takes a while but installation is OK
ibus-setup
in startup: ibus-daemon -dr

If you want Hiragana input instead of Direct in JP

in .config/mozc/ibus_config.textproto
#engines {

name : “mozc-off”

longname : “Mozc:A_”

layout : “default”

layout_variant : “”

layout_option : “”

rank : 99

symbol : “A”

composition_mode : Active

#}
active_on_launch: True

ibus stores the last keyboard layout. Log-out log-in is transparent, so there is no need for those hopoff / hopon scripts above. Ibus is ‘stronger’ than XFCE Keyboard Layout settings as I see it.
xkblayout-state print "Current layout: %s(%e)"
shows the current layout, but
kblayout-state set +1
does not skip to the next layout for me. So why aur/xkblayout-state-git?

It looks like this

Edit3: I tried some subset of fcitx5 and if duplicate shortcuts are eliminated it seems to work.
Super+Space is the XFCE whisker? menu etc.
Too complicated for me. It needs a strategy to select the keyboard shortcuts.