sway config better and locking screen

master
Braydon Kains 1 year ago
parent 41df408336
commit 3ee805f855
No known key found for this signature in database
GPG Key ID: 1F801ECAABAAF78D

@ -15,6 +15,8 @@ set $up k
set $right l set $right l
# Your preferred terminal emulator # Your preferred terminal emulator
set $term foot set $term foot
# Locker
set $locker sway_manual_lock
# Your preferred application launcher # Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened # Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on. # on the original workspace that the command was run on.
@ -236,13 +238,13 @@ bindsym XF86AudioPlay exec playerctl play-pause
bindsym XF86AudioNext exec playerctl next bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioPrev exec playerctl previous bindsym XF86AudioPrev exec playerctl previous
# manually lock with mod+l
bindsym $mod+Ctrl+l exec $locker
# Turn off screen at 4 minutes, lock at 5 minutes. # Turn off screen at 4 minutes, lock at 5 minutes.
exec swayidle -w \ exec swayidle -w \
before-sleep 'playerctl pause' \
timeout 300 '$locker' \ timeout 300 '$locker' \
timeout 240 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \ timeout 15 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"'
before-sleep '$locker'
# manually lock with mod+l
bindsym $mod+x exec --no-startup-id $locker
include /etc/sway/config.d/* include /etc/sway/config.d/*

@ -0,0 +1,41 @@
#!/bin/sh
###
# way_lock
# Lock Wayland session
#
# Run-Depends
# x11/swayidle
# x11/swaylock
# {any /bin/sh capable of background execution}
#
# Note: swayidle implements KDE's idle protocol[1], so the compositor
# acting as a window manager must support it. Swayidle will not
# work as intended otherwise.
# [1] https://github.com/swaywm/sway/blob/57d6f6f19e3088dcb8e202acade8c39a80075b4a/protocols/idle.xml
###
# Number of seconds before screen turns off
timeout=10
# Turn screen off after $timeout seconds of inactivity.
# Turn it on again when there is activity.
#
# swayidle acts like a daemon, meaning it continues execution even after
# the script is terminated, so we need to execute it in the background
# to be able to terminate it later (unless you like your screen turning
# off every 10 seconds for some reason?)
swayidle \
timeout $timeout 'swaymsg output \* dpms off' \
resume 'swaymsg output \* dpms on' \
&
playerctl play-pause
# Lock the screen and wait for it to be unlocked.
swaylock -f -e -c 1d2021 --inside-color 000000b3 -s fill -i ~/.cache/lockscreen
# Screen unlocked: terminate swayidle and clean up PID
kill -TERM $!
wait

@ -1,3 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
ln -s $(pwd)/sway ~/.config ln -s $(pwd)/sway ~/.config
sudo ln -s sway_manual_lock /usr/bin

Loading…
Cancel
Save