sergei-mironov / xkb-switch

Switch your X keyboard layouts from the command line
MIT License
345 stars 37 forks source link

How to send switch layout? #27

Closed Mladia closed 5 years ago

Mladia commented 5 years ago

I have some question to the usage Firstly I set my keyboard layouts through setxkbmap setxkbmap -layout 'us,de,bg' -variant ' , ,phonetic' setxkbmap -option 'grp:alt_caps_toggle'

Than I call xkb-switch -s "de( )"

and I can write switch and I can switch between us and bg. When I want, I can quickly call xkb-switch -s "de( )" and get it. This is clear. Is it possible to bind some script to a key, so I can can switch between en and bg without opening a terminal? It there a better way, than running the xkb-group.sh, finding it's pid and writing to stdin?

sergei-mironov commented 5 years ago

Hi, Mladia. Popular desktop environments, like KDE, usually allow users to bind keyboard combinations to custom commands. What desktop environment do you use?

zvezdochiot commented 5 years ago

xbindkeys?

Mladia commented 5 years ago

Hi, I have not problem binding the script!

I am now having the following problem

xkb-switch on master [$] 
 ✘130 ➜ setxkbmap -layout 'us,de,bg' -variant ' , ,phonetic'

xkb-switch on master [$] 
 ➜ xkb-switch
us( )

xkb-switch on master [$] 
 ➜ echo "switch" | ./xkb-group.sh "us( )" "bg(phonetic)"

xkb-switch on master [$] 
 ➜ xkb-switch                                           
bg(phonetic)

xkb-switch on master [$] 
 ➜ echo "switch" | ./xkb-group.sh "us( )" "bg(phonetic)"
xkb-switch: Invalid argument: )
xkb-switch: layouts: []

I can switch from en to bg, but not back around, when I use the same command. Is xkb-group.sh meant to only work in one direction?

sergei-mironov commented 5 years ago

Could you please try xkb-group.sh from master?

Mladia commented 5 years ago

Hallo, I am not using the tool anymore. My last comment had a minimal scenario, which triggered the problem. You can run the commands and see if the expected behavior is there and close the issue.

sergei-mironov commented 5 years ago

OK, For me it looks like it should work now, so I'm closing the issue