[PR #13348] [MERGED] Add support for hiding the tab close button #29490

Open
opened 2026-01-31 09:35:13 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/13348
Author: @zadjii-msft
Created: 6/21/2022
Status: Merged
Merged: 8/1/2022
Merged by: @undefined

Base: mainHead: dev/migrie/f/3335-tab-close-btn


📝 Commits (10+)

  • 15e4fd9 Settings project builds at least
  • 7e0ae35 this fixes the App bits as well
  • 00c135b on reload, this changes the BG of the titlebar, but not the tab view
  • b4cd7b3 this is better. Apphost is gonna need to be involved anyways so fuck it
  • 9627483 okay so i bet that resource changed. Whatever, we'll work with it.
  • 84805f5 dumbly accept alpha channel in colors
  • 9670d13 mica works, but the titlebar looks DUMB
  • c555e6e this did seem to work, but will it work for acrylic?
  • 01f07be okay so you can't change a solid brush to an acylic one at runtime
  • ee9333a A pile of dead ends.

📊 Changes

6 files changed (+124 additions, -5 deletions)

View changed files

📝 src/cascadia/TerminalApp/TabManagement.cpp (+3 -0)
📝 src/cascadia/TerminalApp/TerminalPage.cpp (+100 -3)
📝 src/cascadia/TerminalApp/TerminalPage.h (+1 -0)
📝 src/cascadia/TerminalSettingsModel/MTSMSettings.h (+3 -2)
📝 src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h (+9 -0)
📝 src/cascadia/TerminalSettingsModel/Theme.idl (+8 -0)

📄 Description

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


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/13348 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 6/21/2022 **Status:** ✅ Merged **Merged:** 8/1/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/f/3335-tab-close-btn` --- ### 📝 Commits (10+) - [`15e4fd9`](https://github.com/microsoft/terminal/commit/15e4fd9be96079e9ef1d5114ee3a2d441b7a4aef) Settings project builds at least - [`7e0ae35`](https://github.com/microsoft/terminal/commit/7e0ae358fba206c10663a829fcbbee97a2477732) this fixes the App bits as well - [`00c135b`](https://github.com/microsoft/terminal/commit/00c135b4d44cdf5684fa5ce895e9ecf257dc1b8d) on reload, this changes the BG of the titlebar, but not the tab view - [`b4cd7b3`](https://github.com/microsoft/terminal/commit/b4cd7b3d71adba9bfa93aa4362513b5d1eeb5a7d) this is better. Apphost is gonna need to be involved anyways so fuck it - [`9627483`](https://github.com/microsoft/terminal/commit/9627483f5668531bce053ef5eafd75f3bec3cbf4) okay so i bet that resource changed. Whatever, we'll work with it. - [`84805f5`](https://github.com/microsoft/terminal/commit/84805f59aab864cb91256d85395d32d932955d1f) dumbly accept alpha channel in colors - [`9670d13`](https://github.com/microsoft/terminal/commit/9670d139a6449ea3e0a79f1006127271d0f3c733) mica works, but the titlebar looks DUMB - [`c555e6e`](https://github.com/microsoft/terminal/commit/c555e6efca7a00743e1b2b5c540bafea901b09f8) this did seem to work, but will it work for acrylic? - [`01f07be`](https://github.com/microsoft/terminal/commit/01f07be64f957e66f2cb95c2605a95dfcd1fd5bc) okay so you can't change a solid brush to an acylic one at runtime - [`ee9333a`](https://github.com/microsoft/terminal/commit/ee9333af13d5323f257f993ab3f6847ef8dc48c9) A pile of dead ends. ### 📊 Changes **6 files changed** (+124 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/TerminalApp/TabManagement.cpp` (+3 -0) 📝 `src/cascadia/TerminalApp/TerminalPage.cpp` (+100 -3) 📝 `src/cascadia/TerminalApp/TerminalPage.h` (+1 -0) 📝 `src/cascadia/TerminalSettingsModel/MTSMSettings.h` (+3 -2) 📝 `src/cascadia/TerminalSettingsModel/TerminalSettingsSerializationHelpers.h` (+9 -0) 📝 `src/cascadia/TerminalSettingsModel/Theme.idl` (+8 -0) </details> ### 📄 Description ## 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 * See #3327 * ⚠️ targets #13178 ⚠️ ## PR Checklist * [x] Closes #3335 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated - YUP ## Detailed Description of the Pull Request / Additional comments See the following two properties in WInUI that we're leveraging here. * [`TabViewCloseButtonOverlayMode.OnPointerOver`](https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.tabviewclosebuttonoverlaymode?view=winui-2.7&viewFallbackFrom=winui-2.2) * [`TabViewItem.IsClosable`](https://docs.microsoft.com/en-us/windows/winui/api/microsoft.ui.xaml.controls.tabviewitem.isclosable?view=winui-2.2#microsoft-ui-xaml-controls-tabviewitem-isclosable) 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 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:35:13 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29490