Created
September 16, 2017 00:01
-
-
Save y1n0/4409fdb8517b9bd4f1d3f8d1cf7d9569 to your computer and use it in GitHub Desktop.
A tweak to show a language indicator in i3wm's i3status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # You'll need to set a keybind to run this script | |
| # It will change the keyboard layout and create a file in `/tmp` | |
| # indicating the current layout lang. | |
| # Use the module `path_exists` of i3status to check | |
| # if the file (named here `currlang_ar`) is created | |
| layout=$(setxkbmap -query | grep layout | cut -d: -f2 | sed -e 's/^[[:space:]]*//') | |
| if [ $layout == 'us' ] ; then | |
| setxkbmap ar | |
| touch /tmp/currlang_ar | |
| else | |
| setxkbmap us | |
| rm -f /tmp/currlang_ar | |
| fi | |
| exit 0 |
I have output
us,ru,itfor any of the languages set as the current one.
I get current lang xkb-switch -p
@bos-s-man, Debian 10:
$ setxkbmap -query | grep layout
layout: us,ruDmitry the https://github.com/nonpop/xkblayout-state variant working well. xkblayout-state print "%s" will show you current layout
I ended up using this damn simple code: https://github.com/DmitryMyadzelets/xlayout
Though it's not a script. Seems one can't get the desired result with builtin tools.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have output
us,ru,itfor any of the languages set as the current one.