Sublime Forum

Know if a quick panel is shown

#1

Hi,
is there any way to know, within a plugin, if a quickpanel is currently shown ? And if there is one, how can I close it ? The only way I’m able to know if a quick panel is visible is with the key bindings, using a context, but I’d like to implement a better way to perform this…

0 Likes

#2

Did you ever figure this out? I am also interested in this.

0 Likes

#3

you can use:
view.settings().get( "is_widget" )
 



 
from Unofficial Docs > Settings > System:

is_widget
Returns true if the buffer is an input field in a dialog, as opposed to a regular buffer.

 
This returns True for any input field in:

  • QuickPanel
  • Find/Replace
  • InputPanel
  • Console
1 Like

#4

Just a little addition from a slightly different approach.

You can also prevent a command from being run by a key binding if a panel has the focus, or if the overlay or auto-complete is visible. Here’s an example:

{ "keys": ["ctrl+whatever"], "command": "do_something", "context":
    [
        { "key": "panel_has_focus", "operator": "equal", "operand": false },
        { "key": "overlay_visible", "operator": "equal", "operand": false },
        { "key": "auto_complete_visible", "operator": "equal", "operand": false }
    ]
}
2 Likes