cosmic-applets icon indicating copy to clipboard operation
cosmic-applets copied to clipboard

Audio: Sync while popup is opened

Open leb-kuchen opened this issue 1 year ago • 3 comments

Currently pulse audio is synced at every toggle and there is no subscription. The disadvantages are that an audio device may be disconnected or the volume is changed with keybindings. Also more complex features, like sink inputs can be become quite surprising, as users may try to change the volume of a removed sink input. I do not know, if this is possible with the standard mainloop, though the threaded mainloop is not as efficient and 2 threads are spawned.

leb-kuchen avatar Apr 07 '24 21:04 leb-kuchen

https://github.com/pop-os/cosmic-osd/blob/master/src/subscriptions/pulse.rs has a subscription for monitoring volume changes. That code should probably be moved somewhere and shared in the applet.

ids1024 avatar Apr 08 '24 01:04 ids1024

The applet also listens for messages from the GUI, so it's not a main loop run. Or are you thinking about 2 subscriptions?

leb-kuchen avatar Apr 08 '24 05:04 leb-kuchen

The alternative would be doing something like https://github.com/jantap/rsmixer/blob/master/src/pa/pa_interface.rs, if you wanted a single subscription.

leb-kuchen avatar Apr 08 '24 05:04 leb-kuchen

https://github.com/pop-os/cosmic-applets/pull/492 should fix this.

ids1024 avatar Jul 02 '24 03:07 ids1024