Is there a fancy way to get the volume notification OSD to work with both pulseaudio and ALSA? Right now the standard desktop ones only work with pulseaudio for me. How about a vertical OSD that I can use as a drop in replacement or call from the command line to report changes in arbitrary percentages graphically, as a bar that moves up and down?
The reason why I need it to work with both ALSA and pulseaudio is that I'm using a WINE application which doesn't play well with pulse, so I kill pulse before starting up the Windows app to use ALSA without the extra abstraction layer. When I realized that the volume keys on my keyboard didn't work without pulse, I wrote some bash scripts that I call with either Compiz or Openbox (configured through CCSM and lxde-rc.xml, respectively) to catch the exit signal from pulseaudio --check
and then adjust the volume accordingly:
vol_step_up
#!/bin/bash
pulseaudio --check
if [ $? -eq 0 ] ; then
pactl set-sink-volume 0 -- +3db
else
amixer -c0 set Master playback 3+
fi
vol_step_down
#!/bin/bash
pulseaudio --check
if [ $? -eq 0 ] ; then
pactl set-sink-volume 0 -- -3db
else
amixer -c0 set Master playback 3-
fi
The scripts work great and map to the buttons just fine, but I don't have a good way of seeing the visual feedback anymore--not even with the pulseaudio ones since I' m catching the button events (XF86AudioLowerVolume, etc.). Obviously I could just map the ALSA volume keys to something else, but there's no sense in duplicating shortcut keys.
I did find a python volume control that I can call in the scripts above:
https://github.com/fishman/utils/blob/master/pvol.py
pvol.py -s
shows the current volume level on screen for both ALSA and pulseaudio, but it's awfully tiny compared to the gnome OSD I had been using, and it isn't vertical (bar on top, old OSD at bottom):
So, I made it bigger and flopped it around:
But, even with switching the orientation to a vertical one, the blue default GTK theme isn't quite as slick as VLC (see below).
Much of what I've found in searching for OSD implementations are posts about notify-send commands which lack the whole progress bar concept. Otherwise, it's mostly horizontal bars (and lots of counting placeholders within bash scripts). Really all I need to do is call amix & pactl, so something simple like the gtk progress bar in pvol.py would be great--just not so blue and not right in the middle of the screen.
VLC has a good example of what I have in mind when you scroll the mouse wheel in full-screen mode:
It's a lot less obstructive than the usual boxes that sit in the center of the screen:
The whole horizontal slider analogy has never made much sense to me outside of panning audio between the left and right speakers.
Anyway, how is it that the default desktop notifications get called (especially LXDE)? I see a lot of posts about configuring key press events, but not much on what scripts those events trigger. What other options are out there in the vertically fancy department?
Also, is there some package I should uninstall to prevent conflicts from springing up between the events I'm handling through scripting and compiz or openbox commands?
Update: For the sake of figuring out what OSD I'm currently using, I didn't change the way I handle the mute button right away. Killing xfce4-notifyd and then pressing the mute button spawns a new xfce4-notifyd process, so I was guessing the big speaker icon came from something like xfce4-volumed, but I don't actually have that package installed...Ah ha! Killing gnome-settings-daemon stops the big OSD in the center of the screen.