修复:wayland下无法提示

Signed-off-by: shenmo <jifengshenmo@outlook.com>
This commit is contained in:
shenmo 2023-01-16 08:52:06 +00:00 committed by Gitee
parent 7163f8ee80
commit eb38f2af05
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -3,16 +3,15 @@ LANGUAGE=en_US
# 发送通知
function notify-send() {
# Detect name of the display in use
local display=":$(ls /tmp/.X11-unix/* | sed 's#/tmp/.X11-unix/X##' | head -n 1)"
# Detect user using the display
local user=$(who | grep '('$display')' | awk '{print $1}' | head -n 1)
local user=$(who | awk '{print $1}' | head -n 1)
# Detect uid of the user
local uid=$(id -u $user)
sudo -u $user DISPLAY=$display DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus notify-send "$@"
sudo -u $user DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${uid}/bus notify-send "$@"
}
# 检测网络链接畅通
@ -102,4 +101,4 @@ if [ $update_app_number -le 0 ] ; then
fi
## 如果都是hold或者版本一致的那就直接退出否则把剩余的给提醒了
notify-send -a spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
notify-send -a spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"