commit c7858c8
fia
·
2026-06-23 18:37:33 +0000 UTC
parent fa4af97
add config option "buttons" Allows turning off mouse buttons in the UI while still leaving mouse support enabled. Defaults to true to match current behaviour.
4 files changed,
+25,
-3
M
app.go
+7,
-1
1@@ -189,6 +189,7 @@ func NewApp(cfg Config) (app *App, err error) {
2 }
3
4 mouse := cfg.Mouse
5+ buttons := cfg.Buttons
6
7 app.win, app.cfg.Colors, err = ui.New(ui.Config{
8 NickColWidth: cfg.NickColWidth,
9@@ -201,6 +202,7 @@ func NewApp(cfg Config) (app *App, err error) {
10 return app.completions(cursorIdx, text)
11 },
12 Mouse: mouse,
13+ Buttons: buttons,
14 MergeLine: func(former *ui.Line, addition ui.Line) {
15 app.mergeLine(former, addition)
16 },
17@@ -640,7 +642,11 @@ func (app *App) handleUIEvent(ev interface{}) bool {
18 }
19
20 func (app *App) handleMouseEvent(ev vaxis.Mouse) {
21- const memberItems = 3
22+ memberItems := 3
23+ if !app.cfg.Buttons {
24+ memberItems = 0
25+ }
26+
27 x, y := ev.Col, ev.Row
28 w, h := app.win.Size()
29
+11,
-0
1@@ -102,6 +102,7 @@ type Config struct {
2 Typings bool
3 Mouse bool
4 NickPrefix bool
5+ Buttons bool
6
7 Highlights []string
8 OnHighlightPath string
9@@ -147,6 +148,7 @@ func Defaults() Config {
10 NickPrefix: true,
11 Typings: true,
12 Mouse: true,
13+ Buttons: true,
14 Highlights: nil,
15 OnHighlightPath: "",
16 OnHighlightBeep: false,
17@@ -397,6 +399,15 @@ func unmarshal(filename string, cfg *Config) (err error) {
18 if cfg.Mouse, err = strconv.ParseBool(mouse); err != nil {
19 return err
20 }
21+ case "buttons":
22+ var buttons string
23+ if err := d.ParseParams(&buttons); err != nil {
24+ return err
25+ }
26+
27+ if cfg.Buttons, err = strconv.ParseBool(buttons); err != nil {
28+ return err
29+ }
30 case "nick-prefix":
31 var nickPrefix string
32 if err := d.ParseParams(&nickPrefix); err != nil {
+4,
-0
1@@ -132,6 +132,10 @@ pane-widths {
2 buffer. Only the highest-priority prefix is shown. Has no effect in
3 private query buffers. Defaults to false.
4
5+*buttons*
6+ Enable or disable mouse buttons in the UI. Defaults to true.
7+ Has no effect without mouse set to true.
8+
9 *colors* { ... }
10 Settings for colors of different UI elements.
11
M
ui/ui.go
+3,
-2
1@@ -25,6 +25,7 @@ type Config struct {
2 TextMaxWidth int
3 AutoComplete func(cursorIdx int, text []rune) []Completion
4 Mouse bool
5+ Buttons bool
6 MergeLine func(former *Line, addition Line)
7 Colors ConfigColors
8 LocalIntegrations bool
9@@ -862,7 +863,7 @@ func (ui *UI) drawVerticalMemberList(vx *Vaxis, x0, y0, width, height int, b *bu
10 width--
11 clearArea(vx, x0, y0, width, height)
12
13- if _, channel := ui.bs.Current(); channel == "" && ui.config.Mouse {
14+ if _, channel := ui.bs.Current(); channel == "" && ui.config.Mouse && ui.config.Buttons {
15 x := x0 + 1
16 printString(vx, &x, y0, Styled("Help", vaxis.Style{
17 Foreground: ui.config.Colors.Status,
18@@ -907,7 +908,7 @@ func (ui *UI) drawVerticalMemberList(vx *Vaxis, x0, y0, width, height int, b *bu
19 y0++
20 height--
21
22- if ui.config.Mouse {
23+ if ui.config.Mouse && ui.config.Buttons {
24 var actions []string
25 if b.muted {
26 actions = append(actions, "→ Unmute")