From 6f7381df9d176c75dc71401e9fb3f7f594738a3c Mon Sep 17 00:00:00 2001 From: Vara Rahul Rajana <123227543+rajanarahul93@users.noreply.github.com> Date: Mon, 22 Dec 2025 06:30:20 +0530 Subject: [PATCH] feat(config): add toggleable auto focus on channel select (#671) Co-authored-by: Ayyan --- cmd/guilds_tree.go | 4 +++- internal/config/config.go | 5 +++-- internal/config/config.toml | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/cmd/guilds_tree.go b/cmd/guilds_tree.go index 52c9ee0..6a2e643 100644 --- a/cmd/guilds_tree.go +++ b/cmd/guilds_tree.go @@ -194,7 +194,9 @@ func (gt *guildsTree) onSelected(node *tview.TreeNode) { app.chatView.messageInput.SetPlaceholder("You do not have permission to send messages in this channel.") } else { app.chatView.messageInput.SetPlaceholder("Message...") - app.SetFocus(app.chatView.messageInput) + if gt.cfg.AutoFocus { + app.SetFocus(app.chatView.messageInput) + } } case nil: // Direct messages folder diff --git a/internal/config/config.go b/internal/config/config.go index bbdd7c2..008acc7 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -32,8 +32,9 @@ type ( } Config struct { - Mouse bool `toml:"mouse"` - Editor string `toml:"editor"` + AutoFocus bool `toml:"auto_focus"` + Mouse bool `toml:"mouse"` + Editor string `toml:"editor"` Status discord.Status `toml:"status"` diff --git a/internal/config/config.toml b/internal/config/config.toml index 221786a..7963bf3 100644 --- a/internal/config/config.toml +++ b/internal/config/config.toml @@ -1,3 +1,7 @@ +# Whether to focus the message input automatically when a channel is selected. +# Set to false to preview channels without moving focus. +auto_focus = true + # Whether to enable mouse or not. mouse = true # The program to open when the `keys.message_input.editor` keymap is pressed. Set the value to `"default"` to use `$EDITOR`.