Start swayidle as systemd user service

This commit is contained in:
Aleksey Samoilov 2023-09-16 17:44:16 +04:00
parent d478f3a656
commit b077163acf
4 changed files with 18 additions and 16 deletions

View file

@ -62,9 +62,6 @@ nwg-drawer -r & disown
# Screenshot notification # Screenshot notification
riverctl spawn /usr/share/river/scripts/screenshot-notify.sh & disown riverctl spawn /usr/share/river/scripts/screenshot-notify.sh & disown
# Lock screen daemon
riverctl spawn $HOME/.config/river/screenlock.sh
# Set background and border color # Set background and border color
riverctl background-color 0x002b36 riverctl background-color 0x002b36
riverctl border-color-focused 0x8aadf4 riverctl border-color-focused 0x8aadf4

View file

@ -1,13 +0,0 @@
#!/bin/bash
lock="~/.config/swaylock/lock.sh"
pkill swayidle
sleep 1s
exec swayidle -w \
timeout 240 'light -G > /tmp/brightness && light -S 10' resume 'light -S $([ -f /tmp/brightness ] && cat /tmp/brightness || echo 100%)' \
timeout 300 $lock \
before-sleep 'playerctl pause' \
before-sleep $lock \
lock $lock & disown

View file

@ -0,0 +1,6 @@
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 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"'
before-sleep 'playerctl pause'
before-sleep ~/.config/swaylock/lock.sh
lock ~/.config/swaylock/lock.sh

View file

@ -0,0 +1,12 @@
[Unit]
Description=Idle manager for Wayland
Documentation=man:swayidle(1)
PartOf=graphical-session.target
ConditionPathExists=/usr/bin/swayidle
[Service]
Type=simple
ExecStart=/usr/bin/swayidle
[Install]
WantedBy=sway-session.target