Compare commits
2 Commits
5201a35272
...
v1.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 71a3749079 | |||
| 661176befb |
14
README.md
14
README.md
@@ -32,11 +32,7 @@ This script aims to fix this.
|
|||||||
|
|
||||||
Adding a script to `notifyrc` as event makes it possible to change settings when screen-locking begins.
|
Adding a script to `notifyrc` as event makes it possible to change settings when screen-locking begins.
|
||||||
|
|
||||||
When the screen is locked, the script will change the screen-timeout to a custom-value in the config `~/.config/powermanagementprofilesrc` (or a default of 10s).
|
So after x seconds the screen will simply be forcefully turned off using `xset`.
|
||||||
|
|
||||||
This is done, so even after the System wakes up and activates the screens e.g. when mouse is moved, but no unlock is done, the screen begins to sleep quickly again.
|
|
||||||
|
|
||||||
After a successful unlock, the value from the config is reapplied.
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
@@ -44,10 +40,4 @@ After a successful unlock, the value from the config is reapplied.
|
|||||||
|
|
||||||
Place the file `event_screensaver` to a bin-location, for a local user this is typically `~/.local/bin/` and make it executeable.
|
Place the file `event_screensaver` to a bin-location, for a local user this is typically `~/.local/bin/` and make it executeable.
|
||||||
|
|
||||||
In Settings under `Notifications > Applications > Configure > 'Screen Saver' > Configure Events...` for event locked & unlocked, enable `Run command` and add your script-location for `event_screensaver` and the event triggered.
|
In Settings under `Notifications > Applications > Configure > 'Screen Saver' > Configure Events...` for event `Screen locked`, enable `Run command` and add your script-location for `event_screensaver`.
|
||||||
|
|
||||||
Example:
|
|
||||||
```
|
|
||||||
Screen locked
|
|
||||||
Run Command: ~/.local/bin/event_screenSaver locked
|
|
||||||
```
|
|
||||||
|
|||||||
@@ -1,25 +1,18 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
SCREENSAVER_TIMEOUT_DEFAULT=10
|
|
||||||
NORMAL_TIMEOUT_DEFAULT=1800
|
|
||||||
|
|
||||||
case "$1" in
|
is_screen_locked()
|
||||||
"locked")
|
{
|
||||||
# Read timeout from KDE
|
if dbus-send --session --dest=org.freedesktop.ScreenSaver --type=method_call --print-reply /org/freedesktop/ScreenSaver org.freedesktop.ScreenSaver.GetActive | grep 'boolean true' > /dev/null; then
|
||||||
SCREENSAVER_TIMEOUT=$(kreadconfig5 --file powermanagementprofilesrc --group AC --group DPMSControl --key idleTime_screenSaver)
|
return 0
|
||||||
TIMEOUT="${NORMAL_TIMEOUT:-$SCREENSAVER_TIMEOUT_DEFAULT}"
|
else
|
||||||
;;
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
"unlocked")
|
# Sleep to timeout
|
||||||
# Read timeout from KDE
|
sleep 15
|
||||||
NORMAL_TIMEOUT=$(kreadconfig5 --file powermanagementprofilesrc --group AC --group DPMSControl --key idleTime)
|
|
||||||
TIMEOUT="${NORMAL_TIMEOUT:-$NORMAL_TIMEOUT_DEFAULT}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
*)
|
if is_screen_locked; then
|
||||||
echo "$0 <locked|unlocked>"
|
# Disable screens
|
||||||
exit 1
|
xset dpms force off
|
||||||
;;
|
fi
|
||||||
esac
|
|
||||||
|
|
||||||
# Set timeout-value
|
|
||||||
xset s ${TIMEOUT} ${TIMEOUT}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user