systemd: schedule cleaning of spotify PA streams

This commit is contained in:
Vincent Bernat 2021-08-01 12:06:03 +02:00
parent 4ce36110d4
commit 325d7778d7
4 changed files with 22 additions and 1 deletions

7
bin/spotify-clean Executable file
View file

@ -0,0 +1,7 @@
#!/bin/sh
pactl list short clients \
| awk '($3 == "spotify") {print $1}' \
| sort -n \
| head -n-1 \
| xargs -rn1 pw-cli destroy

View file

@ -0,0 +1,7 @@
[Unit]
Description=Clean spotify extra PulseAudio streams
[Service]
ExecStart=%h/.config/i3/bin/spotify-clean
Type=oneshot
RemainAfterExit=false

View file

@ -0,0 +1,6 @@
[Unit]
Description=Clean spotify extra PulseAudio streams
After=pipewire-pulse.socket
[Timer]
OnUnitActiveSec=1h

View file

@ -6,9 +6,10 @@ Wants=dunst.socket
Wants=easyeffects.service
Wants=inputplug.service
Wants=picom.service
Wants=policykit-agent.service
Wants=pipewire-pulse.socket
Wants=policykit-agent.service
Wants=redshift.service
Wants=spotify-clean.timer
Wants=ssh-agent.service
Wants=xiccd.service
Wants=xsettingsd.service