0%

notify-send

1. 安装

1
sudo apt install -y libnotify-bin

2. 使用

1
2
3
4
5
6
7
8
# 向桌面发送通知
notify-send [title] [message]

# 在 crontab 中需要前面加 export DISPLAY=:0.0
export DISPLAY=:0.0 && notify-send -t 3 'Stay Sober' 'Awake & Alive'

* * * * * export DISPLAY=:0.0 && export XAUTHORITY=/home/ravi/.Xauthority && sudo -u ravi /usr/bin/notify-send Hey "How are you"