Created
October 12, 2016 14:41
-
-
Save noscript/7ec99f32f14761b41b5c4d6965aa9a28 to your computer and use it in GitHub Desktop.
Fading out notifier for screen saver
This file contains hidden or 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/bash | |
SEC=10 | |
[ $# -eq 1 ] && SEC=$1 | |
FRAMES=100 | |
SLEEP=`echo $SEC / $FRAMES | bc -l` | |
trap "xcalib -clear" EXIT | |
sleep 0.1 | |
LAST_IDLE=`xprintidle` | |
for (( i = 1; i <= $FRAMES; i++ )); do | |
NEW_IDLE=`xprintidle` | |
if [ $LAST_IDLE -gt $NEW_IDLE ]; then | |
exit 0 | |
fi | |
LAST_IDLE=$NEW_IDLE | |
xcalib -co 95 -a | |
sleep $SLEEP | |
done | |
xset dpms force off |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment