因为unity目前对于indicator采用的是极简的处理方法,无论是qt还是gtk,所能使用的调用只有单一的Trigger点击,想要用到复杂的比如右键点击,左键双击等等的操作响应暂时还没想到办法。事实上,默认的音量控制(indicator-sound)是有各种响应的,比如鼠标中键的滚轮滚动可以调节音量。首先,我们要找到它的实现方法。
indicator使用dbus作为通信机制。所以当打开dbus-monitor后,在滚动滚轮调节音量时,有如下输出(ps:真难截。。)
method call sender=:1.17 -> dest=:1.43 serial=8609 path=/com/canonical/Unity/Panel/Service; interface=com.canonical.Unity.Panel.Service; member=ScrollEntry
string "0x8863a84"
int32 -120
method call sender=:1.43 -> dest=:1.29 serial=18226 path=/org/freedesktop/Notifications; interface=org.freedesktop.Notifications; member=Notify
string "indicator-sound"
uint32 0
string "notification-audio-volume-low"
string "indicator-sound"
string ""