Fix sway idle issues when watching videos
This commit is contained in:
parent
8dedcb100b
commit
466622c2ba
2 changed files with 32 additions and 7 deletions
|
|
@ -34,14 +34,15 @@ set $menu dmenu_path | wmenu | xargs swaymsg exec --
|
||||||
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
|
||||||
output * bg /home/larssonmartin1998-asahi/.config/wallpapers/catppuccin/cloudsnight.jpg fill
|
output * bg /home/larssonmartin1998-asahi/.config/wallpapers/catppuccin/cloudsnight.jpg fill
|
||||||
|
|
||||||
### Idle configuration
|
exec_always --no-startup-id ~/.config/sway/idle.sh
|
||||||
|
# https://github.com/ErikReider/SwayAudioIdleInhibit
|
||||||
|
# Prevents the system from locking when audio is playing or recording.
|
||||||
|
# This prevents the pc from shutting down when watching youtube for instance.
|
||||||
|
exec_always --no-startup-id sway-audio-idle-inhibit
|
||||||
exec swayidle -w \
|
exec swayidle -w \
|
||||||
timeout 300 'swaylock -f -c 000000' \
|
timeout 300 'swaylock -f -c 000000' \
|
||||||
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
|
timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
|
||||||
before-sleep 'swaylock -f -c 000000'
|
before-sleep 'swaylock -f -c 000000'
|
||||||
# /home/larssonmartin1998-asahi/.config/sway/swayidle_inhibit.sh
|
|
||||||
|
|
||||||
exec_always --no-startup-id ~/.config/sway/dim_inactive.windows.py
|
|
||||||
|
|
||||||
### Key bindings
|
### Key bindings
|
||||||
# Start a terminal
|
# Start a terminal
|
||||||
|
|
|
||||||
24
linux_home/.config/sway/idle.sh
Executable file
24
linux_home/.config/sway/idle.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/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