使用声音图标和栏制作新通知

dad*_*x86 6 notification sound unity pulseaudio bluetooth

可能这个问题已经在某处得到了回答,但我找不到它。

情况:我在笔记本电脑上使用 Ubuntu 15.10。
我有一个辅助蓝牙扬声器系统,在该系统上我重定向了一些输出(主要是音乐)。

我可以控制与卷pactl

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%
Run Code Online (Sandbox Code Playgroud)

并将其与某些键盘快捷键相关联,我可以增加和减少它,就像它是本地的一样。

这工作正常,但与主输出(内部声卡)不同,使用此命令不会产生具有实际音量级别的通知。

那么,如何像 Ubuntu 一样使用不断变化的图标和音量栏来生成通知?

我应该使用notify-send吗?用哪些参数?
它不应该是一个“正常”的通知,因为当音量改变时它必须“粘”在那里并且只是调整条形......

use*_*.dz 7

是的,应该是特别通知:

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
Run Code Online (Sandbox Code Playgroud)
  1. 通过观察发现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
    
    Run Code Online (Sandbox Code Playgroud)
  2. 然后使用以下方法编写我自己的电话:

  3. 可用的图标有:

    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
    
    Run Code Online (Sandbox Code Playgroud)

  • 这只是来自我的 WOW 和 +1。尽管所有这些东西的官方文档质量很差,但您还是快速提出了一个可行的解决方案,这给我留下了深刻的印象。我打算直接在 dbus 上编写自己的 Python `pynotify` 实现,以避免缺少此文档并从中获得乐趣。我还计划为 Python 编写一个更好的指标界面。您似乎对这个主题非常了解,如果我需要帮助,我可以联系您吗?我应该如何最好地做到这一点? (2认同)
  • 就是这样!这太棒了!:DI 设法完成了我的脚本并将其集成到快捷方式中,非常感谢!:D (2认同)