Skip to content

Instantly share code, notes, and snippets.

@noscript
Created October 12, 2016 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noscript/7ec99f32f14761b41b5c4d6965aa9a28 to your computer and use it in GitHub Desktop.
Save noscript/7ec99f32f14761b41b5c4d6965aa9a28 to your computer and use it in GitHub Desktop.
Fading out notifier for screen saver
#!/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