Maato / volumeicon

Volume Icon aims to be a lightweight volume control that sits in your systray.
http://nullwise.com/volumeicon.html
GNU General Public License v3.0
183 stars 45 forks source link

Change of the default device not automatically detected #49

Open kaqqao opened 8 years ago

kaqqao commented 8 years ago

If the default device is changed (e.g. from built-in sound card to USB headset), Volumeicon does not change the volume on the new (current) device (the headset), but on the previous default (built-in card). It is enough to switch the device in preferences and switch it back to default to make it detect the change, but it would be very helpful if it could do this automatically.

Maato commented 8 years ago

How are you changing the default card?

kaqqao commented 8 years ago

Currently, by using pulseaudio's module-switch-on-connect. I think the same used to happen when I was just switching by changing the .asoundrc, but I'm not 100% sure as I now use pulseaudio making it hard to test. In case pulseaudio is unsupported, sorry for the false alarm.

yguilhem commented 8 years ago

I second this issue. I had to manually write a udev rule launching a script to :

  1. Switch and redirect all pulseaudio sinks/sources from/to the new soundcard (it's not related to volumeicon, I agree).
  2. Kill and restart volumeicon. Would be very nice to have at least the second part integrated into volumeicon.
Zauberfisch commented 8 years ago

I can confirm this issue as well. Had to add a hard restart of volumeicon to my audio switch script aswell: https://gist.github.com/Zauberfisch/e4aba115053b0048bcb806fb579877d1#file-audio-switch-sh-L36

alelondon commented 7 years ago

I can confirm this issue as well. Restarting volumeicon once the sound device changes fixes the issue. (not really a fix) I guess volumeicon changes the volume of the default-device-at-start instead of determining the default device each time a volume change is invoked.

Zauberfisch commented 7 years ago

Just a quick update, my workaround with restarting it to detect the switch of audio output has recently stopped to work.

So, since I use pulseaudio anyway, I have switched over to using "pa-applet". It also handles volume keys and a tray icon with a volume bar plus supports switching output. (I'm using i3 as window manager and just replaced the line that started volumeicon with pa-applet)

alelondon commented 7 years ago

my workaround on xfce was to switch to (http://goodies.xfce.org/projects/panel-plugins/xfce4-pulseaudio-plugin )

nazar-pc commented 6 years ago

One more instance in unplugging and plugging back in USB sound card (which is the only sound card in my system). Yet another instance is changing USB sound card's output mode from 2.1/5.1 to stereo and back. Would be really nice. Currently it stops with

snd_mixer_handle_events: No such device
yaeuge commented 5 years ago

I can suggest updating the device list on opening preferences dialog. Then it will be possible to change the device to newly inserted sound card without restarting volumeicon. Item for switching in context menu would also be handy

duncan-bayne commented 3 months ago

I'm looking into this now as I'm running into the same issue. Whenever I connect a Bluetooth audio device ALSA starts using it as the default, but volumeicon doesn't pick up on the change.

My thinking around an implementation:

  1. Add compile-time flags for --with-udev and --with-devd (for Linux and FreeBSD systems respectively). Do this to (a) support either OS, but also (b) continue supporting neither; i.e. don't introduce a hard dependency on udev or devd to volumeicon.

  2. When --with-udev is specified, do something like udev_example3.c in a background thread, watching for new or removed sound devices, and re-run either oss_setup or asound_setup accordingly.

  3. When --with-devd is specified, connect to /var/run/devd.seqpacket.pipe on a background thread and read events from that. Again, like with --with-udev, re-run either oss_setup or asound_setup accordingly should a sound device appear or disappear.

At a guess there'll be some restructuring necessary for volumeicon to handle having its backends arbitrarily re-initialized.

@Maato are you interested in me raising a PR to do the above? I'm able to test on both Linux and FreeBSD systems.