Enha: native notification implementation
This commit is contained in:
16
session.go
16
session.go
@@ -168,19 +168,3 @@ func copyToClipboard(text string) error {
|
||||
cmd.Stdin = strings.NewReader(text)
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
func notifyUser(topic, message string) error {
|
||||
// Sanitize message to remove control characters that notify-send doesn't handle
|
||||
sanitized := strings.Map(func(r rune) rune {
|
||||
if r < 32 && r != '\t' {
|
||||
return -1
|
||||
}
|
||||
return r
|
||||
}, message)
|
||||
// Truncate if too long
|
||||
if len(sanitized) > 200 {
|
||||
sanitized = sanitized[:197] + "..."
|
||||
}
|
||||
cmd := exec.Command("notify-send", topic, sanitized)
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user