Bläddra i källkod

feat(config): add toggleable auto focus on channel select (#671)

Co-authored-by: Ayyan <ayn2op@gmail.com>
Vara Rahul Rajana 4 månader sedan
förälder
incheckning
6f7381df9d
3 ändrade filer med 10 tillägg och 3 borttagningar
  1. 3 1
      cmd/guilds_tree.go
  2. 3 2
      internal/config/config.go
  3. 4 0
      internal/config/config.toml

+ 3 - 1
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

+ 3 - 2
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"`
 

+ 4 - 0
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`.