diff --git a/config/config.go b/config/config.go index 40aab81..9d2dcaa 100644 --- a/config/config.go +++ b/config/config.go @@ -76,7 +76,8 @@ type Config struct { PlaywrightEnabled bool `toml:"PlaywrightEnabled"` PlaywrightDebug bool `toml:"PlaywrightDebug"` // !headless // CLI mode - CLIMode bool + CLIMode bool + UseNotifySend bool } func LoadConfig(fn string) (*Config, error) { diff --git a/helpfuncs.go b/helpfuncs.go index bd60547..1f0149b 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -98,6 +98,9 @@ func stripThinkingFromMsg(msg *models.RoleMsg) *models.RoleMsg { // It filters messages for the character the user is currently "writing as" // and updates the textView with the filtered conversation func refreshChatDisplay() { + if cfg.CLIMode { + return + } // Determine which character's view to show viewingAs := cfg.UserRole if cfg.WriteNextMsgAs != "" { @@ -183,6 +186,9 @@ func colorText() { } func updateStatusLine() { + if cfg.CLIMode { + return // no status line in cli mode + } status := makeStatusLine() statusLineWidget.SetText(status) } @@ -1023,3 +1029,19 @@ func GetCardByRole(role string) *models.CharCard { } return sysMap[cardID] } + +func notifySend(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() +} diff --git a/tui.go b/tui.go index 9275867..6408d41 100644 --- a/tui.go +++ b/tui.go @@ -144,6 +144,13 @@ func setShellMode(enabled bool) { // showToast displays a temporary notification in the bottom-right corner. // It auto-hides after 3 seconds. func showToast(title, message string) { + if cfg.UseNotifySend { + notifySend(title, message) + return + } + if cfg.CLIMode { + return + } sanitize := func(s string, maxLen int) string { sanitized := strings.Map(func(r rune) rune { if r < 32 && r != '\t' {