From ee8cff2b41ebee97c2e091f883a01246d4a5decc Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 13 Jan 2026 00:50:38 +0300 Subject: Enha: enable mouse switch --- config.example.toml | 1 + config/config.go | 1 + docs/config.md | 3 +++ main.go | 2 +- props_table.go | 5 +++++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/config.example.toml b/config.example.toml index eb1be70..3a5401b 100644 --- a/config.example.toml +++ b/config.example.toml @@ -42,3 +42,4 @@ STT_SR = 16000 # Sample rate for audio recording DBPATH = "gflt.db" FilePickerDir = "." # Directory where file picker should start FilePickerExts = "png,jpg,jpeg,gif,webp" # Comma-separated list of allowed file extensions for file picker +EnableMouse = false # Enable mouse support in the UI diff --git a/config/config.go b/config/config.go index dc769d3..20935a2 100644 --- a/config/config.go +++ b/config/config.go @@ -64,6 +64,7 @@ type Config struct { DBPATH string `toml:"DBPATH"` FilePickerDir string `toml:"FilePickerDir"` FilePickerExts string `toml:"FilePickerExts"` + EnableMouse bool `toml:"EnableMouse"` } func LoadConfig(fn string) (*Config, error) { diff --git a/docs/config.md b/docs/config.md index f1cac5b..e1f7c90 100644 --- a/docs/config.md +++ b/docs/config.md @@ -145,6 +145,9 @@ This document explains how to set up and configure the application using the `co #### FilePickerExts (`"png,jpg,jpeg,gif,webp"`) - Comma-separated list of allowed file extensions for the file picker. +#### EnableMouse (`false`) +- Enable or disable mouse support in the UI. When set to `true`, allows clicking buttons and interacting with UI elements using the mouse, but prevents the terminal from handling mouse events normally (such as selecting and copying text). When set to `false`, enables default terminal behavior allowing you to select and copy text, but disables mouse interaction with UI elements. + ### Additional Features Those could be switched in program, but also bould be setup in config. diff --git a/main.go b/main.go index 9e619a8..c375d95 100644 --- a/main.go +++ b/main.go @@ -32,7 +32,7 @@ func main() { } pages.AddPage("main", flex, true, true) if err := app.SetRoot(pages, - true).EnableMouse(true).EnablePaste(true).Run(); err != nil { + true).EnableMouse(cfg.EnableMouse).EnablePaste(true).Run(); err != nil { logger.Error("failed to start tview app", "error", err) return } diff --git a/props_table.go b/props_table.go index d86e0b4..a235d7c 100644 --- a/props_table.go +++ b/props_table.go @@ -132,6 +132,11 @@ func makePropsTable(props map[string]float32) *tview.Table { addCheckboxRow("Auto clean tool calls from context", cfg.AutoCleanToolCallsFromCtx, func(checked bool) { cfg.AutoCleanToolCallsFromCtx = checked }) + addCheckboxRow("Enable Mouse", cfg.EnableMouse, func(checked bool) { + cfg.EnableMouse = checked + // Reconfigure the app's mouse setting + app.EnableMouse(cfg.EnableMouse) + }) // Add dropdowns logLevels := []string{"Debug", "Info", "Warn"} addListPopupRow("Set log level", logLevels, GetLogLevel(), func(option string) { -- cgit v1.2.3