Merge polecat/Praetorian: tmux notification banner (gt-vnp9)
This commit is contained in:
@@ -83,7 +83,7 @@ func (r *Router) GetMailbox(address string) (*Mailbox, error) {
|
||||
}
|
||||
|
||||
// notifyRecipient sends a notification to a recipient's tmux session.
|
||||
// Uses display-message for non-disruptive notification.
|
||||
// Uses send-keys to echo a visible banner to ensure notification is seen.
|
||||
// Supports mayor/, rig/polecat, and rig/refinery addresses.
|
||||
func (r *Router) notifyRecipient(msg *Message) error {
|
||||
sessionID := addressToSessionID(msg.To)
|
||||
@@ -97,9 +97,8 @@ func (r *Router) notifyRecipient(msg *Message) error {
|
||||
return nil // No active session, skip notification
|
||||
}
|
||||
|
||||
// Display notification in status line (non-disruptive)
|
||||
notification := fmt.Sprintf("[MAIL] From %s: %s", msg.From, msg.Subject)
|
||||
return r.tmux.DisplayMessageDefault(sessionID, notification)
|
||||
// Send visible notification banner to the terminal
|
||||
return r.tmux.SendNotificationBanner(sessionID, msg.From, msg.Subject)
|
||||
}
|
||||
|
||||
// addressToSessionID converts a mail address to a tmux session ID.
|
||||
|
||||
@@ -227,6 +227,22 @@ func (t *Tmux) DisplayMessageDefault(session, message string) error {
|
||||
return t.DisplayMessage(session, message, 5000)
|
||||
}
|
||||
|
||||
// SendNotificationBanner sends a visible notification banner to a tmux session.
|
||||
// This interrupts the terminal to ensure the notification is seen.
|
||||
// Uses echo to print a boxed banner with the notification details.
|
||||
func (t *Tmux) SendNotificationBanner(session, from, subject string) error {
|
||||
// Build the banner text
|
||||
banner := fmt.Sprintf(`echo '
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
📬 NEW MAIL from %s
|
||||
Subject: %s
|
||||
Run: bd mail inbox
|
||||
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
'`, from, subject)
|
||||
|
||||
return t.SendKeys(session, banner)
|
||||
}
|
||||
|
||||
// GetSessionInfo returns detailed information about a session.
|
||||
func (t *Tmux) GetSessionInfo(name string) (*SessionInfo, error) {
|
||||
format := "#{session_name}|#{session_windows}|#{session_created_string}|#{session_attached}"
|
||||
|
||||
Reference in New Issue
Block a user