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`.