Enha: enable mouse switch
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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.
|
||||
|
||||
2
main.go
2
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
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user