! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Pulseaudio panel plugin: Add notification
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfce4-pulseaudio-plugin
Component:
General

Comments

Description haarp 2015-04-06 10:31:28 CEST
I think it would improve usability if there was an option to enable notifications when the volume is changed. volumed for example does this, as do various other tools.

This is probably not necessary for the slider, but should be displayed when the mousewheel or volume keys are used.
Comment 1 Andrzej editbugs 2015-04-07 02:10:31 CEST
Not a priority atm but nice to have. Patches welcome. Any extra dependencies should be optional.
Comment 2 Steve Dodier-Lazaro editbugs 2015-04-09 14:25:58 CEST
Created attachment 6181 
Patch adding a notification API

Hi,

I've made a patch that exposes a notification API to the PA plugin. It's based on volumed, but updated to use mute icons consistently with the PA plugin (mute icon when volume == 0 rather than low volume icon).

I haven't made use of the API in the existing code because I'm not sure how to implement the behaviour which I think would work best. Pointers are very welcome if you want me to finish the job :-)

Expected behaviour:
- When keys are used to update the volume, throw a volume notification
- When the mouse wheel is used on the panel plugin icon, also show a notification (the mouse covers the icon so visual feedback is mostly missing)
- When the menu is open, throw no notifications (redundant feedback)

If I can find out how to detect whether the menu is open from within pulseaudio_volume_set_volume_cb1, then I can probably finish the patch. I also need access to the PulseaudioNotify struct.

API usage:
- When starting your app, create a PulseAudioNotify with pulseaudio_notify_init()
- When leaving, use pulseaudio_notify_uninit()
- When updating the volume, update current_vol and muted in your PulseaudioNotify and call pulseaudio_notify_volume_notification

The API stores muted/current_vol because it can make it a bit easier to update notifications. For instance if you have a callback for muting that does not have access to the current volume, you can still update the PulseaudioNotify struct and throw a notification with the correct volume. The drawback is you need to remember to update them, even when not showing a notification.

It's, also, a remnant of the volumed architecture. If you prefer to have a pulseaudio_notify_volume_notification function that takes current_vol and muted as parameters, I'm happy to change the patch to do that.
Comment 3 Andrzej editbugs 2015-04-19 02:59:35 CEST
Steve, thank you for the patch. In the end I have implemented it slightly differently but most of the code is based on your work. I have also added you to the list of contributors, please let me know if you are happy with the current copyright and acknowledgements.
Comment 4 Steve Dodier-Lazaro editbugs 2015-04-19 13:07:13 CEST
All good for me, thanks :-)
Comment 5 haarp 2015-05-12 12:35:50 CEST
I just installed 0.2.3, notifications work beautifully. Thanks both of you!

Bug #11799

Reported by:
haarp
Reported on: 2015-04-06
Last modified on: 2015-05-12

People

Assignee:
Andrzej
CC List:
1 user

Version

Version:
unspecified

Attachments

Patch adding a notification API (9.40 KB, patch)
2015-04-09 14:25 CEST , Steve Dodier-Lazaro
no flags

Additional information