Merge branch 'user/okmans/fix/idle-inhibitor' into 'master'
Fix the idle-inhibitor script See merge request tile-os/tileos-settings-sway!20
This commit is contained in:
commit
66bdd5592c
1 changed files with 29 additions and 8 deletions
|
@ -1,11 +1,32 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
set -e
|
check_status() {
|
||||||
|
grep -s -l -v "closed" \
|
||||||
|
/proc/asound/card*/pcm*/sub*/status \
|
||||||
|
&>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
if grep -s -l -v "closed" /proc/asound/card*/pcm*/sub*/status; then
|
out() {
|
||||||
swaymsg inhibit_idle open
|
printf "Idle inhibition is OFF.\n"
|
||||||
printf "Idle inhibition is ON."
|
exit 0
|
||||||
else
|
}
|
||||||
swaymsg inhibit_idle none
|
|
||||||
printf "Idle inhibition is OFF."
|
watch_status() {
|
||||||
fi
|
printf "Idle inhibition is ON.\n"
|
||||||
|
while check_status; do
|
||||||
|
sleep 10
|
||||||
|
done
|
||||||
|
out
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
check_status || out
|
||||||
|
test "$1" = "-w" && watch_status
|
||||||
|
systemd-inhibit \
|
||||||
|
--what=idle \
|
||||||
|
--who="${0##*/}" \
|
||||||
|
--why="Inhibit idle due to audio is now playing" \
|
||||||
|
--mode=block \
|
||||||
|
"$0" -w
|
||||||
|
}
|
||||||
|
main "$@"
|
||||||
|
|
Loading…
Add table
Reference in a new issue