Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "Open Terminal Here" context menu option to the FileSystem dock #6994

Closed
cyber-amr opened this issue Jun 1, 2023 · 7 comments · Fixed by godotengine/godot#85923
Closed
Milestone

Comments

@cyber-amr
Copy link

cyber-amr commented Jun 1, 2023

Describe the project you are working on

An action-adventure survival game

*This feature should help in the development process of any other game though*

Describe the problem or limitation you are having in your project

Every time I needed to use the terminal for whatever reason (running git or any other CLI software) I had to open the terminal manually (or simply Ctrl + Alt + T) then manually navigate to the project directory using cd path/godot/project (witch I most keep remembering the path) then finally do whatever I wanted

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Add a shortcut or simply an option in the select menu (when pressing RMB on the file system dock) to open the terminal in the project directory quickly

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

When the user right clicks on the the file system dock show an option to Open terminal here beside the Open in file manager option which will open a new terminal in the project directory res://. and if the user right clicks on a folder it should open a terminal in that folder.
image

If this enhancement will not be used often, can it be worked around with a few lines of script?

I'm sure it will be used quite often

Is there a reason why this should be core and not an add-on in the asset library?

This feature is in every file manager out of the box even in file managers that is not developer-focused (like the windows file manager)
It makes sense to add it considering it's an improvement to the editor workflow as a whole

@Calinou
Copy link
Member

Calinou commented Jun 1, 2023

Notes:

  • Windows should use PowerShell by default for consistency with default Windows behavior (and VS Code). It can be overridden for cmd.exe using the editor setting mentioned below.
  • Linux should use the default system terminal, which can't be easily retrieved: https://superuser.com/questions/1153988/find-the-default-terminal-emulator
  • The option should be hidden on Android and web platforms, as you can't open a terminal on those platforms (not counting Termux on Android, but I don't think it can be invoked externally on arbitrary folders).
  • There should be an editor setting to override the command run, so you can choose a non-default terminal.

Edit: I have a WIP branch at https://github.com/Calinou/godot/tree/editor-filesystem-dock-add-open-in-terminal. I couldn't figure out how to make it work on Windows though, for either PowerShell or cmd. Nothing happens when I try to OS.execute() either powershell or cmd, despite not getting an error (so the executable is found).

@yosoyfreeman
Copy link

yosoyfreeman commented Jun 1, 2023

I think this would be really useful on windows, as i remember that the use of terminals there is much more hidden.
I just would like to make a consideration about linux implementation:

As Calinou said, retrieving terminals in linux from the default settings is usually difficult and varies a lot from a dristro to another. Even done right, this would be a duplication of a function already present of most Linux file explorers, which you can already open with "Open in file manager" and click "open a terminal here". At least from DE perspective(I tend to adhere to the Gnome philosophy of one app handling one thing, so I'm not impartial here), i find the current way of doing this in Linux super easy and quick, so maybe disabling it in linux by default (But keeping it as an option) would result in a more clean experience.

@Calinou
Copy link
Member

Calinou commented Jun 1, 2023

i find the current way of doing this in Linux super easy and quick, so maybe disabling it in linux by default (But keeping it as an option) would result in a more clean experience.

I wouldn't disable this by default on Linux. It's better to open a "wrong" (i.e. non-default) terminal choice than not having any option for doing so at all out of the box. That said, we can probably get the choice right in most cases without too much trouble.

@Calinou Calinou changed the title Open terminal here (in the file system dock) Add a "Open Terminal Here" context menu option to the FileSystem dock Jun 1, 2023
@ZynosStudios

This comment was marked as off-topic.

@Calinou
Copy link
Member

Calinou commented Jun 8, 2023

@ZynosStudios Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead.

@sosasees
Copy link

sosasees commented Dec 8, 2023

It's better to open a "wrong" (i.e. non-default) terminal choice than not having any option for doing so at all out of the box. That said, we can probably get the choice right in most cases without too much trouble.

when in doubt, add a 'Terminal Executable' editor setting
that is empty by default so that Godot looks for the default terminal
but can be filled so Godot uses the chosen terminal

@Calinou
Copy link
Member

Calinou commented Dec 8, 2023

when in doubt, add a 'Terminal Executable' editor setting
that is empty by default so that Godot looks for the default terminal
but can be filled so Godot uses the chosen terminal

This is what I did in the WIP branch I linked 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants