Created
May 14, 2017 11:24
-
-
Save erfanio/eec67e1a538eeef3ff72562412030b6a to your computer and use it in GitHub Desktop.
xss-lock fading screen improved
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/bash | |
# adapted from xss-lock documantation | |
# https://bitbucket.org/raymonad/xss-lock/src/1e158fb20108058dbd62bd51d8e8c003c0a48717/doc/dim-screen.sh | |
# Brightness will be lowered to this value. | |
min_brightness=0 | |
# Set -time and -steps for fading | |
# to $min_brightness here. Setting steps to 1 disables fading. | |
fade_time=5000 | |
fade_steps=400 | |
############################################################################### | |
get_brightness() { | |
xbacklight -get | |
} | |
set_brightness() { | |
xbacklight -steps 1 -set $1 | |
} | |
fade_brightness() { | |
xbacklight -time $fade_time -steps $fade_steps -set $1 & | |
} | |
trap "exit 0" INT TERM | |
# kill background processes and set the brightness back to the original value | |
trap "kill \$(jobs -p); set_brightness $(get_brightness);" EXIT | |
fade_brightness $min_brightness | |
sleep 2147483647 & | |
wait |
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
xss-lock -n /path/to/dim-screen.sh -- xsecurelock auth_pam_x11 saver_blank |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment