M. Yas. Davoodeh e4c933aa03 Add keyboard layout related scripts
`kblayoutmanager` switches layouts.
Layouts are read from `$KBLAYOUTS`.
An extra file, `~/.local/bin/statusbar/lang` is added in the commit,
which adds layout indicator to i3blocks.

Example binds are `Super+Alt+Space` added to both i3/config and
sxhkd/config.
Example `KBLAYOUTS` are US Standard Layout and Global UK layout.

Special thanks to KEZ-
2020-05-14 19:23:57 +04:30

11 lines
389 B
Bash
Executable File

#!/bin/sh
# A simple module to print current keyboard layout
lang="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')"
# Since shortcuts are unlikely to work with non-latin/US keyboard layouts,
# the line below makes US layout green to help you recognize anything else easier
[ "$lang" = "us" ] && color="#00ff00" || color="#ff0000"
printf "<span color='%s'>%s</span>\n" "$color" "$lang"