godot
godot copied to clipboard
Add editor shortcuts to toggle bottom panel visibility
Default shortcuts typically use the first or second letter of each word (with a few exceptions such as TileMap and TileSet to ensure consistency). Editor plugins can also specify shortcuts for their own bottom panels.
All shortcuts are nearly organized in their own section of the Editor Settings Shortcuts dialog for easy access:
One issue is that shortcuts don't work if you're currently focusing on the Tree node in either the scene tree dock or FileSystem dock. Shortcuts will work if you're focused on their filter LineEdits though. I've tried to use tb->set_shortcut_context(nullptr)
to no avail.
- This closes https://github.com/godotengine/godot-proposals/issues/380.
Preview
https://github.com/godotengine/godot/assets/180032/96dbfbe7-597a-4130-af80-97d74c2a79f7
The shortcut appears in the tooltip when the button is hovered:
I feel like a default shortcut set for every single one of those panels is overkill. Outside of the always-present 5 ones, it is also extremely unlikely that all these panels will be open at the same time
If it is later planned to use any of those Alt combinations for anything else it becomes much harder to argue with (Script Editor's CTRL + D
is already a big example right now).
Should we add them to the command palette as well? Since there are commands to switch main screens.
Yeah I agree with @Mickeon, it's probably best to leave all of the non-persistent buttons unbound and let the users bind what they need. For example I'd rarely need a hotkey for TileMap just because I don't make 2D games, Replication is only needed if you make multiplayer games, etc etc
If it is later planned to use any of those Alt combinations for anything else it becomes much harder to argue with (Script Editor's
CTRL + D
is already a big example right now).
I can change the permanent bottom panels' shortcuts to take priority over the temporary ones (in the sense that permanent bottom panels would always use the first letter as their shortcut). By the way, perhaps permanent bottom panels should be displayed differently from temporary bottom panels.
Regarding shortcuts that only use Alt as a modifier, we don't have a lot of those right now. We'd probably have much more if we had proper support for accelerators / access keys, but there are no known plans to implement those in the short term.
So first I'm not sure if this a problem per se but they are two bottom panel associated with Alt+T
The second is a real problem. On mac Option + Letter will result in special symbols.
Option + N -> ~
Option + T -> †
Option + A -> æ
Option + D -> ∂
Option + O -> œ
Option + L -> ¬
Option + E -> ê
Option + R -> ®
Option + H -> Ì
Option + I -> î
Option + P -> π
Option + T -> †
Option + M -> µ
Option + S -> Ò
I think out of all of them only the R will not trigger a writing this means whenever the script main panel is opened using those shortcuts will add some random characters in the middle of your scripts. On the other end preventing them could be catastrophic for example Option + N and Option + O are two that I use a lot when writing strings. I feel the best solution should to have different shortcuts for Mac Not 100% sure how it was handled for other Alt + Letter shortcuts that might have been added previously.
There are some default shortcuts on Mac that are different for similar reasons, so they would need to either be something else on that platform or stripped out entirely.
Can we include a shortcut to toggle? Hide current panel if visible, otherwise show last open panel. Doesn't need a default mapping but I think it's worth one. Similar thing in VSCode is ctl-j not sure why J but it does seem free to map.
Should we add them to the command palette as well? Since there are commands to switch main screens.
Done. I've also renamed shortcuts to make them easier to search.
Can we include a shortcut to toggle? Hide current panel if visible, otherwise show last open panel. Doesn't need a default mapping but I think it's worth one. Similar thing in VSCode is ctl-j not sure why J but it does seem free to map.
Good idea; I've added Ctrl + J to toggle the last opened bottom panel.
Needs rebase.
Needs rebase.
Rebased and tested again, it works as expected.
Needs a compat method binding:
Validate extension JSON: Error: Field 'classes/EditorPlugin/methods/add_control_to_bottom_panel/arguments': size changed value in new API, from 2 to 3.
Validate extension JSON: Error: Hash changed for 'classes/EditorPlugin/methods/add_control_to_bottom_panel', from D22B1750 to 069E37CD. This means that the function has changed and no compatibility function was provided.
Should we add them to the command palette as well? Since there are commands to switch main screens.
The problem is that main screens are always available, unlike bottom panels. E.g. TileMap command does nothing without TileMap.
I'm thinking, maybe instead of adding separate shortcuts to every single panel, we could do something similar to browser tabs, i.e. add shortcuts to toggle the tabs based on their index? Alt+1 to Alt+8 for example.
I prefer @KoBeWi 's suggestion by such a large margin I felt the need to communicate it as well.
I really like KobeWi suggestion but I remember some PR wanting to not show search Results in bottom panel until there is an actual search but search result is one of the first and I think bottom panels that are always there should have a fixed way to toggle them. so either we put all permanent before all other or maybe for permanent one there is a two way to access them by their index shortcut and by their spcific shortcut. Another idea based on browser is to have shortcut to go next previous panel.
I think the direct shortcuts are the most reasonable solution here. To address some the points above:
- Tabing around, unless it's a secondary or tertiary option, is the worst one, when you want to get into Otuput, FileSystem (when docked to bottom) or Animation you will need to access these repeatedly sometimes even just going from one to another and tabbing is really inconvenient as a primary method in this regard.
- Shortcuts based on position, although I was in favor of this earlier I changed my mind after giving it a try, the bottom panels position wise can change based on what is selected (TileMap node selected adds TileMap and pushes the MSBuild in C# editor build) so people who get used to ALT + 7 to open ShaderEditor will be opening TileMap instead or ALT + 8 for MSBuild willl turn into TileMap and so on.
- Expanding on 2. above, plugins can change the layout too so what next?
I believe all these are just making things more uncomfortable and less user friendly (if these would be the only ways to access these panesl! ;-)).
In general I think as long as you can invoke these panels from wherever directly and the shortcuts are customizable that could be enough (at least for now), if community finds it necessary to add alternative options that could potentially be dealt with in some later PR perhaps? Personally first thing I do when this is live is to rebind them to more comfortable positions for me thanks to having that options to begin with! <3
For panels which should not be currently available can't we just check if the panel is or isn't hidden and just do nothing when it's hidden?
PS: I'm sorry if I misudnertood the later part of the discussion and my points are moot?
For panels which should not be currently available can't we just check if the panel is or isn't hidden and just do nothing when it's hidden?
Well that's what happens currently, but you can see hidden panel options in Command Palette and they just do nothing. We don't have a way to toggle action visibility in the command palette. Maybe the solution is registering only permanent panels as commands?
Hm, maybe we could just leave it as is for the user to realize since this one is sort of realtively clear and if reports of this becoming an issue come then remove the non-permanent ones as you suggest? But I'll be honest I don't really have a way to gauge how problematic this is/isn't :D.
I'm getting some merge conflicts when trying this PR with master, is this meant for 4.3 rebase or some later 4.X version perhaps?
Rebased and squashed with the review suggestions incorporated.
I feel like a default shortcut set for every single one of those panels is overkill. Outside of the always-present 5 ones, it is also extremely unlikely that all these panels will be open at the same time
If it is later planned to use any of those Alt combinations for anything else it becomes much harder to argue with (Script Editor's
CTRL + D
is already a big example right now).
I want to echo that, I feel adding a default unique hotkey to every single panel, even some which are very contextual and only appear when a specific node is selected (like Replication, etc.) is overkill.
I would only set default hotkeys for the panels which are always present: Output, Debugger, Audio, Animation, Shader Editor, and now FileSystem since it can also be moved to the bottom panel.
The rest can have shortcuts without a default binding, so users who need them can set their own preferred bindings (e.g. for TileMap / TileSet for users who do tiles-based 2D games, or Replication for users making multiplayer games with the high level multiplayer API).
I would only set default hotkeys for the panels which are always present: Output, Debugger, Audio, Animation, Shader Editor, and now FileSystem since it can also be moved to the bottom panel.
The rest can have shortcuts without a default binding, so users who need them can set their own preferred bindings (e.g. for TileMap / TileSet for users who do tiles-based 2D games, or Replication for users making multiplayer games with the high level multiplayer API).
Done.
I see the shortucts are still there 🤔
Hm yes you forgot to push :P
Thanks!