Added hotkeys to switch between editor and terminal panels#55
Open
Shadraze wants to merge 3 commits intomarkeel:mainfrom
Open
Added hotkeys to switch between editor and terminal panels#55Shadraze wants to merge 3 commits intomarkeel:mainfrom
Shadraze wants to merge 3 commits intomarkeel:mainfrom
Conversation
Added hotkeys to switch between editor and terminal panels
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Added a bottom panel toggle hotkey
Default hotkey is Alt+T. Implementation is done using one of the built-in EditorPlugin methods for bottom panel. Terminal will be focused automatically when toggling on the panel.
2. Added a bottom panel focus hotkey
Originally, coming back to the terminal after leaving it to use some other editor window requires a mouse click which is awkward for a keyboard focused workflow. Using this, one can be in any other part of the editor and get directly into the terminal, as long as the bottom panel is toggled on.
Default hotkey is Ctrl+T. Implementation is done using an offscreen Button added via code and hidden from view via clipping with a parent Control. Pressing the hotkey, triggers the Button as Buttons can be attached with a Shortcut. Reason for using this approach vs processing InputEvents is that if the user sets the hotkey with Physical Key, it may not trigger as the editor doesn't trigger key inputs as Physical Key. Buttons work with them by default.
3. Added a switch to the main panel hotkey
Default hotkey is Ctrl+F6. There is no separate focusing hotkey needed as, unlike the bottom panel, this doesn't toggle out of view. Implementation is done with an offscreen Button that accesses the EditorInterface singleton to switch to the panel and then it is automatically focus it. The offscreen Button approach is also helpful here as once the terminal is out of view, its Controls don't process input, an offscreen Button added to the parent Control(should be Main Screen's VBoxContainer) can still receive the hotkey.
All hotkeys can be changed in Editor Settings without needing a reload. Only a single InputKeyEvent is used per hotkey currently, since it might not be useful to have multiple keybinds for the same thing in the editor. The keybinds for corresponding panel won't do anything if you choose to not include it in the layout.
Lastly, one important default keybind to keep in mind for a more keyboard focused workflow is the Ctrl+Tab keybind, which is able to get you out of the terminal. Although this seems to have nothing to do with the terminal implementation, its default behavior of tabbing to previous Controls can get you out of the terminal without using the mouse.
TL;DR:
Added:
Alt+T -> Toggle bottom panel terminal
Ctrl+T -> Focus bottom panel terminal (further keypresses go to terminal)
Ctrl+F6 -> Switch to main screen terminal
Built-in editor keybind to use alongside:
Ctrl+Tab -> Unfocus whichever terminal is focused into