Switch layout in GNOME Xfce Mate Cinnamon KDE

About programming and getting involved with Linux Mint development
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
FrolovRuslan1
Level 1
Level 1
Posts: 4
Joined: Sun Oct 08, 2023 5:08 pm

Switch layout in GNOME Xfce Mate Cinnamon KDE

Post by FrolovRuslan1 »

Hi everyone! Im developing an analogue PuntoSwitcher for Windows. My program is called OpenSwitcher and this is the github of the project https://github.com/pulkras/OpenSwitcher/tree/test .
My problem is that I need to automatically change the keyboard layout in the program, regardless of the desktop environment such GNOME, Plasma, KDE, Cinnamon, Mate, Xfce and another . I used such solution methods as dbus, ibus, gsettings, xmodmap and dconf. On KDE it turned out through dbus

Code: Select all

 qdbus org.kde.keyboard /Layouts org.kde.KeyboardLayouts.switchToNextLayout 
and an error occurred when using xmodmap in GNOME too. After running xmodmap it impossible to use key combination to change the layout. When using ibus the layout of the ibus keyboard changes, but the layout of the working enviroment does not change.
I want to find a simple platform-independent solution, but if it is not possible then using api c or dbus api. Thank you in advance for the answer.

If solution doesnt exist please tell me how I can get current key combination for switch layouts on different desktop environments.

System:
Debian x86_64
X11: GNOME, Plasma, Cinnamon, Mate, Xfce

P.S. Doesnt work:

Code: Select all

gsettings set org.gnome.desktop.input-sources current 1
https://github.com/linuxmint/Cinnamon/issues/7884
Last edited by LockBot on Mon Apr 08, 2024 10:00 pm, edited 3 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
billyswong
Level 8
Level 8
Posts: 2240
Joined: Wed Aug 14, 2019 1:02 am

Re: Switch layout in GNOME Xfce Mate Cinnamon KDE

Post by billyswong »

For the xmodmap problem, take a look at https://github.com/grwlf/xkb-switch
Use that program or incorporate its code.

For ibus, from my experience in using ibus In MATE, unless you uncheck "use system keyboard layout", selecting "traditional" keyboard layouts in ibus doesn't work as expected. For "traditional" keyboard layouts I mean those that are supported by xkb or built-in DE keyboard switching.
FrolovRuslan1
Level 1
Level 1
Posts: 4
Joined: Sun Oct 08, 2023 5:08 pm

Re: Switch layout in GNOME Xfce Mate Cinnamon KDE

Post by FrolovRuslan1 »

Thank you its works correctly !!! I dont know why xmodmap crash DE switching layout and how gnome read in runtime xkb states but it works ! I try to compile and use xkb-switch in my project
Locked

Return to “Programming & Development”