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

[Feature-request] Minimize to tray #5727

Closed
manojvignesh opened this issue May 4, 2020 · 17 comments · Fixed by #10368
Closed

[Feature-request] Minimize to tray #5727

manojvignesh opened this issue May 4, 2020 · 17 comments · Fixed by #10368
Assignees
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@manojvignesh
Copy link

manojvignesh commented May 4, 2020

Description of the new feature/enhancement

Add an option to minimize to tray instead of task bar.
It can be a setting when enabled, always minimize the terminal to tray.
I also like the option in cmder where right click on close minimizes to tray in that way i have both the minimize to tray and taskbar available to me always.
It need not be exactly like right click on close button, it can be a shortcut too.

On reopening of terminal minimized to tray:
It'd be good if opening of terminal from taskbar icon reopen the minimized instance of terminal and not a new one. Though i can work around it using the win + b shortcut.

@manojvignesh manojvignesh added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label May 4, 2020
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 4, 2020
@zadjii-msft
Copy link
Member

This is an entirely reasonable feature request, one that would probably mix well with #653 and #5000. Thanks!

@zadjii-msft zadjii-msft added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Product-Terminal The new Windows Terminal. labels May 4, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 4, 2020
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone May 4, 2020
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label May 5, 2020
@NicTanghe
Copy link

Anny ita on picking this up ?
like in about how manny releases focus can shift to include this HQ feature.

@zadjii-msft
Copy link
Member

@NicTanghe Nope, no ETA, as indicated by the milestone of this issue:
image

@NeuroAssassin
Copy link

Interested in this as well, as I usually have a lot of windows open and it'd be nice to move this one out of the way.

@aalouaoui
Copy link

This is why I am still using cmder instead of windows terminal. If they add it I will switch to Windows Terminal

@Hlsgs

This comment has been minimized.

@zadjii-msft

This comment has been minimized.

@Hlsgs

This comment has been minimized.

@sarahelsaig
Copy link

Would it be okay to add a minimize to tray button at the bottom of the New Tab dropdown menu? That would make the feature (and the hotkey) intuitively discoverable as opposed to the right click on close idea which feels like a secret if you don't already come from a cmder background and expect it.

It'd be good if opening of terminal from taskbar icon reopen the minimized instance of terminal and not a new one.

I think that's covered separately by single instance mode (#2227).

@Mystik01
Copy link

If I could upvote this i would

@DHowett
Copy link
Member

DHowett commented Nov 21, 2020

@Mystik01 other folks appear to have figured out how to upvote issue comments

DD59F8CB-6F99-446F-BAF3-16C3AE3F1E62

Please use that.

@levicki
Copy link

levicki commented Jan 7, 2021

If this gets implemented please consider not breaking standard UI behavior by introducing stuff like right-click on close button but instead use minimize so it can be done using keyboard shortcuts as well.

@zadjii-msft zadjii-msft mentioned this issue Feb 24, 2021
3 tasks
ghost pushed a commit that referenced this issue Apr 21, 2021
### ⇒ [doc link](https://github.com/microsoft/terminal/blob/dev/migrie/s/653-quake-mode/doc/specs/%23653%20-%20Quake%20Mode/%23653%20-%20Quake%20Mode.md) ⇐

## Summary of the Pull Request

After reading through 114+ comments in #653 and related issues, I think I've finally wrapped my head around all the possible scenarios for quake mode. <!-- Speak now or forever hold your peace. --> This also includes "minimize to tray", because the two are a powerful combination. With the work already prototyped in [`dev/migrie/f/653-QUAKE-MODE`](https://github.com/microsoft/terminal/tree/dev/migrie/f/653-QUAKE-MODE), [I'm starting to believe](https://j.gifs.com/58vKNx.gif) that we could actually land this in 2.0.


### Abstract

> Many existing terminals support a feature whereby a user can press a keybinding
> anywhere in the OS, and summon their terminal application. Oftentimes the act of
> summoning this window is accompanied by a "dropdown" animation, where the window
> slides in to view from the top of the screen. This global summon action is often
> referred to as "quake mode", a reference to the videogame Quake who's console
> slid in from the top.
> 
> This spec addresses both of the following two issues:
> * "Quake Mode" ([#653])
> * "Minimize to tray" ([#5727])


## PR Checklist
* [x] Specs: #653, #5727
* [x] References: #5000, #4472, #2227, #7240, #8135
* [x] I work here

## Detailed Description of the Pull Request / Additional comments
_\*<sup>\*</sup><sub>\*</sub> read the spec  <sub>\*</sub><sup>\*</sup>\*_
@juventus18
Copy link

I'm using https://github.com/flyingpie/windows-terminal-quake to put WT in the tray instead of taskbar

ghost pushed a commit that referenced this issue May 18, 2021
## Summary of the Pull Request

This is a scoped implementation of "hide on minimize", only to the `_quake` window. When minimized, the `_quake` window won't appear in the taskbar. IT ALSO WON'T APPEAR IN THE TRAY, BECAUSE WE DON'T HAVE ONE YET.

I talked about this with @DHowett, and it seemed cool. Other windows will still minimize normally.

## References
* Original thread: #653
* Spec: #9274 
* megathread: #8888
* minimize to tray: #5727 

## PR Checklist
* [x] Closes https://github.com/microsoft/terminal/projects/5#card-61246940
* [x] I work here
* [ ] Tests added/passed
* [ ] Requires documentation to be updated - probably yea, but something <sub>something <sub>something</sub></sub>

## Detailed Description of the Pull Request / Additional comments

After playing with it, it is in fact, cool.

ALSO `LOG_IF_WIN32_BOOL_FALSE` should DEFINITELY not be used with `ShowWindow`. [`ShowWindow`](https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-showwindow#return-value) returns false if the window was previously hidden, but doesn't `SetLastError`, so that macro will _throw_.

## Validation Steps Performed


```jsonc
        { "keys": "ctrl+`", "command": { "action": "quakeMode" } },
        { "keys": "ctrl+1", "command": { "action": "globalSummon", "name": "_quake" } },
        // { "keys": "ctrl+1", "command": { "action": "globalSummon" } },
        // { "keys": "ctrl+2", "command": { "action": "globalSummon", "desktop": "toCurrent" } },
        // { "keys": "ctrl+2", "command": { "action": "globalSummon", "toggleVisibility": false } },
        // { "keys": "ctrl+2", "command": { "action": "globalSummon", "dropdownDuration": 2000 } },
        { "keys": "ctrl+2", "command": { "action": "globalSummon", "monitor": "any" } },
        // { "keys": "ctrl+3", "command": { "action": "globalSummon", "desktop": "onCurrent" } },
        { "keys": "ctrl+3", "command": { "action": "globalSummon", "monitor": "toMouse" } },
        // { "keys": "ctrl+4", "command": { "action": "globalSummon", "desktop": "any" } },
        { "keys": "ctrl+4", "command": { "action": "globalSummon", "monitor": "toMouse", "dropdownDuration": 500 } },
        { "keys": "ctrl+5", "command": { "action": "globalSummon", "dropdownDuration": 500 } },
```
@orcmid
Copy link

orcmid commented Jun 15, 2021

I'm a little concerned how this interacts with there being multiple terminal sessions (not tabbed), as when some app launches wired to a (new) terminal instance.

@WSLUser
Copy link
Contributor

WSLUser commented Jun 15, 2021

The logic for the tray icon will have to be updated to be smart enough to know when a new window is opened while the tray icon exists for another window and a user decides to minimize that one too, otherwise that window should be ignored. It should also provide the choices to summon a specific window or all windows (we'll need to be careful here as it could cause a large perf impact trying to restore potentially a bunch of windows and ensure they're summoned in a way to keeps resources down as much as possible).

@orcmid
Copy link

orcmid commented Jun 15, 2021

@WSLUser the task bar already handles the multiple instance case quite nicely, and indicates when there are running instances. I suspect we are asking too much of the tray, which regularly hides some instances it is keeping hot (like Discord which I can't keep from going to the tray, while Zoom at least goes to the task bar and forcing quit is easier).

@WSLUser
Copy link
Contributor

WSLUser commented Jun 16, 2021

Well there are a great many applications where what I've described occurs, usually with some kind of perf cost that can cause the machine (or monitor/GPU at least) to freeze up for a moment.

@ghost ghost added the In-PR This issue has a related PR label Jun 22, 2021
leonMSFT added a commit that referenced this issue Jul 8, 2021
This PR is a small start in a broader "Minimize to Tray" feature (#5727).
This particular change is scoped only to the scenario when a quake window
is minimized. Currently the only way to bring back the quake window
when it's minimized is to press the global hotkey again. This gives another
option - to press the terminal icon in the tray.

Eventually though, minimize to tray will be available for any window, and
I'd like more time to flesh out the general porpoise scenarios and context
menus. Having just a bit in this PR also helps reviewers by keeping it small!
@ghost ghost closed this as completed in #10368 Aug 12, 2021
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Aug 12, 2021
ghost pushed a commit that referenced this issue Aug 12, 2021
A brief summary of the behavior of the tray icon:
- There will only ever be one tray icon representing all windows.
- Left-Click on a Tray Icon brings up the MRU window.
- Right-Click on a Tray Icon brings up a Context Menu:
```
Focus Terminal
----------------
Windows --> Window ID 1 - <unnamed window>
            Named Window
            Named Window Again
 ```
- Focus Terminal will bring up the MRU window.
- Clicking on any of the Window "names" in the submenu will summon the window.

## Settings Changes

Two new global settings are introduced: `alwaysShowTrayIcon` and `minimizeToTray`. Here's a chart explaining the behavior with the two settings.

|                      | `alwaysShowTrayIcon:true`                                          | `alwaysShowTrayIcon:false`                                         |
|----------------------|------------------------------------------------------------------|------------------------------------------------------------------|
| `minimizeToTray:true`  | tray icon is always shown. minimize button will hide the window. | tray icon is always shown. minimize button will hide the window. |
| `minimizeToTray:false` | tray icon is always shown.                                       | tray icon is not shown ever.                                     |

Closes #5727

## References
[Spec for Minimize to Tray](https://github.com/microsoft/terminal/blob/main/doc/specs/%23653%20-%20Quake%20Mode/%23653%20-%20Quake%20Mode.md#minimize-to-tray)
Docs PR - MicrosoftDocs/terminal#352
#10448 - My list of TODOs
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.