fix: notifications persist until clicked (30s cap via notify-send -t 30000 -u critical)

This commit is contained in:
dimitar 2026-08-02 09:46:45 +02:00
parent 79dc1f0a7a
commit 0f674ecc9e
2 changed files with 10 additions and 2 deletions

View File

@ -73,7 +73,7 @@ gitflow scan -d ~ --exclude node_modules --exclude vendor
gitflow scan -d ~/projects --max-depth 2 --workers 16
```
### `watch` — periodic scan
### `watch` — periodic scan ---
```bash
gitflow watch -d ~/projects -i 30s # scan every 30 seconds

View File

@ -8,12 +8,20 @@ import (
)
// send prefers notify-send (Linux) and falls back to osascript (macOS).
// Notifications persist until clicked, with a 30-second cap.
// If neither is installed the notification is dropped silently.
func send(title, body string) error {
if _, err := exec.LookPath("notify-send"); err == nil {
return exec.Command("notify-send", "-a", "gitflow", "--", title, body).Run()
return exec.Command("notify-send",
"-a", "gitflow",
"-t", "30000", // 30 s timeout
"-u", "critical", // persist until clicked on most DEs
"--", title, body,
).Run()
}
if _, err := exec.LookPath("osascript"); err == nil {
// display notification has no built-in timeout; the system
// Notification Center settings control dismissal behaviour.
script := fmt.Sprintf("display notification %q with title %q", body, title)
return exec.Command("osascript", "-e", script).Run()
}