bbidulock / icewm

A window manager designed for speed, usability, and consistency
Other
577 stars 98 forks source link

How to set shortcut to change keyboard layout in preferences using KeyboardLayouts #622

Closed elderkeltir closed 2 years ago

elderkeltir commented 2 years ago

Hello!

I read in man page that there is cool option in preferences file: KeyboardLayouts. It can be used to list desired keyboard layouts and there will be some applet displayed on the taskbar and LMB click will cycle through the layouts list. This is great, but how and where can I pass my shortcut to switch layout from keyboard? using plane setxkbmap I would use the following command: setxkbmap -option grp:win_space_toggle us,fr & is this achievable using KeyboardLayouts?

Thanks in advance!

gijsbers commented 2 years ago

https://ice-wm.org/man/icewm-keys https://ice-wm.org/manual/

elderkeltir commented 2 years ago

I found a single clue through the text: If it is enclosed in double quotes, it can also be a space-separated list of command-line arguments to an invocation of the setxkbmap program. Sadly I can't manage to interpret it into preference file :-(

gijsbers commented 2 years ago

Did you read https://ice-wm.org/man/icewm-keys? It explains how to define a keyboard shortcut.

elderkeltir commented 2 years ago

ye but if i change layout, say, by setxkbmap fr it will not be reflected in applet on the taskbar. I wanted to find the way switching layouts from keyboard shortcut while having applet display the correct information about the current layout. sorry, that I wasn't clear from the start.

gijsbers commented 2 years ago

All your wishes have been fulfilled. You can test it, if you compile and install from this repository.