Gnome Volume Control with DBus

I am new to all DBus stuff, so sorry if this is trivial, but I was wondering if DBus can set the sound volume from the command line.

+3
source share
2 answers

This is similar to working with GNOME 2.30 on Ubuntu 10.04:

$ dbus-send --session --dest=org.ayatana.indicator.sound /org/ayatana/indicator/sound/service org.ayatana.indicator.sound.SetSinkVolume uint32:40

This sets the volume to 40%. Replace 40 with whatever percentage you want the volume to be.

And vice versa, to view the current volume:

$ dbus-send --session --print-reply --dest=org.ayatana.indicator.sound /org/ayatana/indicator/sound/service org.ayatana.indicator.sound.GetSinkVolume
method return sender=:1.54 -> dest=:1.2228 reply_serial=2
   double 39.9994

(Yes, you set the volume as uint32, but get it as double. I don't get it either.)

, Ayatana Ubuntu, , .

+5

:

xdotool key XF86AudioRaiseVolume
xdotool key XF86AudioLowerVolume
xdotool key XF86AudioMute
+1

Source: https://habr.com/ru/post/1745372/


All Articles