Sample Header Ad - 728x90

How do I run a script when I switch between keyboard layouts

8 votes
3 answers
2480 views
I use more than one keyboard layout, and I would like to find a way to run a script when I switch between them. Is this possible? So far, I can assign a shortcut for a script like this: #!/bin/bash #switch between two layouts (English and Greek in this case) current_layouts=$(gsettings get org.gnome.libgnomekbd.keyboard layouts) if [ "$current_layouts" = "us" ]; then gsettings set org.gnome.libgnomekbd.keyboard layouts "['gr']" else gsettings set org.gnome.libgnomekbd.keyboard layouts "['us']" fi exec /path/to/another/script But using this method, I can use only that shortcut to switch between layouts and the keyboard indicator will disappear from the status menu, what is unpleasantly.
Asked by Radu Rădeanu (1813 rep)
Oct 9, 2013, 03:21 PM
Last activity: May 6, 2020, 07:05 PM