mirror of
https://gitee.com/spark-store-project/spark-store
synced 2025-12-14 04:42:03 +08:00
@@ -3,16 +3,15 @@ LANGUAGE=en_US
|
|||||||
|
|
||||||
# 发送通知
|
# 发送通知
|
||||||
function notify-send() {
|
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
|
# 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
|
# Detect uid of the user
|
||||||
local uid=$(id -u $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
|
fi
|
||||||
|
|
||||||
## 如果都是hold或者版本一致的那就直接退出,否则把剩余的给提醒了
|
## 如果都是hold或者版本一致的那就直接退出,否则把剩余的给提醒了
|
||||||
notify-send -a spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
|
notify-send -a spark-store "星火更新提醒" "星火商店仓库中有$update_app_number个软件包可以更新啦!请到星火商店的菜单处理"
|
||||||
Reference in New Issue
Block a user