Skip to content

Instantly share code, notes, and snippets.

@duganchen
Last active May 14, 2018 12:05
Show Gist options
  • Save duganchen/5270c463a06b72e7088f09a655f15b1f to your computer and use it in GitHub Desktop.
Save duganchen/5270c463a06b72e7088f09a655f15b1f to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# Keyboard LED indicator for embedding into things like tint2, xmobar and dzen2.
# The order is Caps Lock, Num Lock, Scroll Lock
xset q | grep Caps | tr -s ' ' | cut -d ' ' -f 5,9,13 | sed 's/on/▣/g' | sed 's/off/▢/g'
# Or alternately:
# xset q | awk '/Caps/ {gsub("off", "▢"); gsub("on", "▣") ; print $4 " " $8 " " $12}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment