aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAicaya <17915907+Aicaya@users.noreply.github.com>2020-01-23 16:27:29 -0400
committerPhilipp Hemmelmayr <fips.hem@gmail.com>2020-01-23 21:27:29 +0100
commit7774266ee62dfffbe6582ed9c895a4ce7501ba24 (patch)
tree8695c28847b661eb83ddfa6ee4d941718678a36b
parent82d1a7280e882d124d8548ddd5f72f7cdc4f1757 (diff)
Restore previous DPMS setting if turned off (#151)
* Restore previous DPMS setting if turned off Added the variable 'default_dpms', which reads the last element of line 26 ("DPMS is Enabled/Disabled"). If it's disabled, it restores that setting upon login. This fixes an issue where if the user had manually turned off DPMS, the screen will still turn itself off after a while. * Look for string instead of line number (also use tabs for indents to match code)
-rwxr-xr-xbetterlockscreen4
1 files changed, 4 insertions, 0 deletions
diff --git a/betterlockscreen b/betterlockscreen
index d4ce078..9d2e07a 100755
--- a/betterlockscreen
+++ b/betterlockscreen
@@ -7,6 +7,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'))"
+default_dpms=$(xset q | awk '/^[[:blank:]]*DPMS is/ {print $(NF)}')
init_filenames() {
#$1 resolution
@@ -103,6 +104,9 @@ lock() {
postlock() {
if [ ! -z "$lock_timeout" ]; then
xset dpms "$default_timeout"
+ if [ "$default_dpms" = "Disabled" ]; then
+ xset -dpms
+ fi
fi
if [ ! -z "$(pidof dunst)" ] ; then
pkill -u "$USER" -USR2 dunst