You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
670 B
26 lines
670 B
#!/bin/bash
|
|
## Author: Shaun Reed | Contact: shaunrd0@gmail.com | URL: www.shaunreed.com ##
|
|
## ##
|
|
## A script to track system idle time within a polybar menu ##
|
|
###############################################################################
|
|
# info-idle.sh
|
|
|
|
|
|
METRIC=sec
|
|
FORMAT=" %d $METRIC"
|
|
INTERVAL=2
|
|
|
|
case "$METRIC" in
|
|
min) DIVIDE_BY=$((1000 * 60)); ;;
|
|
sec) DIVIDE_BY=1000; ;;
|
|
msec) DIVIDE_BY=1 ;;
|
|
*) echo "Unsupported metric \"$METRIC\""; exit 1; ;;
|
|
esac
|
|
|
|
while true; do
|
|
VALUE=$(($(xprintidle)/ DIVIDE_BY))
|
|
printf "$FORMAT\\n" "$VALUE"
|
|
sleep $INTERVAL
|
|
done
|
|
|