Add both files to ~/.config/systemd/user/ and enable them via systemctl --user enable --now pipewire-source-stereo@sourcename.service
or systemctl --user enable --now pipewire-sink-stereo@sinkname.service
.
Change sourcename
and sinkname
in the command to your needs. You can add multiple devices with different names.
-
-
Save oasido/7b12edcf8fc1fb8dbfbbe610904b3e25 to your computer and use it in GitHub Desktop.
Pipewire virtual devices as systemd user services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description = Add a pipewire stereo sink named %i | |
After = pipewire.service | |
[Service] | |
Type = oneshot | |
StandardOutput = journal | |
ExecStart = /bin/sh -c 'pactl load-module module-null-sink media.class=Audio/Sink sink_name="%i" channel_map=stereo > %h/.cache/pipewire_sink_stereo_%i' | |
ExecStopPost = -/bin/sh -c 'pactl unload-module $(cat %h/.cache/pipewire_sink_stereo_%i)' | |
ExecStopPost = -/bin/rm %h/.cache/pipewire_sink_stereo_%i | |
RemainAfterExit = true | |
[Install] | |
WantedBy = default.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description = Add a pipewire stereo source named %i | |
After = pipewire.service | |
[Service] | |
Type = oneshot | |
StandardOutput = journal | |
ExecStart = /bin/sh -c 'pactl load-module module-null-sink object.linger=1 media.class=Audio/Source/Virtual sink_name="%i" channel_map=stereo > %h/.cache/pipewire_source_stereo_%i' | |
ExecStopPost = -/bin/sh -c 'pactl unload-module $(cat %h/.cache/pipewire_source_stereo_%i)' | |
ExecStopPost = -/bin/rm %h/.cache/pipewire_source_stereo_%i | |
RemainAfterExit = true | |
[Install] | |
WantedBy = default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment