#!/bin/bash panel_fifo="/tmp/i3_lemonbar1_${USER}" panel_commands="/tmp/i3_lemonbar2_${USER}" function show(){ setxkbmap -print -display :0 | grep xkb_symbols | awk '{print $4}' | awk -F"+" '{print $2}' } if [ $# -lt 1 ]; then echo LANG$(show) fi if [ "$1" == "next" ]; then cur=$(show) next='se' if [ "$cur" == "se" ]; then next='pl' fi setxkbmap -display :0 $next if [ -e $panel_fifo ]; then echo -e "LANG$next\n" > "${panel_fifo}" fi if [ -e $panel_commands ]; then echo -e "setlang $next\n" > "${panel_commands}" fi elif [ "$1" == "qset" ]; then next=$2 setxkbmap -display :0 $next if [ -e $panel_fifo ]; then echo -e "LANG$next\n" > "${panel_fifo}" fi elif [ "$1" == "show" ]; then show else exit 1 fi