elementary / terminal

Terminal emulator designed for elementary OS
https://elementary.io
GNU Lesser General Public License v3.0
413 stars 97 forks source link

`Open in Terminal` option in Files context menu does not open a new tab in Terminal, opens existing tab instead #508

Open vikasnataraja opened 4 years ago

vikasnataraja commented 4 years ago

Prerequisites

Describe the bug

If a path is already open in a Terminal tab, using the Files context menu's Open in Terminal option from the same path doesn't open a new tab but just reopens the existing tab.

To Reproduce

Steps to reproduce the behavior:

  1. Go to a folder using Files
  2. Right click -> Open in terminal
  3. Terminal tab pops up.
  4. Go back to the same folder in Files, follow step 2.
  5. Terminal opens the same tab and not a new tab

Expected behavior

Even if the existing path is already open in a Terminal tab, it should create a new tab when communicating from Files.

Platform Information

Additional context

jeremypw commented 4 years ago

This is the intended behaviour - duplicate tabs are not opened unless explicitly requested. I suspect if a duplicate tab were opened then others would raise an issue against that. There does not seem to be a clear preference here.

vikasnataraja commented 4 years ago

Is it possible to have an option to do both?The reason I ask is because I usually have multiple tabs running different processes from the same directory and it would help to open a duplicate tab from Files. If not, I could always go back to right clicking on Terminal tabs and duplicating them

jeremypw commented 4 years ago

It would be difficult to have a choice in the Files interface. About the only way to do that would be to create a new .desktop file that launched Terminal with the correct flag and give it an appropriate name. You could have a Terminal setting "create-duplicate" that if true always causes Terminal to open URLs in a new tab even if a duplicate.

jeremypw commented 4 years ago

A suitable .desktop file is:

[Desktop Entry]
Name=New Terminal Tab
GenericName=New Terminal Tab
Comment=Open a new tab in elementary Terminal
X-GNOME-Gettext-Domain=io.elementary.terminal
TryExec=io.elementary.terminal
Exec=io.elementary.terminal -t -w %u
# TRANSLATORS: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=utilities-terminal
Type=Application
MimeType=inode/directory;
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
Keywords=command;prompt;cmd;commandline;run;

Needs to be put in usr/share/applications and the run the commandline sudo update-desktop-database

Alternatively, if you always want Files to open a new tab you could edit the existing file /usr/share/applications/open-pantheon-terminal-here.desktop and change the Exec= line to the one above.

You will need admin privileges and the change will be global. Doing it on a per user basis is more complicated.

vikasnataraja commented 4 years ago

@jeremypw Confirmed, this works. I think we can close this issue now since, as you mentioned, there doesn't seem to be a consensus to make this a regular feature.