Use notify-send to send Linux desktop notifications.
Use cases
- Notify the user after a long-running task is completed
- Scheduled reminders
- Important messages that need to attract the user's attention
Installation
# Debian/Ubuntu
sudo apt install libnotify-bin
# Fedora
sudo dnf install libnotify
Arch
sudo pacman -S libnotify
## 命令参考
### 基础通知
```bash
notify-send "小搭子" "任务已完成"
Notification with icon
notify-send -i dialog-information "小搭子" "文件整理完毕"
Notification with urgency
# 低优先级
notify-send -u low "小搭子" "后台任务完成"
# 普通
notify-send -u normal "小搭子" "任务已完成"
# 紧急
notify-send -u critical "小搭子" "操作需要确认!"
Set display duration (milliseconds)
notify-send -t 5000 "小搭子" "5 秒后自动消失"
Usage guidelines
- Notification titles are uniformly "小搭子"
- Send only when a task taking > 10 seconds is completed, on error warnings, or when a scheduled task is triggered
- At most 1 completion notification per task