Make a new notification with sound icon and bar
Probably this question has already been answered somewhere, but I could not find it.
The situation: I am on Ubuntu 15.10, on a laptop.
I have a secondary bluetooth speakers system, on which I redirect some output (mainly the music).
I can control the volume with pactl
with
pactl -- set-sink-volume bluez_sink.00_18_91_65_D8_6D +5%
pactl -- set-sink-volume bluez_sink.00_18_91_65_D8_6D -5%
and having associated this to some keyboard shortcuts I can increase and decrease it like if it'd be local.
This works fine but, unlike for the main output (the internal audio card), using this command does not produce a notification with the actual volume level.
So, how can I produce the notification with the changing icon and the bar for the volume, like Ubuntu does?
Should I use notify-send
? With which parameters?
It should not be a "normal" notification, because it has to "stick" there when the volume changes and just adapt the bar...
Solution 1:
Yep, it should be special notification:
gdbus call --session --dest org.freedesktop.Notifications \
--object-path /org/freedesktop/Notifications \
--method org.freedesktop.Notifications.Notify \
'gnome-settings-daemon' \
0 \
'notification-audio-volume-medium' \
' ' \
'' \
[] \
"{'x-canonical-private-synchronous': <'volume'>, 'value': <24>}" \
1
-
Found by watching
dbus-monitor
:method call time=1447796042.858910 sender=:1.11 -> destination=:1.96 serial=216 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify string "gnome-settings-daemon" uint32 0 string "notification-audio-volume-medium" string " " string "" array [ ] array [ dict entry( string "x-canonical-private-synchronous" variant string "volume" ) dict entry( string "value" variant int32 48 ) ] int32 -1
-
Then write my own call using:
-
gdbus
following this post How to pass a{sv} arguments to gdbus? - Or if you want python, this well explained post: How to read dbus-monitor output?. Even it has same sound notification as a showcase.
-
-
Icons available are:
find /usr/share/notify-osd/icons/hicolor/scalable/status/ -name "notification-audio-volume-*" -exec basename {} .svg \;
notification-audio-volume-low notification-audio-volume-off notification-audio-volume-medium notification-audio-volume-muted notification-audio-volume-high