commit 9b2d6b5

snow flurry  ·  2026-06-19 01:15:14 +0000 UTC
parent 08e0bab
Add option to disable "is typing" status

This adds the "show-typing" config field, which lets the user disable
the "[user] is typing..." text. By default this is enabled to match
current behavior.
3 files changed,  +30, -13
+13, -2
 1@@ -98,8 +98,9 @@ type Config struct {
 2 
 3 	Channels []string
 4 
 5-	Typings bool
 6-	Mouse   bool
 7+	ShowTypings bool
 8+	Typings     bool
 9+	Mouse       bool
10 
11 	Highlights       []string
12 	OnHighlightPath  string
13@@ -141,6 +142,7 @@ func Defaults() Config {
14 		TLS:              true,
15 		TLSSkipVerify:    false,
16 		Channels:         nil,
17+		ShowTypings:      true,
18 		Typings:          true,
19 		Mouse:            true,
20 		Highlights:       nil,
21@@ -366,6 +368,15 @@ func unmarshal(filename string, cfg *Config) (err error) {
22 			if cfg.TLS, err = strconv.ParseBool(tls); err != nil {
23 				return err
24 			}
25+		case "show-typings":
26+			var showTypings string
27+			if err := d.ParseParams(&showTypings); err != nil {
28+				return err
29+			}
30+
31+			if cfg.ShowTypings, err = strconv.ParseBool(showTypings); err != nil {
32+				return err
33+			}
34 		case "typings":
35 			var typings string
36 			if err := d.ParseParams(&typings); err != nil {
+4, -0
 1@@ -115,6 +115,10 @@ pane-widths {
 2 *tls*
 3 	Enable TLS encryption.  Defaults to true.
 4 
 5+*show-typings*
 6+	Show some text  in the status bar to let you know when others are typing.
 7+	Defaults to true.
 8+
 9 *typings*
10 	Send typing notifications which let others know when you are typing a
11 	message. Defaults to true.
+13, -11
 1@@ -59,18 +59,20 @@ func (app *App) setStatus() {
 2 	if s == nil {
 3 		return
 4 	}
 5-	ts := s.Typings(buffer)
 6 	status := ""
 7-	if 3 < len(ts) {
 8-		status = "several people are typing..."
 9-	} else {
10-		verb := " is typing..."
11-		if 1 < len(ts) {
12-			verb = " are typing..."
13-			status = strings.Join(ts[:len(ts)-1], ", ") + " and "
14-		}
15-		if 0 < len(ts) {
16-			status += ts[len(ts)-1] + verb
17+	if app.cfg.ShowTypings {
18+		ts := s.Typings(buffer)
19+		if 3 < len(ts) {
20+			status = "several people are typing..."
21+		} else {
22+			verb := " is typing..."
23+			if 1 < len(ts) {
24+				verb = " are typing..."
25+				status = strings.Join(ts[:len(ts)-1], ", ") + " and "
26+			}
27+			if 0 < len(ts) {
28+				status += ts[len(ts)-1] + verb
29+			}
30 		}
31 	}
32 	app.win.SetStatus(status)