bus-stop / x-terminal

An xterm based Atom plugin for providing terminals inside your Atom workspace.
https://atom.io/packages/x-terminal
Other
39 stars 9 forks source link

[FR] Toggle #430

Closed calvinbui closed 2 years ago

calvinbui commented 2 years ago

Describe the feature you'd like

The ability to toggle (open/close) the terminal. This was a feature in terminus.

Additional context

Default on Mac was ctrl-` : https://github.com/bus-stop/terminus/blob/master/keymaps/terminus.cson#L16

UziTech commented 2 years ago

I'm not sure "toggle" really makes sense in x-terminal. In Terminus there was only one terminal open at a time and it was in it's own panel.

X-Terminal is meant to be in a dock with other items and there can be multiple each open at the same time in different docks or even multiple open in the same dock. What does it mean to "toggle" x-terminal when it is in a doc? should it close the dock? should it activate a different item in the dock?

There is already a "focus" and "unfocus" command as well as commands to open and close docks. I think it is better for users to use the specific command that works for them.

calvinbui commented 2 years ago

The idea was there would be a key to both open and also close the terminal as needed.

Toggling on Terminus worked similar to all the other toggles Atom provided, like the Git tab or Tree view.

image
UziTech commented 2 years ago

There already is a command for Window: Toggle Bottom Dock.

UziTech commented 2 years ago

What would the "toggle" command do for a user with a setup like:

image

That is why we need the more specific commands that we already have.

the-j0k3r commented 2 years ago

I'm not sure "toggle" really makes sense in x-terminal. In Terminus there was only one terminal open at a time and it was in it's own panel.

You still can have multiple terminals just fine with terminus, You didnt have any other way to open the terminal in a specific position besides dragging it there or onto the bottom/left/righ docks but you can indeed have multiple terminals just fine. Its not as sophisticated obviously.

Capture

x-terminal you still cant map terminals to files or folders which was one of the most useful features which made more sense when toggling imo.

UziTech commented 2 years ago

@the-j0k3r so what would toggle do in the situation you are describing with multiple terminals open?

the-j0k3r commented 2 years ago

Wait, sorry I confused toggle with prev/next.

the-j0k3r commented 2 years ago

However, when you have a specific terminal open you may want to hide it, terminus just created a terminal if none existed on first toggle, there after it either hid or showed the respective terminal in focus, x-terminal just keeps creating new terminals on toggle.

I would say this could be a either or option on x-terminal, where e.g. Toggle Behavior > Create a terminal if none exists then show/hide focused terminal (terminus behaivior) Create a new terminal (x-terminal behavior)

UziTech commented 2 years ago

Which terminal should be focused or hidden on "toggle" in your image?

the-j0k3r commented 2 years ago

In that image none were focused if you notice the position of the cursor on the git portion of the commit message, But pick any.

UziTech commented 2 years ago

Seems like a command that is toggles a random terminal wouldn't be very useful. I would rather have the user use commands that already exist to toggle the one that they want.

the-j0k3r commented 2 years ago

Not a random terminal, the one which has current focus. Thats the point. You dont need yet another command terminus used Ctrl+` for both jobs, if the term is focused the hides, if not shows the one focusedd last.

UziTech commented 2 years ago

There are already commands for that. "focus" and "unfocus" are already commands that can be mapped to the same key because they are scoped to whether or not a terminal is focused.

If someone wants to work on this and come up with solutions to every possible meaning for the word "toggle" I will happily accept a PR. But I don't see how that is going to work with a single command.

P.S. I just tested "toggle" in terminus with multiple terminals open and it only toggles the one in the original pane. So if you want toggle to work the same as terminus you can just use the "Window: Toggle Bottom Dock" command.

calvinbui commented 2 years ago

i'm going back to Terminus