Created
November 15, 2015 00:50
-
-
Save dowglaz/b61ad204f7ec9c407527 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Esse aqui vai no /usr/local/bin mas eu fiz um symlink na vdd.