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

Add support for hiding the tab close button #13348

Merged
84 commits merged into from Aug 1, 2022
Merged

Conversation

zadjii-msft
Copy link
Member

Summary of the Pull Request

Adds support for the tab.showCloseButton property to themes. This accepts three values:

  • "always" (default): The close button acts like it does today.
  • "hover": The close button is always visible on the active tab. On inactive tabs, the close button only appears on mouse over.
  • "never": The close button is never visible. You can't close the tab with middle-click, but you can still use keyboard shortcuts to close the tab.

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

See the following two properties in WInUI that we're leveraging here.

One is a tabview-level property, the other is a per-tab-item property, hence why this code is a little wacky.

Validation Steps Performed

gifs below

https://stackoverflow.com/questions/64694722/changing-themeresources-dynamically-in-uwp

That post looked SUPER promising. Problem is though, I CANNOT for the life of me
get that to work. Like, I can't get anything to `{Binding Brush, Mode=TwoWay,
Source={StaticResource TerminalBackground}}` to the `TerminalBackground` thing I
made there. I thought that was so clever.

I wanted an easy way to just change the value of a resource and have it update
the Titlebar, but since the Titlebar isn't a child of the TerminalPage, and this
binding thing didn't work, I think I'm at a dead end.
@ghost ghost added Area-Theming Anything related to the theming of elements of the window Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. labels Jun 21, 2022
@zadjii-msft zadjii-msft added this to the Terminal v1.16 milestone Jun 21, 2022
@zadjii-msft
Copy link
Member Author

"tab.showCloseButton": "hover":
tab-showClose-hover-000

"tab.showCloseButton": "never":
tab-showClose-never-000

Base automatically changed from dev/migrie/f/702-link-tab-to-terminal to main July 7, 2022 13:26
…-close-btn

# Conflicts:
#	src/cascadia/LocalTests_SettingsModel/ThemeTests.cpp
#	src/cascadia/TerminalApp/AppLogic.cpp
#	src/cascadia/TerminalApp/AppLogic.h
#	src/cascadia/TerminalApp/TerminalPage.cpp
#	src/cascadia/TerminalApp/TerminalPage.h
#	src/cascadia/TerminalSettingsEditor/GlobalAppearance.cpp
#	src/cascadia/TerminalSettingsEditor/GlobalAppearance.h
#	src/cascadia/TerminalSettingsEditor/GlobalAppearance.idl
#	src/cascadia/TerminalSettingsEditor/GlobalAppearance.xaml
#	src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp
#	src/cascadia/TerminalSettingsModel/MTSMSettings.h
#	src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h
#	src/cascadia/TerminalSettingsModel/Theme.cpp
#	src/cascadia/TerminalSettingsModel/Theme.h
#	src/cascadia/TerminalSettingsModel/Theme.idl
#	src/cascadia/WindowsTerminal/AppHost.cpp
@zadjii-msft
Copy link
Member Author

@DHowett fyi the fix we discussed was in dab4501

Comment on lines +2732 to +2734
// This is basically the same as _updateTabCloseButton, but with some
// code moved around to better facilitate updating every tab view item
// at once
Copy link
Member

Choose a reason for hiding this comment

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

Personally, I'd rather prioritize having the code de-duplicated in case we need to make a bugfix or any code changes down the road. But that's just my 2 cents. Not gonna block over it.

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Aug 1, 2022
@ghost
Copy link

ghost commented Aug 1, 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 3d40c43 into main Aug 1, 2022
@ghost ghost deleted the dev/migrie/f/3335-tab-close-btn branch August 1, 2022 17:20
@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:

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-Theming Anything related to the theming of elements of the window 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. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Setting to hide/remove close ("x") button from tabs
3 participants