Sublime Forum

Open console without focusing it

#1
  • I often open console with show_panel just to see the output
  • I rarely actually want to run commands there

But I always lose focus to the new console panel
Is there an option to show this console panel, but don’t let it steal focus?

Thank you

0 Likes

#2

There’s no way to currently do that with the show_panel command, however you could use the chain command to open the console and then focus the first group, eg:

	{
		"keys": ["ctrl+`"],
		"command": "chain",
		"args": {
			"commands": [
				{ "command": "show_panel", "args": {"panel": "console", "toggle": true} },
				{ "command": "focus_group", "args": { "group": 0 } },
			],
		},
		"context": [
			{"key": "panel", "operator": "not_equal", "operand": "console"},
		]
	}
2 Likes

#3

thought it’s incomplete, it does show without focus, but it doesn’t hide, need a separate keybind for when panel is shown

  {"keys":["ctrl+c"]               	,"command":"chain","args":{"commands":[
   {"command":"show_panel"         	,"args":{"panel":"console","toggle":true}},
   {"command":"focus_group"        	,"args":{"group":0}},],},
   "context":[{"key":"panel"       	,"operator":"not_equal","operand":"console"},]},
  {"keys":["ctrl+c"]               	,"command":"hide_panel"	,"args":{"panel":"console"},
   "context":[{"key":"panel"       	,"operator":"equal","operand":"console"},]},
0 Likes

#4

You can also do it with a single keybind:

	{
		"keys": ["ctrl+`"],
		"command": "chain",
		"args": {
			"commands": [
				{ "command": "show_panel", "args": {"panel": "console", "toggle": true, "toggle_when_not_focused": true} },
				{ "command": "focus_group", "args": { "group": 0 } },
			],
		}
	},
2 Likes

#5

Note, that focus_group(group 0) only works as expected with the first group having been focused before. If another group had focus, it looses it.

A plugin providing a command such as focus_active_sheet is required to be able to re-focus most recently active group.

see: Switch focus away from sublime console on pressing F9

3 Likes

#6

One downside of the great plugin is that you can’t open console immediately on login before ST has loaded all the plugins (which is sometimes useful to track startup errors)
Is there a way to trick the loader to use the less precise keybind first, but then when the plugin is loaded, use its command instead? Tried to put keybinds into variously named folders ,but I think keybind loading is not dependent on the python plugin loading?, so it didn’t help

0 Likes