aboutsummaryrefslogtreecommitdiff
path: root/betterlockscreen
diff options
context:
space:
mode:
authorVivek R <123vivekr@gmail.com>2019-05-28 23:18:22 +0530
committerPavan Jadhaw <pavanjadhaw96@gmail.com>2019-05-28 23:18:22 +0530
commit643ea70aa77686ebe84889943a258b890dffe2fb (patch)
treeea068501c69402d7f539496f87bd375b7786d2ae /betterlockscreen
parent3f5fd23839555899ee872092e2c339a7b919866c (diff)
Add Timeout Option (#119)
This adds an opton to set custom monitor timeout in seconds. Timeout only applicable during lockscreen. Reverts back to normal timeout after logging back in. Closes https://github.com/pavanjadhaw/betterlockscreen/issues/116
Diffstat (limited to 'betterlockscreen')
-rwxr-xr-xbetterlockscreen18
1 files changed, 18 insertions, 0 deletions
diff --git a/betterlockscreen b/betterlockscreen
index 8f98f7f..8177415 100755
--- a/betterlockscreen
+++ b/betterlockscreen
@@ -6,6 +6,7 @@
# find your resolution so images can be resized to match your screen resolution
res=$(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/')
+default_timeout=`cut -d ' ' -f4 <<< $(xset q | sed -n '25p')`
init_filenames() {
#$1 resolution
@@ -70,6 +71,9 @@ init_filenames $res
prelock() {
+ if [ -n lock_timeout ]; then
+ xset dpms $lock_timeout
+ fi
if [ ! -z "$(pidof dunst)" ]; then
pkill -u "$USER" -USR1 dunst
fi
@@ -96,6 +100,9 @@ lock() {
postlock() {
+ if [ -n lock_timeout ]; then
+ xset dpms $default_timeout
+ fi
if [ ! -z "$(pidof dunst)" ] ; then
pkill -u "$USER" -USR2 dunst
fi
@@ -375,6 +382,12 @@ usage() {
echo ' to set custom lockscreen text (max 31 chars)'
echo " E.g: betterlockscreen -l dim -t \"Don't touch my machine!\""
echo ' E.g: betterlockscreen --text "Hi, user!" -s blur'
+ echo
+ echo
+ echo ' --off <timeout>'
+ echo ' to set custom monitor turn off timeout for lockscreen'
+ echo ' timeout is in seconds'
+ echo ' E.g: betterlockscreen -l dim --off 5'
}
@@ -416,6 +429,11 @@ for arg in "$@"; do
shift 2
;;
+ --off)
+ lock_timeout="$2"
+ shift 2
+ ;;
+
-r | --resolution)
res="$2"
init_filenames $res force