dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

dwmblock-kbselect (662B)


      1 #!/bin/sh
      2 # works on any init system
      3 # requirements: dmenu, xorg-setxkbmap
      4 kb="$(setxkbmap -query | grep -oP 'layout:\s*\K\w+')" || exit 1
      5 
      6 case $BUTTON in
      7 	1) kb_choice="$(awk '/! layout/{flag=1; next} /! variant/{flag=0} flag {print $2, "- " $1}' /usr/share/X11/xkb/rules/base.lst | dmenu -l 15)"
      8 	[ -z "$kb_choice" ] && exit 0
      9 	kb="$(echo "$kb_choice" | awk '{print $3}')"
     10 	setxkbmap "$kb"
     11 	pkill -RTMIN+11 "${STATUSBAR:-dwmblocks}";;
     12 	3) notify-send "⌨  Keyboard/language module" "$(printf "%s" "\- Current layout: $(setxkbmap -query | grep -oP 'layout:\s*\K\w+')")
     13 - Left click to change keyboard.";;
     14 	6) "$TERMINAL" -e "$EDITOR" "$0" ;;
     15 esac
     16 
     17 echo "$kb"