diff --git a/bin/spotify-clean b/bin/spotify-clean new file mode 100755 index 0000000..5a74f6e --- /dev/null +++ b/bin/spotify-clean @@ -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 diff --git a/dotfiles/systemd/spotify-clean.service b/dotfiles/systemd/spotify-clean.service new file mode 100644 index 0000000..98cf6e2 --- /dev/null +++ b/dotfiles/systemd/spotify-clean.service @@ -0,0 +1,7 @@ +[Unit] +Description=Clean spotify extra PulseAudio streams + +[Service] +ExecStart=%h/.config/i3/bin/spotify-clean +Type=oneshot +RemainAfterExit=false diff --git a/dotfiles/systemd/spotify-clean.timer b/dotfiles/systemd/spotify-clean.timer new file mode 100644 index 0000000..0edb374 --- /dev/null +++ b/dotfiles/systemd/spotify-clean.timer @@ -0,0 +1,6 @@ +[Unit] +Description=Clean spotify extra PulseAudio streams +After=pipewire-pulse.socket + +[Timer] +OnUnitActiveSec=1h diff --git a/dotfiles/systemd/xsession.target b/dotfiles/systemd/xsession.target index 18986b1..a3ee316 100644 --- a/dotfiles/systemd/xsession.target +++ b/dotfiles/systemd/xsession.target @@ -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