Compare commits

...

18 Commits
v1.0.0 ... main

Author SHA1 Message Date
2e069fc517 Merge branch 'release-1.2' 2022-07-31 13:17:45 +02:00
e9c683a4a1 Fix broken path when using Destdir 2022-07-31 13:17:24 +02:00
a9a137c6ca Merge branch 'release-1.2' 2022-07-31 13:03:54 +02:00
a5d74e505d Merge branch 'dev' into release-1.2 2022-07-31 13:03:46 +02:00
b0fc7947d0 Add optional Destdir-variable 2022-07-31 13:03:36 +02:00
d69ed51dc0 Merge branch 'release-1.2' 2022-07-31 12:58:49 +02:00
c239556ad6 Merge branch 'dev' into release-1.2 2022-07-31 12:58:35 +02:00
93bf628ca5 Merge branch 'release-1.2' into dev 2022-07-31 12:58:01 +02:00
612f81285c Merge branch 'release-1.2' 2022-07-31 12:56:55 +02:00
a8f6998e3c Fix using wrong variable 2022-07-31 12:54:35 +02:00
5d50c6a747 Update install/remove instructions 2022-07-31 12:51:31 +02:00
273b026014 Create Makefile for install&remove 2022-07-31 12:51:14 +02:00
bea92a5da4 Add event-file 2022-07-31 12:50:57 +02:00
f21d019f50 Merge branch 'release-1.2' 2022-07-30 17:32:15 +02:00
5201a35272 Update description and install instructions 2022-07-30 17:32:00 +02:00
6d54498b39 Reimplement script to temp change the timeout when locked
Script now changes the screen timeout when the screen is locked and restores the values after unlocking from the config-file.
2022-07-30 17:25:43 +02:00
71a3749079 Merge branch 'release-1.1' 2022-07-30 17:22:40 +02:00
a8cc54391c Add check if screen is still locked after timeout 2022-07-30 17:21:46 +02:00
4 changed files with 108 additions and 8 deletions

30
Makefile Normal file
View File

@ -0,0 +1,30 @@
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!

View File

@ -10,7 +10,9 @@ Table of contents
<!-- TOC -->
- [1. The Problem](#1-the-problem)
- [2. The Fix](#2-the-fix)
- [3. How to install](#3-how-to-install)
- [3. How to install/remove](#3-how-to-installremove)
- [3.1. Automatically](#31-automatically)
- [3.2. Manually](#32-manually)
<!-- /TOC -->
<br>
@ -32,12 +34,49 @@ This script aims to fix this.
Adding a script to `notifyrc` as event makes it possible to change settings when screen-locking begins.
So after x seconds the screen will simply be forcefully turned off using `xset`.
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).
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>
# 3. How to install
# 3. How to install/remove
## 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.
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`.
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.
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.

View File

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

13
ksmserver.notifyrc Normal file
View File

@ -0,0 +1,13 @@
[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=