Skip to content

Instantly share code, notes, and snippets.

@dowglaz
Created November 15, 2015 00:50
Show Gist options
  • Save dowglaz/b61ad204f7ec9c407527 to your computer and use it in GitHub Desktop.
Save dowglaz/b61ad204f7ec9c407527 to your computer and use it in GitHub Desktop.
#!/bin/sh
output () {
led_mask=`xset q | grep LED | cut -d: -f4`
caps_lock=$(( led_mask & 1))
num_lock=$(( led_mask & 2))
scroll_lock=$(( led_mask & 4))
declare -A output
if [[ caps_lock -eq 1 ]]; then
output[caps]="C"
else
output[caps]="-"
fi
if [[ num_lock -eq 2 ]]; then
output[num]="N"
else
output[num]="-"
fi
if [[ scroll_lock -eq 4 ]]; then
output[scroll]="S"
else
output[scroll]="-"
fi
echo -n "[{ \"full_text\": \"${output[@]}\" }"
}
i3status_first_output (){
read line
echo ", `echo $line | sed \"s/^\[//\"`"
}
i3status_output (){
read line
echo ", `echo $line | sed \"s/^,\[//\"`"
}
read_first_two_lines () {
read line && echo $line && read line && echo $line
}
i3status | (read_first_two_lines && output && i3status_first_output && while :
do
echo -n ", "
output
i3status_output || exit 1
done)
@dowglaz
Copy link
Author

dowglaz commented Nov 15, 2015

Esse aqui vai no /usr/local/bin mas eu fiz um symlink na vdd.

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