Compare commits

..

No commits in common. 'main' and 'release-1.0' have entirely different histories.

@ -1,30 +0,0 @@
DESTDIR=~/
KSMSERVER_NOTIFY_CONFIG_PATH=.config/ksmserver.notifyrc
SCRIPT_PATH=.local/bin/event_screensaver
.PHONY: install remove
default: install
install:
# Deploy script
cp -f ./event_screensaver ${DESTDIR}${SCRIPT_PATH}
# Make executeable
chmod +x ${DESTDIR}${SCRIPT_PATH}
# Deploy notifyrc-file
cp ./ksmserver.notifyrc ${DESTDIR}${KSMSERVER_NOTIFY_CONFIG_PATH}
# Reload kwin..
qdbus org.kde.KWin /KWin reconfigure
# Installed!
remove:
# Remove files..
rm ${DESTDIR}${SCRIPT_PATH} ${DESTDIR}${KSMSERVER_NOTIFY_CONFIG_PATH}
# Reload kwin..
qdbus org.kde.KWin /KWin reconfigure
# Removed!

@ -10,9 +10,7 @@ Table of contents
<!-- TOC --> <!-- TOC -->
- [1. The Problem](#1-the-problem) - [1. The Problem](#1-the-problem)
- [2. The Fix](#2-the-fix) - [2. The Fix](#2-the-fix)
- [3. How to install/remove](#3-how-to-installremove) - [3. How to install](#3-how-to-install)
- [3.1. Automatically](#31-automatically)
- [3.2. Manually](#32-manually)
<!-- /TOC --> <!-- /TOC -->
<br> <br>
@ -34,49 +32,12 @@ 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>
# 3. How to install/remove # 3. How to install
## 3.1. Automatically
### 3.1.1. Install
Run the Makefile with `install`.
```sh
make install
```
### 3.1.2. Remove
Run the Makefile with `remove`.
```sh
make remove
```
<br>
## 3.2. Manually
### 3.2.1. Install
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
```
Or update/create the config-file directly under `~/.config/ksmserver.notifyrc` similary to the file found in this repository.
Then restart or reload KWin.

@ -1,25 +1,7 @@
#!/bin/sh #!/bin/sh
SCREENSAVER_TIMEOUT_DEFAULT=10
NORMAL_TIMEOUT_DEFAULT=1800
case "$1" in # Sleep to timeout
"locked") sleep 15
# Read timeout from KDE
SCREENSAVER_TIMEOUT=$(kreadconfig5 --file powermanagementprofilesrc --group AC --group DPMSControl --key idleTime_screenSaver)
TIMEOUT="${SCREENSAVER_TIMEOUT:-$SCREENSAVER_TIMEOUT_DEFAULT}"
;;
"unlocked") # Disable screens
# Read timeout from KDE xset dpms force off
NORMAL_TIMEOUT=$(kreadconfig5 --file powermanagementprofilesrc --group AC --group DPMSControl --key idleTime)
TIMEOUT="${NORMAL_TIMEOUT:-$NORMAL_TIMEOUT_DEFAULT}"
;;
*)
echo "$0 <locked|unlocked>"
exit 1
;;
esac
# Set timeout-value
xset s ${TIMEOUT} ${TIMEOUT}

@ -1,13 +0,0 @@
[Event/locked]
Action=Execute
Execute=~/.local/bin/event_screensaver locked
Logfile=
Sound=
TTS=
[Event/unlocked]
Action=Execute
Execute=~/.local/bin/event_screensaver unlocked
Logfile=
Sound=
TTS=
Loading…
Cancel
Save