fix: notifications persist until clicked (30s cap via notify-send -t 30000 -u critical)
This commit is contained in:
parent
79dc1f0a7a
commit
0f674ecc9e
@ -73,7 +73,7 @@ gitflow scan -d ~ --exclude node_modules --exclude vendor
|
|||||||
gitflow scan -d ~/projects --max-depth 2 --workers 16
|
gitflow scan -d ~/projects --max-depth 2 --workers 16
|
||||||
```
|
```
|
||||||
|
|
||||||
### `watch` — periodic scan
|
### `watch` — periodic scan ---
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
gitflow watch -d ~/projects -i 30s # scan every 30 seconds
|
gitflow watch -d ~/projects -i 30s # scan every 30 seconds
|
||||||
|
|||||||
@ -8,12 +8,20 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// send prefers notify-send (Linux) and falls back to osascript (macOS).
|
// 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.
|
// If neither is installed the notification is dropped silently.
|
||||||
func send(title, body string) error {
|
func send(title, body string) error {
|
||||||
if _, err := exec.LookPath("notify-send"); err == nil {
|
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 {
|
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)
|
script := fmt.Sprintf("display notification %q with title %q", body, title)
|
||||||
return exec.Command("osascript", "-e", script).Run()
|
return exec.Command("osascript", "-e", script).Run()
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user