Skip to content

Commit

Permalink
ENH: Add targets for swayidle, sway-session
Browse files Browse the repository at this point in the history
  • Loading branch information
HaoZeke committed Nov 10, 2024
1 parent 40224a4 commit 065350a
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
10 changes: 10 additions & 0 deletions dot_config/systemd/user/sway-session.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- systemd -*-
# Kanged from https://github.com/kuhy/.dotfiles/blob/master/system/systemd.org
# exec "systemctl --user import-environment; systemctl --user start sway-session.target"

[Unit]
Description=Sway compositor session
Documentation=man:systemd.special
BindsTo=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
23 changes: 23 additions & 0 deletions dot_config/systemd/user/swayidle.target
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- systemd -*-
# Kanged from https://github.com/kuhy/.dotfiles/blob/master/system/systemd.org
# scu-enable-now swayidle.target
[Unit]
Description=Idle manager for Wayland
Documentation=man:swayidle(1)
PartOf=graphical-session.target

[Service]
Type=simple
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. Also pauses media before locking.
# It will also lock your screen before your computer goes to sleep.
ExecStart=/usr/bin/swayidle -w \
timeout 300 'swaylock -f --clock --image ~/Pictures/Walls/lockscreen.png --daemonize' \
timeout 450 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
before-sleep 'playerctl pause' \
before-sleep 'swaylock -f --clock --image ~/Pictures/Walls/lockscreen.png --daemonize' \
idlehint 780

[Install]
WantedBy=sway-session.target

0 comments on commit 065350a

Please sign in to comment.