Improve the lock screen command
Running a screensaver is a very important security feature. It is necessary that it always works and does not depend on the state of the user's directories, so the screensaver run-script should be placed in the system directory. However, the locking process remains customizable because the user script can be used too.
This commit is contained in:
parent
862b9dcb1b
commit
2be7224e32
4 changed files with 14 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"label": "Lock",
|
"label": "Lock",
|
||||||
"exec": "swaymsg exec ~/.config/swaylock/lock.sh",
|
"exec": "swaymsg exec /usr/share/sway/scripts/lock.sh",
|
||||||
"icon": "system-lock-screen"
|
"icon": "system-lock-screen"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
timeout 240 'light -G > /tmp/brightness && light -S 10' resume 'light -S $([ -f /tmp/brightness ] && cat /tmp/brightness || echo 100%)'
|
timeout 240 'light -G > /tmp/brightness && light -S 10' resume 'light -S $([ -f /tmp/brightness ] && cat /tmp/brightness || echo 100%)'
|
||||||
timeout 300 ~/.config/swaylock/lock.sh
|
timeout 300 '/usr/share/sway/scripts/lock.sh'
|
||||||
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'
|
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'
|
||||||
timeout 900 'systemctl suspend'
|
timeout 900 'systemctl suspend'
|
||||||
before-sleep 'playerctl pause'
|
before-sleep 'playerctl pause'
|
||||||
before-sleep ~/.config/swaylock/lock.sh
|
before-sleep '/usr/share/sway/scripts/lock.sh'
|
||||||
lock ~/.config/swaylock/lock.sh
|
lock '/usr/share/sway/scripts/lock.sh'
|
||||||
|
|
10
usr/share/sway/scripts/lock.sh
Executable file
10
usr/share/sway/scripts/lock.sh
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
USER_SCRIPT="$HOME/.config/swaylock/lock.sh"
|
||||||
|
GLOB_SCRIPT="/usr/share/sway/scripts/swaylock.sh"
|
||||||
|
|
||||||
|
if [[ -x "$USER_SCRIPT" ]]; then
|
||||||
|
"$USER_SCRIPT"
|
||||||
|
else
|
||||||
|
"$GLOB_SCRIPT"
|
||||||
|
fi
|
Loading…
Add table
Reference in a new issue