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

Setting for hide window when it loses focus #13478

Merged
3 commits merged into from
Jul 14, 2022
Merged

Setting for hide window when it loses focus #13478

3 commits merged into from
Jul 14, 2022

Conversation

davidegiacometti
Copy link
Contributor

@davidegiacometti davidegiacometti commented Jul 10, 2022

Summary of the Pull Request

Added setting for for hide window when it loses focus.
Works on normal window and quake window.

References

PR Checklist

  • Closes Terminal should be able to auto-minimize on focus lost #10660
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo and link it here: #xxx
  • Schema updated.
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

  • Enable Settings > Appearance > Automatically hide window
  • Terminal window should be minimized on taskbar when it loses focus
  • Quake window should be minimized on system tray when it loses focus
  • Enable also Settings > Appearance > Hide Terminal in the notification area when it is minimized
  • Terminal window should be minimized on system tray when it loses focus
  • Quake window should be minimized on system tray when it loses focus

@ghost ghost added Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Jul 10, 2022
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for whipping this up!

This is gonna sound super annoying, but I actually envisioned this as a setting that's not only restricted to the quake window. Like, I'd bet there are plenty of folks that want their non _quake windows to also minimize on focus lost.

Ultimately, that would mostly mean the following changes to this PR:

  1. A super tedious string replace to replace most of the autoHideQuakeWindow with autoHideWindow
  2. (trickier): Right now, you just call HideWindow, which SW_HIDEs the window. For the quake window, that's fine, cause the quake window always hides on minimize. For other windows, that might not always work. We don't want to hide these windows unless minimizeToNotificationArea is also enabled.

That would let this setting affect any window, regardless of whether you're in the quake window or not. Now, there's more discussion to be had over if we should opt the quake window into this behavior by default (like we do for focus mode, etc). I'm leaning no, with us relying on #9992 for enabling separate window-name-settings. But I'm also open to discussion on this one.

Does that all make sense? If not, I can try and clarify. Overall, the code looks great. It's plumbed through all the right layers, it's in the settings UI, everythink here is otherwise :chef_kiss:

src/cascadia/WindowsTerminal/IslandWindow.cpp Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 11, 2022
@davidegiacometti
Copy link
Contributor Author

davidegiacometti commented Jul 11, 2022

Thank you @zadjii-msft
I was trying to figure out if this setting had to affect quake window only: does it make sense to minimize to taskbar or system tray the normal terminal window when it lose focus? I will update the PR if this is the wanted behaviour.

EDIT: I have updated the PR. Works with both window (normal Terminal and quake) and also consider the tray icon setting.

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jul 11, 2022
@davidegiacometti davidegiacometti changed the title Setting for hide quake window on focus lost Setting for hide window when it loses focus Jul 11, 2022
Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

easy-button.jpg

Thanks for nearing with us! This looks great to me. You're gonna make a lot of people happy 😄

@zadjii-msft zadjii-msft removed their assignment Jul 14, 2022
@zadjii-msft zadjii-msft added AutoMerge Marked for automatic merge by the bot when requirements are met and removed Product-Terminal The new Windows Terminal. labels Jul 14, 2022
@ghost
Copy link

ghost commented Jul 14, 2022

Hello @zadjii-msft!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 56016c9 into microsoft:main Jul 14, 2022
@davidegiacometti davidegiacometti deleted the issue-10660 branch July 14, 2022 19:36
@jvincent-siplay
Copy link

Hi, is it possible to enable this only for quake windows? I'd like my normal windows to act normal (minimize to taskbar, no auto-minimize) and just my quake window to auto-hide when it loses focus.

@zadjii-msft
Copy link
Member

@jvincent-siplay at the moment, no. We're tracking that in #9992.

@ghost
Copy link

ghost commented Sep 13, 2022

🎉Windows Terminal Preview v1.16.252 has been released which incorporates this pull request.:tada:

Handy links:

@pas-de-2
Copy link

pas-de-2 commented Nov 4, 2022

I don't understand the logic of why this should effect normal terminal windows. Auto hiding is non-standard behavior for windowed applications, while at the same time it makes little sense why a Quake console should stay open on losing focus. Either option as its currently configured ends up compromising the other for normal use cases.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Remoting Communication layer between windows. Often for windowing behavior, quake mode, etc. Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terminal should be able to auto-minimize on focus lost
5 participants