#436 lxpanel - Show popup window if volume keys are pressed

open
nobody
None
5
2014-11-15
2013-01-20
Johannes Surek
No

I wrote this patch because I missed a visual feedback when changing the volume with the multimedia keys of my keyboard.

The patch adds the commands "raisevolume", "lowervolume" and "mute" to the lxpanelctl tool. With these commands lxpanelctl can be used in the openbox configuration file instead of amixer to handle the multimedia keys.
If invoked by lxpanelctl, the commands are passed on by the panel to the volumealsa plugin, which then changes the volume and shows its popup window for three seconds. To achieve the possibility of sending commands from the panel to external plugins, I added a function pointer called "handle_command(int cmd, void *p)" to the Plugin structure (with p being the plugin itself). This function pointer might also be used by other plugins to deal with external events.

I hope this feature is useful for other people out there.

Discussion

  • Johannes Surek
    Johannes Surek
    2013-01-20

    Enables the volumealsa plugin of lxpanel to handle multimedia keys using lxpanelctl

     
  • Henry Gebhardt
    Henry Gebhardt
    2013-01-20

    Thanks for the patch. Some comments:

    a.) The logic via lxpanelctl should not be needed, as the volumealsa plugin already listens for alsa events. The visual feedback should be done in the function asound_mixer_event().

    b.) In dependently of that, the lxpanelctl logic may still be useful. Can you think of any use cases?

    c.) I am not sure if showing the popup window is the best way for visual feedback. I'd much rather see the color of the icon change. This would have the additional benefit that the color could be configured by the user (once there is a configuration mechanism for this plugin).

    Thanks for working on this!

     
  • Johannes Surek
    Johannes Surek
    2013-01-20

    Thanks for your comments.

    The problem with using alsa events in the plugin is that the popup would always show if the volume is changed in some other mixer application. That's a rather unpleasant behaviour (imho).

    On the other hand, of course, it would be sufficient if the icon could be used as a visual feedback in a satisfaing way, e.g. with different colors. I am just uncontent with the current situation where only four states can be represented in the icon. I prefer to see the volume as exactly as possible. Maybe there is a good way to accomplish this. I'll think about it.

     
  • I think better approach for feedback would be if volume change was shown using some OSD as does latest KMix if you ever saw that. That behavior should be optional, of course.

    And about using multimedia keys - that should be as well configurable and done directly by plugin, and using lxpanelctl for that is not good I believe. That feature will be implemented soon enough, the API for that is already available in the lxpanel GIT sources. Thank you very much.