Sublime Forum

Is show_panel toggle broken for output panels?

#1

I have this key command:

  {
    "command": "show_panel", "args": {"panel": "output.clang", "toggle": true},
    "keys": "ctrl+d", "ctrl+p"]
  }

But pressing ctrl+d,ctrl+p only shows the panel, not hides it.

What have I missed?

0 Likes

Toggle output pane with keyboard shortcut
Toggle output pane with keyboard shortcut
#2

Does it hide it the panel if you give it input focus first?

0 Likes

#3

Yes it does. Is this the intended behavior?

Personally I’d like to hide it even if it doesn’t have focus. That way I can press the key combo once to show it, then go “ah, that’s what’s happening” and then press the key combo again to hide it.

0 Likes

#4

Agreed, it’s an oversight in the way panel toggling works: all the other panels grab input focus when shown, but not the output panel

0 Likes

#5

Hmm, are we talking about the side bar here? Because I try to show/hide the side bar with the keyboard shortcut that shows up next to the menu item (View > Sidebar > Hide sidebar ⌘K, ⌘B). However, ⌘K triggers Reindent (even though there is no shortcut shown next to the menu item) and ⌘B triggers Build.

Am I missing something here?

0 Likes

#6

jps, this never started working btw. I got reminded today when a SublimeClang user opened up an issue at github for this.

0 Likes

#7

I’m facing the same with the output.exec panel, and even when the output panel has the focus, toggle does not work and seems to be ignored. The hide_panel command works, just not the toggle argument to show_panel.

Note: using Sublime Text 3 build 3083 and invoking the command on the window object of a WindowCommand object during run().

— Edit —
The same with the console panel or any user created panel, as I just wanted to check.

0 Likes

#8

For that reason, I am using this in my key bindings:

// Toggle exec output { "keys": "ctrl+f4"], "command": "show_panel", "args": {"panel": "output.exec"} }, { "keys": "ctrl+f4"], "command": "hide_panel", "args": {"panel": "output.exec"}, "context": [ { "key": "panel", "operand": "output.exec" } ] },

Can’t really do that from a plugin though.

1 Like

#9

Finally, is this a bug or a feature? :blush:

0 Likes

#10

This will not really work in the new dev build. Only shows it.

0 Likes

#11

#worksforme

0 Likes

#12

No it doesn’t. http://i.imgur.com/XM1gz7a.png

0 Likes

#13

Ah, that helps.

There needs to be an opening bracket after "context":, which was missing in my snippet above. I just edited it in.

0 Likes

#14

Is it possible to do something like that for errors too? Cycle through errors with a hotkey?

0 Likes

#15

That is already built in, on F4, assuming the build system was set up accordingly.

0 Likes

#16

For Sublime Text 3. Some summary here.

1. The toggle option is available on

(1) Find panel
(2) Find in All Files panel
(3) Incremental Find panel
(4) Replace panel
(5) Console panel

For example, you can set

{
  "keys": ["alt+`"],
  "command": "show_panel",
  "args": {
    "panel": "console",
    "toggle": true
  }
}

so that with alt + ` you can toggle (show or hide) the console panel.

2. Unfortunately, the toggle option does not work in other panels, including the built-in

(1) Find in All Files Results panel (output.find_results)
(2) Build Results panel (output.exec)

The workaround is as @FichteFoll put it - to assign the show_panel and hide_panel commands to the same shortcut key. For example,

[
  {
    "keys": ["alt+v"],
    "command": "show_panel",
    "args": {
      "panel": "output.exec"
    }
  },
  {
    "keys": ["alt+v"],
    "command": "hide_panel",
    "args": {
      "panel": "output.exec"
    },
    "context": [{
        "key": "panel", "operand": "output.exec"
      }]
  }
]

so that with alt + v you can toggle (show or hide) the Build Results (output.exec) panel.

Note the show_panel is an unconditional command, whereas the hide_panel here is a conditional command which only happens in certain context. So the order of the two matters - you should put hide_panel after show_panel, otherwise show_panel will prevail in all circumstances and the conditional hide_panel won’t work.

1 Like