Skip to content

u/BarbUk

In this archive from Nov 2016 to Jun 2023

3
posts
20
comments
1
media
89
score
1 saved before deletion

I use something similar to switch the default sink.

I've added the concept of role to change only certain apps (like music or phone):

$ pulseaudio_toggle_default_sink -h
Usage:
	pulseaudio_toggle_default_sink [OPTION] [ACTION]
	Toggle your defaut sound output or change your music player from an output to another

Options
	-h, --help: Show help
	-o, --output <output index>: use a specific output

Actions
	default: change default output (default action)
	list: list detected inputs and outputs
	reset: reset all active input to the default output
	media <ROLE>: change <ROLE> input to another output

Roles
	One of the strings video, music, game, event, phone, animation, production, a11y, test
2 points

Thanks to /u/abbidabbi for the idea, I have updated my script to handle media role.

Usage:
  pulseaudio_toggle_default_sink [OPTION] [ACTION]
  Toggle your defaut sound output or change your music player from an output to another

Options
  -h, --help Show help

Actions
  default: change default output (default action)
  reset: reset all active input to the default output
  media <ROLE>: change <ROLE> input to another output

Roles
  One of the strings video, music, game, event, phone, animation, production, a11y, test
1 points

Toggling the default sink also changes the output of everything else

Yes exactly, it's my use case. I want all current audio to pass from my headphone to my DAC for example.

It's a quick hack to be honest.

Thanks for the hint about media.role, I will check how to update my script to only change a specific role:

$ pactl list sink-inputs  | grep -e application.name -e ^[[:space:]]*media.role

application.name = "Skype"
media.role = "phone"
application.name = "spotify"
media.role = "music"
1 points

End of this list.

Back to top

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.