I’ve seen a battery program that would draw a bar on the top edge of screen as the battery life indicator. I was thinking if we could have a 1-by-1-pixel red dot on top-right corner like the HDD activity LED.
Of course, as usual, I lost interest, but I do have a working script. Just note that it doesn’t paint a red dot, but simply shows the indication in terminal, here is the script:
#!/bin/bash # Written by Yu-Jie Lin # Public Domain DISKSTATS=/proc/diskstats while sleep .125; do current="$(<$DISKSTATS)" if [[ $current != $last ]]; then xset led echo -ne '\e[2D\e[1;41m \e[0m' last="$current" else xset -led echo -ne '\e[2D ' fi done
I got the idea from this code, I didn’t port the code, just stealing the idea of its comments. It’s much simpler when you only check entire content of /proc/diskstats is changed.
Also, it uses the Scroll Lock LED via xset command, didn’t know you can control the LEDs until I found this answer. Now come to think about that LED, it finally has a purpose, I don’t even know how to use the Scroll Lock.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.