commit 82e29ee496aeac4d13be9d02b26ad20cc6d6d42d
parent b1be779917bedeb60975518ff793e071863c0479
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Mon, 30 Mar 2026 19:45:27 +0200
feat add swaylock config
Diffstat:
3 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/sway/config b/sway/config
@@ -42,10 +42,10 @@ output * bg ~/Bilder/Wallpaper/Sway_Wallpaper_purple_2048x1536.png fill
# Example configuration:
#
exec swayidle -w \
- timeout 180 '~/.config/sway/swaylock_helper.sh on & swaylock -f && ~/.config/sway/swaylock_helper.sh off' \
+ timeout 180 '~/.config/swaylock/swaylock_helper.sh on & swaylock -f && ~/.config/swaylock/swaylock_helper.sh off' \
timeout 185 'swaymsg "output * dpms off"' \
resume 'swaymsg "output * dpms on"' \
- before-sleep '~/.config/sway/swaylock_helper.sh on & swaylock -f && ~/.config/sway/swaylock_helper.sh off'
+ before-sleep '~/.config/swaylock/swaylock_helper.sh on & swaylock -f && ~/.config/swaylock/swaylock_helper.sh off'
# 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
@@ -88,7 +88,7 @@ input "type:touchpad" {
bindsym --no-repeat $mod+d exec $menu
# Lock session
- bindsym --no-repeat $mod+l exec ~/.config/sway/swaylock_helper.sh "on" & swaylock -f && ~/.config/sway/swaylock_helper.sh "off"
+ bindsym --no-repeat $mod+l exec ~/.config/swaylock/swaylock_helper.sh "on" & swaylock -f && ~/.config/swaylock/swaylock_helper.sh "off"
bindsym --no-repeat $mod+Shift+l exec wlogout
# Drag floating windows by holding down $mod and left mouse button.
@@ -274,9 +274,6 @@ default_border pixel
## Autostart
#
-# Lockscreen helper
-# exec ~/.local/bin/swaylock_daemon.sh
-
# Sway Workspace indicator
exec rm -r /tmp/swayworkspace && mkfifo /tmp/swayworkspace
diff --git a/swaylock/config b/swaylock/config
@@ -0,0 +1,2 @@
+image=~/Bilder/Wallpaper/01.png
+hide-keyboard-layout
diff --git a/swaylock/swaylock_helper.sh b/swaylock/swaylock_helper.sh
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+if [[ "$1" == "on" ]]; then
+
+ # set notification to DND
+ makoctl mode | tee /tmp/mako_mode_pre_lock > /dev/null
+ makoctl mode -s away > /dev/null &
+
+ # mute sound
+ pactl get-sink-mute @DEFAULT_SINK@ | tee /tmp/pactl_mode_pre_lock > /dev/null
+ pactl set-sink-mute @DEFAULT_SINK@ 1 > /dev/null &
+
+ # mute microphone (do not recover)
+ pactl set-sink-mute @DEFAULT_SINK@ 1 &
+
+elif [[ "$1" == "off" ]]; then
+
+ # recover notification state
+ makoctl mode -s $(cat /tmp/mako_mode_pre_lock) > /dev/null &
+ echo "" | tee /tmp/mako_mode_pre_lock > /dev/null
+
+ # recover pactl mode
+ if [[ "$(cat /tmp/pactl_mode_pre_lock)" == "Mute: no" ]]; then
+ pactl set-sink-mute @DEFAULT_SINK@ 0 > /dev/null &
+ else
+ pactl set-sink-mute @DEFAULT_SINK@ 1 > /dev/null &
+ fi
+ echo "" | tee /tmp/pactl_mode_pre_lock > /dev/null
+
+else
+
+ echo "Please run this script with either \"on\" or \"off\" argument."
+ exit 1;
+
+fi
+
+# EOF