godot icon indicating copy to clipboard operation
godot copied to clipboard

Add editor shortcuts to toggle bottom panel visibility

Open Calinou opened this issue 1 year ago • 4 comments

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:

image

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:

image

Calinou avatar Feb 07 '24 23:02 Calinou

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).

Mickeon avatar Feb 08 '24 00:02 Mickeon

Should we add them to the command palette as well? Since there are commands to switch main screens.

kitbdev avatar Feb 08 '24 04:02 kitbdev

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

passivestar avatar Feb 08 '24 11:02 passivestar

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.

Calinou avatar Feb 08 '24 21:02 Calinou

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.

ajreckof avatar Feb 11 '24 00:02 ajreckof

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.

Mickeon avatar Feb 11 '24 21:02 Mickeon

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.

Cammymoop avatar Feb 16 '24 01:02 Cammymoop

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.

Calinou avatar Feb 16 '24 17:02 Calinou

Needs rebase.

KoBeWi avatar Feb 27 '24 22:02 KoBeWi

Needs rebase.

Rebased and tested again, it works as expected.

Calinou avatar Feb 28 '24 19:02 Calinou

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.

akien-mga avatar Feb 28 '24 21:02 akien-mga

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.

KoBeWi avatar Feb 29 '24 13:02 KoBeWi

I prefer @KoBeWi 's suggestion by such a large margin I felt the need to communicate it as well.

Mickeon avatar Feb 29 '24 14:02 Mickeon

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.

ajreckof avatar Feb 29 '24 14:02 ajreckof

I think the direct shortcuts are the most reasonable solution here. To address some the points above:

  1. 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.
  2. 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.
  3. 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?

viksl avatar Feb 29 '24 15:02 viksl

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?

KoBeWi avatar Feb 29 '24 15:02 KoBeWi

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.

viksl avatar Feb 29 '24 15:02 viksl

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?

viksl avatar Mar 04 '24 17:03 viksl

Rebased and squashed with the review suggestions incorporated.

Calinou avatar Mar 04 '24 23:03 Calinou

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).

akien-mga avatar Mar 05 '24 08:03 akien-mga

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.

Calinou avatar Mar 05 '24 13:03 Calinou

I see the shortucts are still there 🤔

KoBeWi avatar Mar 05 '24 13:03 KoBeWi

Hm yes you forgot to push :P

akien-mga avatar Mar 05 '24 13:03 akien-mga

Thanks!

akien-mga avatar Mar 05 '24 22:03 akien-mga