Enha: enable mouse switch

This commit is contained in:
Grail Finder
2026-01-13 00:50:38 +03:00
parent 9f61c6e793
commit ee8cff2b41
5 changed files with 11 additions and 1 deletions

View File

@@ -42,3 +42,4 @@ STT_SR = 16000 # Sample rate for audio recording
DBPATH = "gflt.db" DBPATH = "gflt.db"
FilePickerDir = "." # Directory where file picker should start FilePickerDir = "." # Directory where file picker should start
FilePickerExts = "png,jpg,jpeg,gif,webp" # Comma-separated list of allowed file extensions for file picker FilePickerExts = "png,jpg,jpeg,gif,webp" # Comma-separated list of allowed file extensions for file picker
EnableMouse = false # Enable mouse support in the UI

View File

@@ -64,6 +64,7 @@ type Config struct {
DBPATH string `toml:"DBPATH"` DBPATH string `toml:"DBPATH"`
FilePickerDir string `toml:"FilePickerDir"` FilePickerDir string `toml:"FilePickerDir"`
FilePickerExts string `toml:"FilePickerExts"` FilePickerExts string `toml:"FilePickerExts"`
EnableMouse bool `toml:"EnableMouse"`
} }
func LoadConfig(fn string) (*Config, error) { func LoadConfig(fn string) (*Config, error) {

View File

@@ -145,6 +145,9 @@ This document explains how to set up and configure the application using the `co
#### FilePickerExts (`"png,jpg,jpeg,gif,webp"`) #### FilePickerExts (`"png,jpg,jpeg,gif,webp"`)
- Comma-separated list of allowed file extensions for the file picker. - 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 ### Additional Features
Those could be switched in program, but also bould be setup in config. Those could be switched in program, but also bould be setup in config.

View File

@@ -32,7 +32,7 @@ func main() {
} }
pages.AddPage("main", flex, true, true) pages.AddPage("main", flex, true, true)
if err := app.SetRoot(pages, 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) logger.Error("failed to start tview app", "error", err)
return return
} }

View File

@@ -132,6 +132,11 @@ func makePropsTable(props map[string]float32) *tview.Table {
addCheckboxRow("Auto clean tool calls from context", cfg.AutoCleanToolCallsFromCtx, func(checked bool) { addCheckboxRow("Auto clean tool calls from context", cfg.AutoCleanToolCallsFromCtx, func(checked bool) {
cfg.AutoCleanToolCallsFromCtx = checked 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 // Add dropdowns
logLevels := []string{"Debug", "Info", "Warn"} logLevels := []string{"Debug", "Info", "Warn"}
addListPopupRow("Set log level", logLevels, GetLogLevel(), func(option string) { addListPopupRow("Set log level", logLevels, GetLogLevel(), func(option string) {