falconindy / ponymix

CLI volume control for PulseAudio
MIT License
177 stars 27 forks source link

Command-line flag for all sinks #43

Closed karlek closed 7 years ago

karlek commented 7 years ago

Hi!

I usually connect to multiple bluetooth devices and each device gets a unique sink index which makes it quite hard to make scripts for altering the volume of the playback.

These are the commands I use to mute/lower and raise the volume. Is there any better way than just to add all new device indices like this?

<command>sh -c 'ponymix -d 1 toggle; ponymix -d 2 toggle; ponymix -d 3 toggle'</command>
<command>sh -c 'ponymix -d 1 decrease 3; ponymix -d 2 decrease 3; ponymix -d 3 decrease 3'</command>
<command>sh -c 'ponymix -d 1 increase 3; ponymix -d 2 increase 3; ponymix -d 3 increase 3'</command>
falconindy commented 7 years ago

-d can also find devices by name.

karlek commented 7 years ago

Ponymix just returns the default devices when I try searching for my bluetooth sink.

$ ponymix -d 'bluez_sink.00_1D_43_F0_78_2B' 
sink 1: alsa_output.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 88%
source 1: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
  Monitor of Built-in Audio Analog Stereo
  Avg. Volume: 100%

Compared to ponymix list

$ ponymix list
sink 0: alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1
  Built-in Audio Digital Stereo (HDMI 2)
  Avg. Volume: 100%
sink 1: alsa_output.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 88%
sink 4: bluez_sink.00_1D_43_F0_78_2B
  PLS2.1
  Avg. Volume: 100%
source 0: alsa_output.pci-0000_00_03.0.hdmi-stereo-extra1.monitor
  Monitor of Built-in Audio Digital Stereo (HDMI 2)
  Avg. Volume: 100%
source 1: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
  Monitor of Built-in Audio Analog Stereo
  Avg. Volume: 100%
source 4: bluez_sink.00_1D_43_F0_78_2B.monitor
  Monitor of PLS2.1
  Avg. Volume: 100%
sink-input 230: playback
  C* Music Player
  Avg. Volume: 100%

Edit: the device I'm talking about is sink: 4.

falconindy commented 7 years ago

Well, sure. It returns the default devices in the same way that ponymix -d 1 returns defaults just the same as ponymix or ponymix defaults. That is, the -d flag isn't meaningful to the defaults verb. If you want to operate on source 4 by name, you can use, e.g. ponymix --source -d bluez toggle

karlek commented 7 years ago

Ah, thank you! That worked. I expected ponymix -d bluez to print the sinks it would target, but it always prints the defaults. Thank you @falconindy!