20
submitted 2 months ago* (last edited 2 months ago) by Communist@lemmy.ml to c/linux@lemmy.ml

I currently use the following one-liner to switch between sinks

pactl set-default-sink $(pactl list short sinks | awk '{print $2}' | sd 'easyeffects_sink\n' '' | sd "$(pactl get-default-sink)\n" '' | tofi --prompt-text " " --height 40% --width 40% --auto-accept-single true ) && pw-play --volume=0.2 /usr/share/sounds/freedesktop/stereo/audio-volume-change.oga

It seems wpctl doesn't currently support node.names which makes this significantly more complex, has anyone done something similar with wpctl? I've found a massive script but I want something more simple that's a one-liner.

wpctl set-default $(pw-cli i $(pactl list short sinks | awk '{print $2}' | sd 'easyeffects_sink\n' '' | sd "$(pactl get-default-sink)\n" '' | tofi --prompt-text " " --height 40% --width 40% --auto-accept-single true ) | rg -oP 'id: \K\w+')

closest I've managed so far is this, which at least makes it so that wpctl sets the sink, which is an upgrade, I guess, but there's still two pactl's to eliminate...

top 2 comments
sorted by: hot top controversial new old
[-] mactan@lemmy.ml 9 points 2 months ago

for what it's worth the pulsaudio APIs aren't going anywhere anytime soon. keeping an eye on the replies out of curiosity though

[-] Communist@lemmy.ml 7 points 2 months ago

yeah i'm doing this because i'm anal not because there's a good reason to.

this post was submitted on 11 Jun 2024
20 points (95.5% liked)

Linux

47159 readers
1326 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS