Merge branch 'user/okmans/swayidle/inhibition' into 'master'

Add screensaver inhibition control service

See merge request tile-os/tileos-settings-sway!8
This commit is contained in:
Aleksey Samoilov 2024-08-20 14:47:01 +00:00
commit 56e05fbcb2
3 changed files with 23 additions and 15 deletions

View file

@ -45,21 +45,6 @@ for_window [title="Confirm to replace files"] move position center
for_window [title="Choose an Application"] floating enable for_window [title="Choose an Application"] floating enable
for_window [title="Removable medium is inserted"] floating enable for_window [title="Removable medium is inserted"] floating enable
# apply mark for Xwayland and wayland native browser windows
for_window [class="Chromium-browser"] mark Browser
for_window [class="Brave-browser"] mark Browser
for_window [class="firefox"] mark Browser
for_window [class="librewolf"] mark Browser
for_window [app_id="Chromium-browser"] mark Browser
for_window [app_id="brave-browser"] mark Browser
for_window [app_id="[Ff]irefox"] mark Browser
for_window [app_id="[Ll]ibrewolf"] mark Browser
# inhibit scrensaver for fullscreen browser windows
for_window [con_mark="Browser"] {
inhibit_idle fullscreen
}
# Don't allow applications to inhibit shortcuts, i.e. grab total control of the # Don't allow applications to inhibit shortcuts, i.e. grab total control of the
# keyboard. Chrome currently abuses this by enabling it for all "--app=..." # keyboard. Chrome currently abuses this by enabling it for all "--app=..."
# shortcuts. # shortcuts.

View file

@ -0,0 +1,12 @@
[Unit]
Description=Toggle idle inhibition depending on whether the audio is playing or not
PartOf=swayidle.service
After=swayidle.service
[Service]
ExecStart=/usr/share/sway/scripts/idle-inhibitor.sh
Restart=always
RestartSec=30
[Install]
WantedBy=sway-session.target

View file

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if grep -s -l -v "closed" /proc/asound/card*/pcm*/sub*/status; then
swaymsg inhibit_idle open
printf "Idle inhibition is ON."
else
swaymsg inhibit_idle none
printf "Idle inhibition is OFF."
fi