AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 698201
Accepted
dadexix86
dadexix86
Asked: 2015-11-16 02:29:41 +0800 CST2015-11-16 02:29:41 +0800 CST 2015-11-16 02:29:41 +0800 CST

使用声音图标和栏发出新通知

  • 772

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

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

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%

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

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

那么,我怎样才能像 Ubuntu 那样生成带有不断变化的图标和音量栏的通知呢?

我应该使用notify-send吗?使用哪些参数?
它不应该是一个“正常”的通知,因为当音量变化时它必须“坚持”在那里并且只是适应酒吧......

unity
  • 1 1 个回答
  • 1482 Views

1 个回答

  • Voted
  1. Best Answer
    user.dz
    2015-11-18T15:12:50+08:002015-11-18T15:12:50+08:00

    是的,应该特别通知:

    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
    
    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
      
    2. 然后使用以下方法编写我自己的调用:

      • gdbus按照这篇文章How to pass a{sv} arguments to gdbus?
      • 或者如果你想要 python,这篇解释得很好的帖子:How to read dbus-monitor output? . 即使它具有与展示柜相同的声音通知。
    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
      
    • 7

相关问题

  • 如何将 Web 应用程序放入 Unity Launcher?

  • Ubuntu 上网本 10.10 中没有 Alt+F2?

  • Unity 中的 gnome-do 样式键盘快捷键

  • 在哪里提交 Unity 的错误/愿望清单?

  • Unity 启动器——它可以作为单独的包提供吗?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve