Skip to content

Instantly share code, notes, and snippets.

@sixtyfive
Created November 21, 2016 19:59
Show Gist options
  • Save sixtyfive/211ccd5e980fd98bff9111ded4ff1b07 to your computer and use it in GitHub Desktop.
Save sixtyfive/211ccd5e980fd98bff9111ded4ff1b07 to your computer and use it in GitHub Desktop.
New i3blocks block for displaying current keyboard layout
#!/bin/bash
#
# Save as /usr/share/i3blocks/kb_layout, then use it by
# adding something like this to your i3blocks configuration:
#
# [kb_layout]
# interval=3
KB_LANG=$(setxkbmap -query | grep layout | cut -d ':' -f 2)
KB_LANG=${KB_LANG//[[:space:]]/}
echo $KB_LANG
@AntonGitName
Copy link

In my case setxkbmap -query returns all layouts installed not the current one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment