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

-t opens two tabs when no windows are open #498

Open
GammaGames opened this issue Apr 3, 2020 · 12 comments
Open

-t opens two tabs when no windows are open #498

GammaGames opened this issue Apr 3, 2020 · 12 comments

Comments

@GammaGames
Copy link

GammaGames commented Apr 3, 2020

Using the command io.elementary.terminal -t opens two tabs if non are currently open.

To Reproduce

  1. Add custom keyboard shortcut for io.elementary.terminal -t in the settings app
  2. Close all terminal windows
  3. Press shortcut
  4. Notice there are two tabs

Expected behavior

If there is currently no open terminal, it should just create the single window with the single tab

Screenshots or screen recordings

Screen record from 2020-04-03 11 35 47

Platform Information

image

x I'm using the latest released stable version

@GammaGames
Copy link
Author

Maybe related to #356 too, but different in that right clicking a folder and opening it in terminal opens one tab in your home directory and the second tab in the target directory.

@t0suj4
Copy link

t0suj4 commented Jan 4, 2021

The same problem appears when open with --new-window and --execute=<command>

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 4, 2021

On elementary 6.0 I am getting two extra tabs 😞 when io.elementary.terminal -t is launched with a custom shortcut. But only one extra tab when launched from the commandline (of a different app).

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 4, 2021

This may be the result of a recent commit #478

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 4, 2021

Weirdly, launching e.g. io.elementary.terminal -w ~/Documents with a custom shortcut also opens three tabs - all at ~ not ~/Documents. Launching the same command from e.g. xterm opens a single tab at ~/Documents as expected.

So there seems something amiss with the way custom shortcuts work with Terminal.

@GammaGames
Copy link
Author

Is there a way to open a new window on the current desktop, or add a new tab if one already exists? I would love for ctrl+T to be more useful

@jeremypw
Copy link
Collaborator

jeremypw commented Dec 6, 2024

In OS7.1 you can open a new window with the "New Window" item in the dock context menu for Terminal. This opens a new window on the current workspace (even if Terminal is already open on another workspace). There is a keyboard shortcut <Shift><Control>N for opening a new window when a Terminal window is focussed but unfortunately it is currently broken (see #814 ) and a fix is awaiting approval (see #816). You can also drag a tab out of a Terminal window and drop onto the desktop to create a new window containing that tab. Starting Terminal from the commandline pretty much always restored any tabs you had open when Terminal was closed unless the "Privacy/History" setting is off.

There has been a fair amount work on this aspect of terminal since this issue was raised and OS5.1 is no longer supported so I think I'll close it. Please feel free to raise a new issue for OS7.1 or OS8 regarding new window issues.

@jeremypw jeremypw closed this as completed Dec 6, 2024
@GammaGames
Copy link
Author

The exact behavior from my initial issue is still present in 8.

@GammaGames
Copy link
Author

Peek 2024-12-06 16-19

@jeremypw jeremypw reopened this Dec 6, 2024
@jeremypw
Copy link
Collaborator

jeremypw commented Dec 6, 2024

Sorry, I didn't see the original issue was different from the latest message - I'll reopen.

The problem is, the last time the relevant code was revised there was no consensus as to what the "correct" behaviour should be 😞 : At present Terminal does a "normal" startup (which either restores previous tabs or creates a default tab) and then carries out the option in a new tab. This is annoying but in most cases not a problem. I could try proposing a PR that changes the behaviour or maybe introduce a "--no-restore" option?

@jeremypw
Copy link
Collaborator

jeremypw commented Dec 6, 2024

@danirabbit Is there a reason Terminal always shows restored or default tabs as well as the requested tab when started from the commandline?

@GammaGames
Copy link
Author

That makes sense for being the reason since the option says -t, --new-tab Open a new terminal tab at current working directory! It's very handy when a window is already open but a little weird when not 😅 if the flag is added I'll happily change my command, thanks for looking into it!

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

No branches or pull requests

3 participants