shithub: hell

Download patch

ref: 4785b9ebe78bb65d5d15928b0a6787fef75c0316
parent: df54b2016f928d3280d1120c4817133652d0c3a9
author: penny <penny@limitedideas.org>
date: Wed Nov 5 20:04:23 EST 2025

window titles on 9

--- a/prompt.go
+++ b/prompt.go
@@ -43,11 +43,14 @@
 func (nc *NotificationCounter) Update() (string, bool, error) {
 	unread, err := nc.client.GetUnreadNotifications(context.Background(), nil, nil, 0)
 	if err != nil {
+		nc.rl.setWindowTitle(fmt.Sprintf("%s", nc.currentuser.Acct))
 		return "", false, err
 	}
 	if unread.Count == 0 {
+		nc.rl.setWindowTitle(fmt.Sprintf("%s", nc.currentuser.Acct))
 		return "", false, nil
 	}
+	nc.rl.setWindowTitle(fmt.Sprintf("ur:%d %s", unread.Count, nc.currentuser.Acct))
 	return fmt.Sprintf("ur:%d", unread.Count), true, nil
 }
 
--- a/readline.go
+++ b/readline.go
@@ -43,3 +43,6 @@
 		io.Copy(rl.Stdout(), r)
 	}()
 }
+
+func (rl *readline) setWindowTitle(title string) {
+}
\ No newline at end of file
--- a/readline_plan9.go
+++ b/readline_plan9.go
@@ -19,6 +19,7 @@
 	config Config
 	multi  bool
 	ctl    *os.File
+	label *os.File
 }
 
 type Config struct {
@@ -38,7 +39,8 @@
 	if err != nil {
 		return nil, err
 	}
-	return &readline{config: *config, ctl: ctl}, nil
+	label, err := os.OpenFile("/dev/label", os.O_WRONLY, 0)
+	return &readline{config: *config, ctl: ctl, label: label}, nil
 }
 
 func (rl *readline) ReadLineWithConfig(cfg *Config) (string, error) {
@@ -92,3 +94,7 @@
 
 func enablePipeHack(rl *readline) {
 }
+
+func (rl *readline) setWindowTitle(title string) {
+	rl.label.WriteString(title)
+}
\ No newline at end of file
--