Change sway idle behavior to use defacto standard
`sway-audio-idle-inhibit`
This commit is contained in:
parent
2cb74f3ad7
commit
ab4cb57f53
3 changed files with 3 additions and 25 deletions
|
|
@ -51,6 +51,7 @@ in
|
||||||
playerctl
|
playerctl
|
||||||
mako
|
mako
|
||||||
bitwarden-cli
|
bitwarden-cli
|
||||||
|
sway-audio-idle-inhibit
|
||||||
];
|
];
|
||||||
|
|
||||||
file = utils.mk_symlinks { inherit config dotfiles; };
|
file = utils.mk_symlinks { inherit config dotfiles; };
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,8 @@ input "type:pointer" {
|
||||||
pointer_accel 0
|
pointer_accel 0
|
||||||
}
|
}
|
||||||
|
|
||||||
exec_always --no-startup-id ~/.config/sway/idle.sh
|
# Enables inhibit_idle when playing audio
|
||||||
|
exec sway-audio-idle-inhibit
|
||||||
|
|
||||||
exec_always --no-startup-id ~/.config/sway/sway_unfocused_effects.py
|
exec_always --no-startup-id ~/.config/sway/sway_unfocused_effects.py
|
||||||
|
|
||||||
|
|
|
||||||
24
sway/idle.sh
24
sway/idle.sh
|
|
@ -1,24 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Track the current inhibition state
|
|
||||||
inhibited=0
|
|
||||||
|
|
||||||
# Check player status and adjust idle inhibition
|
|
||||||
while true; do
|
|
||||||
if playerctl status | grep -q "Playing"; then
|
|
||||||
if [ "$inhibited" -eq 0 ]; then
|
|
||||||
swaymsg "inhibit_idle on"
|
|
||||||
inhibited=1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ "$inhibited" -eq 1 ]; then
|
|
||||||
swaymsg "inhibit_idle off"
|
|
||||||
inhibited=0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
sleep 5 # Check every 5 seconds
|
|
||||||
done &
|
|
||||||
exec swayidle -w \
|
|
||||||
timeout 300 'swaylock -f -c 000000' \
|
|
||||||
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
|
|
||||||
before-sleep 'swaylock -f -c 000000'
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue