相关疑难解决方法(0)

单击 4 次即可关闭 Ubuntu - 我们可以减少这种情况吗?

Ubuntu 20.04 决定我们需要点击 4 次才能关闭:

  1. 单击屏幕右上角的向下箭头
  2. 展开“关机/注销”面板
  3. 点击“关机”
  4. 通过选择关闭电源与重新启动等来确认您要关闭电源

让我们在这里至少减少 2 次点击...如何?

更新:这是一台“Lounge PC”——由鼠标操作(笔记本电脑关闭时没有电源按钮触手可及)。我们看电影,我们想点击关闭而不是输入命令。

shutdown gnome-shell 20.04

57
推荐指数
5
解决办法
1万
查看次数

在 bash 中创建一个进度条

如何使用 bash 创建进度条?

这是我的脚本:

 #!/bin/bash
 pass='number1 number12 number13 number14 number15 number16'
 chk='number14'
 for i in $pass ; do
 if [ "$i" == "$chk" ]; then
 echo ' Found ^_^'
 else
 echo 'loading 50%'
 fi
 done
Run Code Online (Sandbox Code Playgroud)

我想echo 'loading 50%'用任何东西替换来创建一个进度条。

command-line bash

14
推荐指数
3
解决办法
3万
查看次数

可以通过 DBus 触发和调用 org.freedesktop.Notifications.CloseNotification(uint id) 吗?

参考:
notify-osd 上的关闭按钮?

书签:
可以通过 DBus 触发和调用 org.freedesktop.Notifications.CloseNotification(uint id) 吗?

目前,这个脚本

dbus-monitor "interface='org.freedesktop.Notifications'" |             \
grep --line-buffered "member=Notify"                     |             \
sed -u -e  's/.*/killall notify-osd/g'                   |             \
bash
Run Code Online (Sandbox Code Playgroud)

将杀死所有待处理的通知。

最好使用 org.freedesktop.Notifications.CloseNotification(uint id). 是否有接口方法可以将它放在(在?)DBus 上以在发生特定通知事件时触发?

该方法需要获取通知 PID 以用作 的参数CloseNotification(uint id)。或者,

  qdbus    org.freedesktop.Notifications                \
          /org/freedesktop/Notifications                \
           org.freedesktop.Notifications.CloseNotification(uint id)
Run Code Online (Sandbox Code Playgroud)

如果(uint id)可以确定参数,则可以从外壳使用。实际的命令语法将使用整数代替(uint id)

也许首先要问的更好的问题可能是“如何找到通知的 DBus 地址?”。
这些都不能正确识别它:

gdbus monitor --session --dest org.freedesktop.Notifications
Run Code Online (Sandbox Code Playgroud)

返回

The name org.freedesktop.Notifications is owned by :1.130
...
Run Code Online (Sandbox Code Playgroud)

或者

dbus-monitor "interface='org.freedesktop.Notifications'"
Run Code Online (Sandbox Code Playgroud)

返回

... string …
Run Code Online (Sandbox Code Playgroud)

notification dbus

6
推荐指数
2
解决办法
2048
查看次数

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

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

情况:我在笔记本电脑上使用 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吗?用哪些参数?
它不应该是一个“正常”的通知,因为当音量改变时它必须“粘”在那里并且只是调整条形......

notification sound unity pulseaudio bluetooth

6
推荐指数
1
解决办法
1310
查看次数