Compare commits

...

106 Commits

Author SHA1 Message Date
Carlos Zamora
f0c63b9281 PRE-MERGE #20014 Add settings for "notifying" on "activity" 2026-05-13 14:53:56 -07:00
Carlos Zamora
cfccd1f4be PRE-MERGE #20012 Add support for OSC777 (Send Notification) 2026-05-13 14:25:35 -07:00
Carlos Zamora
2ee29177ba PRE-MERGE #20059 Show terminal size overlay (COLSxROWS) during resize (#2833) 2026-05-13 14:24:50 -07:00
Carlos Zamora
edf18a2255 PRE-MERGE #20068 Add per-pane title header for split panes (#4717) 2026-05-13 14:23:17 -07:00
Carlos Zamora
f97cddcdd6 PRE-MERGE #20105 Clear scroll marks when clearing the buffer 2026-05-13 12:14:43 -07:00
Carlos Zamora
c84651b0f1 PRE-MERGE #20162 Add support for "workspaces" based on window names 2026-05-13 12:14:26 -07:00
Carlos Zamora
eb6deaf67c PRE-MERGE #20200 Add expander groups to settings UI 2026-05-13 12:10:20 -07:00
Carlos Zamora
6c1b73ef9c PRE-MERGE #20199 Introduce Profiles page to SUI 2026-05-13 11:30:10 -07:00
Carlos Zamora
b7701c909d PRE-MERGE #20203 Redesign new tab menu page -> dropdown 2026-05-13 11:29:46 -07:00
Carlos Zamora
0c621d11d8 PRE-MERGE #20215 Update styling of Actions page 2026-05-13 11:29:37 -07:00
Carlos Zamora
e42b3020b0 remove '-' & use 'threshold' term 2026-05-13 11:25:21 -07:00
Carlos Zamora
89b2295a8c code format 2026-05-12 18:34:10 -07:00
Carlos Zamora
56718992ac reuse existing resources for auto props 2026-05-12 18:21:09 -07:00
Carlos Zamora
5f38be735b add "notifyOnActivityThreshold" & "notifyOnNextPromptThreshold" 2026-05-12 18:02:48 -07:00
Carlos Zamora
054afcc59d const 2026-05-12 15:12:28 -07:00
Carlos Zamora
0fe41d7db8 const 2026-05-12 15:12:04 -07:00
Carlos Zamora
03dfed4d54 const 2026-05-12 15:10:39 -07:00
Carlos Zamora
84390c5b27 Fold new converter into existing code better 2026-05-12 15:08:00 -07:00
Carlos Zamora
b0c1611673 code format 2026-05-12 14:41:55 -07:00
Carlos Zamora
5a45c8d7e4 improve "view all" UI; consistently use "shortcut" 2026-05-12 14:37:26 -07:00
Lucas Trzesniewski
fb71a0462e Add safeUriSchemes setting (#20207)
This adds a `safeUriSchemes` global setting which lets you define
hyperlink URI schemes which the user considers safe. No confirmation
dialog will be shown when trying to open hyperlinks which use these
schemes.

- This solves the root issue, but doesn't introduce any UI or
  documentation changes. I wanted to validate the approach and
  implementation with you first.
- I closely followed the code handling the `disabledProfileSources`
  setting, which is of the same type.
- This feature does not change the behavior of `http`, `https` and
  `file` schemes.

Validation

I ran the dev terminal, and tested the behavior by clicking on `vscode`
hyperlinks generated by ripgrep with various `safeUriSchemes` settings:

- Setting not defined - asks for confirmation
- `["vscode"]` - does not ask for confirmation
- `["foo", "vscode"]` - does not ask for confirmation
- `["foo"]` - asks for confirmation
- `null` - asks for confirmation
- `[]` - asks for confirmation
- `[""]` - asks for confirmation
- `[{"foo": "bar"}]` - fails to deserialize (as expected)

A few uinit tests failed, but they seem unrelated to these changes:
- `KeyBindingTests` in `UnitTests_SettingsModel`, probably because I use
  an AZERTY keyboard.
- A few `Conhost` tests, but I didn't touch this part

Refs #20065
Closes #20191
2026-05-12 21:32:56 +00:00
Carlos Zamora
fa0f2a7e16 Add SectionExpanderStyle to deduplicate code 2026-05-12 14:15:33 -07:00
Carlos Zamora
56aa5fc73f add "Profiles" to search results 2026-05-12 11:41:29 -07:00
Carlos Zamora
fa2d052ccd spell check + remove comment 2026-05-12 10:43:59 -07:00
Carlos Zamora
3ee13c679f spell check 2026-05-12 10:27:52 -07:00
Dustin L. Howett
c829d4ca54 sixel: prevent allocating an absurd amount of memory or writing OOB (#20213)
This commit implements two fixes for the integer overflow/out-of-bounds
write reported in #20149.

First, it catches any exception generated in sixel char processing
(which will prevent `out_of_memory` or `bad_alloc` from being ignored
sight-unseen, and will prevent the consumption of further DCS content).

Second, it prevents us from allocating memory for an image which will
never be displayed (because it exceeds the height of the display.)

This supersedes prior work in #20153 for the same issues.

Closes #20149
Closes #20153

Co-authored-by: James Holderness <j4_james@hotmail.com>
2026-05-12 18:15:19 +02:00
Carlos Zamora
76f89bff04 polish 2026-05-11 21:08:30 -07:00
Carlos Zamora
a7aefad0ba Add containers to Actions page 2026-05-11 19:06:07 -07:00
Dustin L. Howett
b991eb048e Only set startingTitle once, clear up title fallback handling (#20214)
This commit ensures that we only set the starting title once when we
open a new terminal pane.

It also consolidates all title selection into Terminal::GetConsoleTitle,
which is now used in the TitleChanged event.

TitleChanged no longer stores a separate copy of the starting title if
an application attempts to _clear_ the title; that seems like a poorer
implementation of what we already had.

This supersedes work in #20204.

Closes #19340
Closes #20204

Co-authored-by: imsh <im.shaedar@gmail.com>
2026-05-12 00:08:57 +00:00
Dustin L. Howett
3e3b3ad883 Reject DTTERM Window Manipulation resizes with the current size (#20183)
This may help #20182 and #20112
Closes #19310
2026-05-11 17:42:18 -05:00
Carlos Zamora
bf2cb051b4 Profiles: Add 'Window settings' group 2026-05-11 15:29:41 -07:00
Carlos Zamora
fbfc761450 Redesign new tab menu page -> dropdown 2026-05-08 13:21:22 -07:00
Mike Griese
74b740cf0c format, for real 2026-05-08 06:40:40 -05:00
Carlos Zamora
2fba2ee281 add polish 2026-05-07 19:14:28 -07:00
Carlos Zamora
87d9fdb1da add polish 2026-05-07 18:53:54 -07:00
Carlos Zamora
e8a5c32612 [SUI] Add expander groups to settings 2026-05-07 18:23:44 -07:00
Carlos Zamora
7cbfb5784a [SUI] Move profiles into a new Profiles page 2026-05-07 15:59:50 -07:00
Windows Console Service Bot
d3f76e7acf Localization Updates - main - 05/07/2026 03:04:15 (#20196)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
2026-05-07 14:03:13 -05:00
Mike Griese
afe42d456f format 2026-05-07 13:43:50 -05:00
Mike Griese
12e2daaeb9 actions are good for our keyboard inclined 2026-05-07 13:41:46 -05:00
Mike Griese
b9896f51e4 delete workspaces ; better padding 2026-05-07 12:55:16 -05:00
Windows Console Service Bot
ea4cb8145f Localization Updates - main - 04/30/2026 03:04:35 (#20168)
Co-authored-by: Console Service Bot <consvc@microsoft.com>
2026-05-06 16:36:17 -05:00
Mike Griese
79d681e394 focus the window renamer better 2026-05-06 10:32:34 -05:00
Mike Griese
00aa707825 don't crash when closing the last pane in a workspace 2026-05-06 10:32:11 -05:00
Sushaanth Srinivasan
a325a2fa5a Fix settings error text legibility in High Contrast mode (#20098)
Closes #18147

`SystemErrorTextColor` doesn't adapt to High Contrast themes, so the
error details in the "Failed to reload settings" dialog are illegible
(yellow on cream in HC White, for example).

Fix: skip the `ErrorTextBrush` foreground override when High Contrast is
active, letting the text inherit the system HC text color from its
parent element. This matches the existing HC detection pattern used in
`TermControl.cpp` and `MainPage.cpp`.

Validated manually on High Contrast White and Night sky themes.

Co-authored-by: SushaanthSrinivasan <SushaanthSrinivasan@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-06 02:35:16 +00:00
Carlos Zamora
30020752ca NotificationEventArgs: OnlyWhenInactive --> AlwaysNotify (flip logic) 2026-05-05 18:29:10 -07:00
Carlos Zamora
dc27359f56 TerminalPaneContent: OutputIdle --> OutputBurstEnded 2026-05-05 18:08:48 -07:00
Carlos Zamora
8f4aa8e635 add indicator to cmd plt 2026-05-05 17:15:20 -07:00
Carlos Zamora
e82fe2e548 default allowOSC777=false 2026-05-05 16:23:09 -07:00
Carlos Zamora
f15a9305fe revert bad AUMID handling 2026-05-05 16:18:44 -07:00
nmurrell07
dadde2fb11 fix(resizePane): Mark as handled only when resize succeeds (#20001)
This fix addresses issue #19983 where resizePane actions unconditionally
consume keystrokes even when no resize can occur.

The fix follows the same pattern used for moveFocus and swapPane fixes:
- Changed Tab::ResizePane to return bool indicating success
- Changed TerminalPage::_ResizePane to return bool from ResizePane  
- Updated _HandleResizePane to set args.Handled() based on whether
resize succeeded

This allows the keychord to propagate to the terminal when no resize can
occur, matching the behavior of moveFocus and swapPane (#6129).

Closes #19983

---------

Co-authored-by: nmurrell07 <nmurrell07@users.noreply.github.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
2026-05-05 19:42:48 +00:00
Dustin L. Howett
8edac5fb12 Don't allow overflowing lengths in WM_COPYDATA (#20185)
It is possible to craft a packet whose `len` is `0x80000001`.

We should not produce values that do not fit in size_t (on e.g. x86).

Reject them summarily.
2026-05-05 19:19:25 +00:00
Mike Griese
d5d4f99673 fix ci 2026-05-05 13:33:12 -05:00
Mike Griese
7dd7783aff wle 2026-05-05 11:33:39 -05:00
Mike Griese
ee1601e405 Merge remote-tracking branch 'origin/main' into dev/migrie/workspaces-for-pr 2026-05-05 11:32:01 -05:00
Carlos Zamora
071963420e {0} --> ::None; remove _restoring 2026-05-04 19:04:13 -07:00
Carlos Zamora
07a4f3acfc remove .leading from throttledTaskbarProgressChanged 2026-05-04 17:57:55 -07:00
Carlos Zamora
042eb5b1a9 autoDetectRunningCommand --> bool; _autoDetectEnabled --> _autoDetectCommandActivity 2026-05-04 17:55:03 -07:00
Dustin L. Howett
dbc5177f7f Migrate some pull requests from OS (#20181)
Some work was required to ensure conhost builds.

---------

Co-authored-by: Dragos Sambotin <dragoss@microsoft.com>
Co-authored-by: Daniel Paoliello (HE HIM) <danpao@microsoft.com>
2026-05-05 00:34:13 +00:00
Carlos Zamora
611f5a31b4 remove redefinition 2026-05-04 16:57:32 -07:00
Carlos Zamora
cdb99bbe8b remove duplicate NotificationEventArgs 2026-05-04 15:52:34 -07:00
Carlos Zamora
fbec4ee41f Merge branch 'main' into dev/cazamor/toast/osc777 2026-05-04 14:52:27 -07:00
Carlos Zamora
cab78edde0 address feedback 2026-05-04 14:49:03 -07:00
Carlos Zamora
b044fd661d psychically debug failed formatter 2026-05-04 12:30:00 -07:00
Carlos Zamora
234838075f notifyOnInactiveOutput --> notifyOnActivity 2026-05-04 12:18:49 -07:00
Carlos Zamora
4e6209247f Merge branch 'main' into dev/cazamor/toast/activity 2026-05-04 11:27:58 -07:00
Carlos Zamora
b753e3dee3 Replace confirmCloseAllTabs with confirmOnClose (#20055)
## Summary of the Pull Request
Replaces the `warning.confirmCloseAllTabs` setting with a
`warning.confirmOnClose` enum setting that accepts the following:
- `never`: don't present a warning dialog when closing a session
- `automatic`: present a warning dialog when closing multiple tabs/panes
at once
- `always`: present a warning dialog when closing any session

The confirmation dialog contains a "don't ask me again" checkbox. When
checked, we update the setting to `never`.

This setting also affects the following actions:
- "close other tabs"
- "close tabs after"
- "close other panes"
- "quit"
The appropriate confirmation dialog is shown in these scenarios. We also
present an aggregate dialog instead of prompting the user once per
tab/pane. If there are no other tabs/panes, we don't present a dialog
and treat the key binding as unhandled (passing the key through).

## References and Relevant Issues
Iteration of #19944 

## Validation Steps Performed
- closing a tab:
   -  1 pane --> no dialog
   -  2 panes --> dialog
   -  action and middle clicking tab trigger same flow
- close all other tabs:
   -  no other tabs --> no dialog
   -  1 other tab --> dialog
- close all other panes:
   -  1 pane --> no dialog
   -  2 panes --> dialog
- close all tabs after the current tab:
   -  no tabs after --> no dialog (even if tabs before)
   -  1 tab after --> dialog
- close window:
   -  2 tabs --> dialog
   -  2 panes --> dialog
   -  1 tab with one pane --> no dialog
- Quit the Terminal:
   -  3 windows --> dialog
   - 1 window --> dialog
-  "don't ask me again" checkbox checked --> setting changed to "never"
-  "never" --> no dialog for scenarios above
-  "always" --> dialog always appears, even when closing a single pane

## PR Checklist
Closes #5301 
Closes #6641
"don't ask me again" checkbox is also mentioned in #10000 

Co-authored by @zadjii-msft
2026-05-04 10:43:34 -07:00
Carlos Zamora
a834313fb7 Add a setting for sending a notification on BEL (#20011)
## Summary of the Pull Request
Targets #20010 

Adds another `bellStyle` flag option. This sends a windows toast
notification to the user when a BEL is encountered

- [X] Closes #18605 
- [ ] Documentation updated

Heavily based on #19936 
Co-authored by @zadjii-msft
2026-05-04 10:38:17 -07:00
Carlos Zamora
059986ebce [Unpackaged] Fix taskbar glomming due to AUMID (#20064)
The bug was caused by an AUMID mismatch between the Taskbar's .lnk file
and Windows Terminal. Since no AUMID was associated with the .exe, the
OS automatically creates one for us. However, #20018 added an AUMID for
unpackaged scenarios, so now there was a mismatch, resulting in a new
taskbar entry being created.

To fix this, we check if a .lnk points to our .exe in the taskbar.
There's 3 cases here:
1. no .lnk of interest exists --> set the AUMID normally
2. the .lnk carries our AUMID --> set the AUMID normally
3. the .lnk doesn't have an AUMID (aka uses the auto-resolved one) -->
- for this launch: don't set the AUMID so that we both use the
auto-resolved one
- on next launch: set the AUMID on the .lnk and process so that they all
agree

## Validation Steps Performed
In unpackaged folder, move WindowsTerminal.exe to the taskbar (creates
.lnk)...
 Double-click the .exe --> Same taskbar entry is used
 Double-click the .exe _again_ --> second window goes to same taskbar
entry

The first window doesn't have to close for this to work. It just * works
*!

Bug introduced in #20018 
Closes #20053
2026-05-01 16:56:19 -05:00
Carlos Zamora
a07dba52ef fix build 2026-04-29 19:07:09 -07:00
Carlos Zamora
fcaf3daa8d run code formatter 2026-04-29 18:24:59 -07:00
Carlos Zamora
68fccb5efb Merge branch 'main' into dev/cazamor/toast/activity 2026-04-29 18:22:19 -07:00
Carlos Zamora
e4e3f08efc Add toast notification infrastructure (#20010)
## Summary of the Pull Request
Adds the infrastructure for toast notifications. Breakdown:
- `DesktopNotification`:
- `DesktopNotificationArgs` includes the struct to group all
notification-related data together.
   - `SendNotification()` actually sends it
- `AppCommandlineArgs.cpp`: added a check for the `--from-toast` no-op
sentinel; ensures no new window is created
- Most of the other changes are just bubbling up the notification from
the `TerminalPaneContent` to `TerminalPage`
- `TabManagement.cpp`: `_SendDesktopNotification()` does the final
packaging of the notification before calling the `DesktopNotification`
API

This supports finding the right tab when it's been reordered or even
moved to a new window!
This also has expanded to support finding the right pane, which is
resilient to pane swaps/closing too. When the pane can't be found, we
just fallback to the tab.
If the pane is already focused, we don't send a notification.

This simply adds the infrastructure! Looks like nothing can actually
take advantage of it yet, but it's been tested with the changes in
#20011.

Heavily based on #19935
Co-authored by @zadjii-msft
2026-04-29 17:24:45 -07:00
Carlos Zamora
6c2b796253 Address Leonard's feedback 2026-04-29 17:23:14 -07:00
Carlos Zamora
d4ff09f82e use split_iterator 2026-04-29 16:32:35 -07:00
Carlos Zamora
19286b7043 spell fight 2: electric boogaloo 2026-04-29 16:32:35 -07:00
Carlos Zamora
8868dfa6ee include everything after the semicolon for body 2026-04-29 16:32:35 -07:00
Carlos Zamora
04f6273e4b 🥊spell checker🥊 2026-04-29 16:32:35 -07:00
Carlos Zamora
f483eae7a9 spell 2026-04-29 16:32:35 -07:00
Carlos Zamora
0856bce421 DesktopNotification -> UrxvtAction; add _api.UnknownSequence() call 2026-04-29 16:32:35 -07:00
Carlos Zamora
582ffb615e Add support for OSC777 (Send Notification) 2026-04-29 16:32:34 -07:00
Dustin L. Howett
84e807cbeb appx: add appLicensing to Preview and Stable manifests (#20163)
This should prevent an outage like the one from #19764
2026-04-29 17:04:16 -05:00
Carlos Zamora
115ec2cbb9 Fix rounding error for word selection (#20084)
## Summary of the Pull Request
Dustin reported this bug to me. Thankfully it was an easy fix.

## References and Relevant Issues
Bug from implementing #5099

## Validation Steps Performed
Double-click ____ of right-most cell of a word selects the current word
 right-half
 left-half
2026-04-29 17:01:43 -05:00
Carlos Zamora
da00f8863b Fix settings UI 2026-04-29 14:56:21 -07:00
Carlos Zamora
62727bf6d1 minor cleanup 2026-04-29 14:56:21 -07:00
Carlos Zamora
15ce2fd513 Add settings for "notifying" on "activity" 2026-04-29 14:56:20 -07:00
Carlos Zamora
6c88741e26 Merge branch 'main' into dev/cazamor/toast/base 2026-04-29 14:47:38 -07:00
Carlos Zamora
54009e1305 --from-toast & GetTickCount64() 2026-04-29 14:40:33 -07:00
Carlos Zamora
3362651659 Tab menu: show "restart" + maintain items' enable state (#19972)
## Summary of the Pull Request
Changes how/when we display the "restart connection" item in the tab's
context menu. Now, we always display it, but it's disabled if we're not
in a terminal tab.

Applies similar enable/disable logic to the rest of the menu items.
Previous to this, they just wouldn't do anything (which is fair, they
didn't make any sense).

## Validation Steps Performed
Check tab's menu in following scenarios:
 terminal pane
 settings tab
 snippets pane

Closes #18891
2026-04-29 18:54:43 +00:00
Carlos Zamora
c72600dd4f Add more settings model unit tests (#20117)
## Summary of the Pull Request
Adds tests to `UnitTests_SettingsModel` to improve coverage. Tests
include:
- `SettingInheritanceFallback`: Settings inherit from user defaults;
unset settings fall back to built-in defaults
- `ClearSettingRestoresInheritance`: `ClearXxx()` removes the value at
the current layer, causing fallback to the parent
- `HasSettingAtSpecificLayer`: `HasXxx() `distinguishes explicitly set
values from inherited ones
- `ModifyProfileSettingAndRoundtrip`: Change a profile setting via
setter and `ToJson()` reflects it
- `ModifyGlobalSettingAndRoundtrip`: Change global settings via setter
and `ToJson()` reflects them
- `ModifyColorSchemeAndRoundtrip`: Change a color scheme property and
the serialized JSON reflects it
- `FixupUserSettingsDetectsChanges`: A clean roundtrip produces
idempotent FixupUserSettings() (returns false)
- `FixupCommandlinePatching`: 4 sub-cases: CMD/PowerShell short names
get patched to full paths, no-op when already clean, custom profiles are
untouched

This also updates `TestCloneInheritanceTree` to verify that `HasXxx()`
and settters that modify the clone don't modify the original.

This is being done in preparation for auto-save to help ensure we don't
have any regressions.

## Validation Steps Performed
 Tests pass
 Manually reviewed the new tests, they make sense and do add value
(though some are less valuable than others, admittedly)
 Sent Copilot on a quest to ensure we're not adding redundant tests. It
did catch a few and remove them fwiw.
2026-04-29 10:16:30 -07:00
Mike Griese
0c0a16e10a Add support for "workspaces" based on window names
This adds a new feature to the Windows Terminal: "Workspaces"

Workspaces are very shamelessly inspired by Edge workspaces of the same name.

{{video here}}

The core idea is that when users name a window and they close that window, we
will persist that Windows layout and buffers, seperately from the rest of window
restoration. So a user can open a named window, open some profiles, some panes,
do some stuff in it, then close it, and we will keep that state around for the
next time the user opens that window name.

Unnamed windows still behave the same. If you close an unnamed window, and it's
not the last window, then we won't persist the state of it.

To facilitate restoring named windows, we add a `openWorkspace` action. This
allows us to persist the open workspace action in the window layout restoration
path. So when we deserialize the list of tab layouts, and open workspace action
will tell us, hey, go retrieve this known workspace from the state.json, instead
of trying to serialize the window state in two places.

<details>
<summary>
state.json
</summary>

```jsonc

	"persistedWindowLayouts" :
	[
		{
			"initialPosition" : "910,462",
			"initialSize" :
			{
				"height" : 623.20001220703125,
				"width" : 934.4000244140625
			},
			"launchMode" : "default",
			"tabLayout" :
			[
				{
					"action" : "newTab",
					"commandline" : "\"C:\\Program Files\\PowerShell\\7\\pwsh.exe\"",
					"profile" : "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
					"sessionId" : "{09d3ef05-ba3d-44ed-a8f1-065d08a806a4}",
					"startingDirectory" : "C:\\Users\\zadji",
					"suppressApplicationTitle" : false,
					"tabTitle" : "PowerShell"
				},
			]
		},
		{
			"tabLayout" :
			[
				{
					"action" : "openWorkspace",
					"name" : "wsl"
				}
			]
		}
	],
	"persistedWorkspaces" :
	{
		"wsl" :
		{
			"initialPosition" : "109,502",
			"initialSize" :
			{
				"height" : 568,
				"width" : 1184.800048828125
			},
			"launchMode" : "default",
			"tabLayout" :
			[
				{
					"action" : "newTab",
					"commandline" : "ubuntu.exe",
					"profile" : "{51855cb2-8cce-5362-8f54-464b92b32386}",
					"sessionId" : "{a7f70c49-71ec-4ac4-9f3a-4884528a3fd6}",
					"startingDirectory" : null,
					"suppressApplicationTitle" : false,
					"tabTitle" : "Ubuntu"
				},
				{
					"action" : "renameWindow",
					"name" : "wsl"
				}
			]
		}
	},
```

</details>

As demoed in the video, we add a flyout to list the windows that the user has
open, and the named workspaces that they have saved. This allows users to
quickly reopen previously closed workspaces, as well as quickly rename a window,
thereby adding it to the list of saved workspaces. This button can also be
hidden using the theme settings.
2026-04-28 14:32:46 -05:00
sagarbhure-msft
fe650d0c27 Address review: fix timer lambda leak and stale font-size overlay
- Fix Tick handler lambda leak: initialize the timer and register the
  Tick handler only once on first use, then just restart the timer on
  subsequent calls (lhecker, DHowett)
- Use std::optional<SafeDispatcherTimer> to defer initialization until
  first use (lhecker)
- Remove _ShowResizeOverlay from _coreFontSizeChanged: the viewport
  dimensions are stale at that point because ControlCore still holds
  the write lock. The overlay will be shown by _SwapChainSizeChanged
  which fires after the resize completes with correct values (DHowett)
2026-04-19 13:28:32 +05:30
Carlos Zamora
b53ccb853e Suppress notification if focused; add pane data 2026-04-16 17:58:58 -07:00
SushaanthSrinivasan
ac400756e8 Add ClearMarksInRange to _EraseAll for clear/cls path 2026-04-14 19:30:01 -07:00
sagarbhure-msft
7378b8ac8c Show overlay on font-size zoom, skip in Settings preview
Show the resize overlay when Ctrl+Scroll changes font size and alters
the grid dimensions. Extract overlay logic into _ShowResizeOverlay()
helper called from both _SwapChainSizeChanged and _coreFontSizeChanged.

Skip the overlay when the control is disabled (IsEnabled() == false),
which is the case for the Settings page terminal preview.
2026-04-14 09:20:10 +05:30
sagarbhure-msft
9f2dcfd5ee Fix spell-check: replace COLSxROWS with plain text in comments 2026-04-13 23:03:26 +05:30
sagarbhure-msft
ab2514b9cc Fix code formatting in TermControl.xaml
Run Invoke-CodeFormat: reorder XAML attributes alphabetically
and normalize comment spacing per project style.
2026-04-13 22:33:04 +05:30
SushaanthSrinivasan
b21ba2b053 Clear scroll marks when clearing the buffer (#20086) 2026-04-11 13:44:19 -07:00
sagarbhure-msft
5279226646 Add showPaneHeaders global appearance setting
Adds a 'showPaneHeaders' boolean setting (default: true) to control
whether per-pane title headers are displayed when multiple panes are
open. The setting is available in Settings > Appearance as a toggle
and persists via settings.json.

Headers are refreshed live when the setting is changed — toggling off
hides headers on all existing panes immediately.
2026-04-07 22:12:09 +05:30
sagarbhure-msft
c7a51c978c Show terminal size overlay (COLSxROWS) during resize (#2833)
Display a centered overlay showing columns x rows when the terminal
control is resized. The overlay auto-hides after 750ms of inactivity.

- Add ResizeOverlay Border element to TermControl.xaml
- Add ViewWidth() to ControlCore (matches existing ViewHeight())
- Show overlay in _SwapChainSizeChanged using SafeDispatcherTimer
- Use fmt::format for string formatting

Closes #2833
2026-04-04 10:10:47 +05:30
sagarbhure-msft
44456be4eb Add per-pane title header for split panes (#4717)
Shows a thin title bar above each pane when multiple panes are open.
Headers display the pane title, update dynamically via Dispatcher when
the shell changes the title (e.g. via escape sequences), and use the
focus-state border color as background. Hidden when only one pane exists.

The header is placed directly in the pane root Grid (row 0, auto-sized)
with the content border in row 1 (star-sized), keeping the TermControl
as the direct child of the border so SwapChainPanel renders correctly.
2026-04-04 09:34:49 +05:30
Carlos Zamora
5f3db13e5f fix extra window and reorder/glom scenarios 2026-03-26 18:12:08 -07:00
Carlos Zamora
9df166efec Send notifications even when we're unpackaged (#20013)
## Summary of the Pull Request
Targets #20010 

Manually assign an AUMID to our process when we're running unpackaged.
Main difference from #19937 is what AUMID we use. Before, it was per
branding, but the `WindowEmperor` already appends an exe path hash for
unpackaged instances to prevent crosstalk. Here, we're just using the
same pattern: `Microsoft.WindowsTerminal.<hash>`.

Heavily based on #19937
Co-authored by @zadjii-msft
2026-03-25 13:27:12 -07:00
Carlos Zamora
aeb531f666 spell; prefer AppDisplayName; use C++20 designated init 2026-03-25 10:29:06 -07:00
Carlos Zamora
c23e507c20 spell 2026-03-25 10:29:06 -07:00
Carlos Zamora
c49bc1a789 Add toast notification infrastructure 2026-03-25 10:29:06 -07:00
217 changed files with 8743 additions and 3521 deletions

View File

@@ -17,6 +17,7 @@ ADDSTRING
ADDTOOL
adml
admx
Affordance
AFill
AFX
AHelper
@@ -241,6 +242,7 @@ consoletaeftemplates
consoleuwp
CONSOLEWINDOWOWNER
consrv
consteval
constexprable
contentfiles
conterm
@@ -1753,6 +1755,7 @@ UPKEY
upss
uregex
URegular
urxvt
usebackq
USECALLBACK
USECOLOR

View File

@@ -60,7 +60,8 @@
"enum": [
"audible",
"window",
"taskbar"
"taskbar",
"notification"
]
}
},
@@ -70,6 +71,7 @@
"audible",
"taskbar",
"window",
"notification",
"all",
"none"
]
@@ -477,6 +479,7 @@
"toggleReadOnlyMode",
"toggleShaderEffects",
"toggleSplitOrientation",
"workspaces",
"wt",
"unbound"
],
@@ -2038,6 +2041,11 @@
"unfocusedFrame": {
"description": "The color of the window frame when the window is inactive. This only works on Windows 11",
"$ref": "#/$defs/ThemeColor"
},
"showWindowsButton": {
"description": "When set to true, the workspace/windows button will be shown in the tab row.",
"type": "boolean",
"default": true
}
}
},
@@ -2470,6 +2478,13 @@
},
"type": "array"
},
"safeUriSchemes": {
"description": "Specifies a list of URI schemes that are considered safe. No confirmation will be required to open URIs with these schemes.",
"items": {
"type": "string"
},
"type": "array"
},
"rendering.graphicsAPI": {
"description": "Direct3D 11 provides a more performant and feature-rich experience, whereas Direct2D is more stable. The default option \"Automatic\" will pick the API that best fits your graphics hardware. If you experience significant issues, consider using Direct2D.",
"type": "string",
@@ -2654,10 +2669,21 @@
"type": "string"
},
"warning.confirmCloseAllTabs": {
"deprecated": true,
"description": "[Deprecated] Use \"warning.confirmOnClose\" instead.",
"default": true,
"description": "When set to \"true\" closing a window with multiple tabs open will require confirmation. When set to \"false\", the confirmation dialog will not appear.",
"type": "boolean"
},
"warning.confirmOnClose": {
"default": "automatic",
"description": "Controls when a confirmation dialog appears before closing tabs or windows.",
"enum": [
"never",
"automatic",
"always"
],
"type": "string"
},
"useTabSwitcher": {
"description": "[Deprecated] Replaced with the \"tabSwitcherMode\" setting.",
"default": true,
@@ -2774,6 +2800,11 @@
"description": "When set to true, VT applications will be allowed to set the contents of the local clipboard using OSC 52 (Manipulate Selection Data).",
"type": "boolean"
},
"compatibility.allowOSC777": {
"default": false,
"description": "When set to true, applications can send OSC 777 escape sequences to trigger desktop toast notifications with a custom title and body.",
"type": "boolean"
},
"unfocusedAppearance": {
"$ref": "#/$defs/AppearanceConfig",
"description": "Sets the appearance of the terminal when it is unfocused.",
@@ -2849,6 +2880,85 @@
"description": "Sets the sound played when the application emits a BEL. When set to an array, the terminal will pick one of those sounds at random.",
"$ref": "#/$defs/BellSound"
},
"notifyOnActivity": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "array",
"items": {
"type": "string",
"enum": [
"taskbar",
"audible",
"tab",
"notification"
]
}
},
{
"type": "string",
"enum": [
"taskbar",
"audible",
"tab",
"notification",
"all",
"none"
]
}
],
"description": "Controls how you are notified when an inactive tab produces new output."
},
"notifyOnNextPrompt": {
"oneOf": [
{
"type": "boolean"
},
{
"type": "array",
"items": {
"type": "string",
"enum": [
"taskbar",
"audible",
"tab",
"notification"
]
}
},
{
"type": "string",
"enum": [
"taskbar",
"audible",
"tab",
"notification",
"all",
"none"
]
}
],
"description": "Controls how you are notified when a new shell prompt is detected. Requires shell integration."
},
"notifyOnActivityThreshold": {
"type": "integer",
"minimum": 0,
"default": 5,
"description": "Minimum number of seconds between consecutive activity notifications for this profile. Use this to suppress repeated notifications from chatty processes. The first notification after the pane has been silent always fires; subsequent notifications within this window are suppressed. Use 0 to always notify."
},
"notifyOnNextPromptThreshold": {
"type": "integer",
"minimum": 0,
"default": 5,
"description": "Suppress the next-prompt notification unless the just-finished command ran for at least this many seconds. Requires shell integration. Use 0 to always notify."
},
"autoDetectRunningCommand": {
"default": false,
"description": "Automatically detect when a command is running and show a progress indicator in the tab and taskbar.",
"type": "boolean"
},
"closeOnExit": {
"default": "automatic",
"description": "Sets how the profile reacts to termination or failure to launch. Possible values:\n -\"graceful\" (close when exit is typed or the process exits normally)\n -\"always\" (always close)\n -\"automatic\" (behave as \"graceful\" only for processes launched by terminal, behave as \"always\" otherwise)\n -\"never\" (never close).\ntrue and false are accepted as synonyms for \"graceful\" and \"never\" respectively.",

View File

@@ -237,6 +237,7 @@
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="unvirtualizedResources" />
<rescap:Capability Name="appLicensing" />
</Capabilities>
<Extensions>

View File

@@ -237,6 +237,7 @@
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust" />
<rescap:Capability Name="unvirtualizedResources" />
<rescap:Capability Name="appLicensing" />
</Capabilities>
<Extensions>

View File

@@ -499,8 +499,8 @@ namespace winrt::TerminalApp::implementation
}
else
{
_ResizePane(realArgs.ResizeDirection());
args.Handled(true);
const auto resizeSucceeded = _ResizePane(realArgs.ResizeDirection());
args.Handled(resizeSucceeded);
}
}
}
@@ -801,7 +801,7 @@ namespace winrt::TerminalApp::implementation
_RemoveTabs(tabsToRemove);
actionArgs.Handled(true);
actionArgs.Handled(!tabsToRemove.empty());
}
}
@@ -837,7 +837,7 @@ namespace winrt::TerminalApp::implementation
// tab row, until you mouse over them. Probably has something to do
// with tabs not resizing down until there's a mouse exit event.
actionArgs.Handled(true);
actionArgs.Handled(!tabsToRemove.empty());
}
}
@@ -938,6 +938,27 @@ namespace winrt::TerminalApp::implementation
co_return;
}
// Launch `wt -w <name>` so the monarch can either summon an existing
// window with that name or restore a persisted workspace.
safe_void_coroutine TerminalPage::_OpenWorkspaceWindow(const winrt::hstring name)
{
co_await winrt::resume_background();
const auto exePath{ GetWtExePath() };
const auto cmdline = fmt::format(FMT_COMPILE(L"-w {}"), std::wstring_view{ name });
SHELLEXECUTEINFOW seInfo{ 0 };
seInfo.cbSize = sizeof(seInfo);
seInfo.fMask = SEE_MASK_NOASYNC;
seInfo.lpVerb = L"open";
seInfo.lpFile = exePath.c_str();
seInfo.lpParameters = cmdline.c_str();
seInfo.nShow = SW_SHOWNORMAL;
LOG_IF_WIN32_BOOL_FALSE(ShellExecuteExW(&seInfo));
co_return;
}
void TerminalPage::_HandleNewWindow(const IInspectable& /*sender*/,
const ActionEventArgs& actionArgs)
{
@@ -1058,6 +1079,7 @@ namespace winrt::TerminalApp::implementation
// Fun!
// WindowRenamerTextBox().Focus(FocusState::Programmatic);
_renamerLayoutUpdatedRevoker.revoke();
_renamerLayoutCount = 0;
_renamerLayoutUpdatedRevoker = WindowRenamerTextBox().LayoutUpdated(winrt::auto_revoke, [weakThis = get_weak()](auto&&, auto&&) {
if (auto self{ weakThis.get() })
{
@@ -1633,4 +1655,35 @@ namespace winrt::TerminalApp::implementation
args.Handled(handled);
}
}
void TerminalPage::_HandleOpenWorkspace(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
// Open (or summon) a named window. We launch a new `wt -w <name>`
// process which the monarch will route to the correct live window or
// restore from a persisted workspace.
if (args)
{
if (const auto& realArgs = args.ActionArgs().try_as<OpenWorkspaceArgs>())
{
const auto name = realArgs.Name();
if (!name.empty())
{
_OpenWorkspaceWindow(name);
}
args.Handled(true);
}
}
}
void TerminalPage::_HandleWorkspaces(const IInspectable& /*sender*/,
const ActionEventArgs& args)
{
if (_workspaceFlyout && _workspaceDropdown)
{
_workspaceFlyout.ShowAt(_workspaceDropdown);
}
args.Handled(true);
}
}

View File

@@ -1068,6 +1068,15 @@ int AppCommandlineArgs::ParseArgs(winrt::array_view<const winrt::hstring> args)
return 0;
}
// When a toast notification is clicked, Windows may launch a new instance
// with "--from-toast" as the argument. This is a no-op sentinel — the
// in-process Activated handler on the toast already handled activation.
// See DesktopNotification.cpp for more details.
if (args.size() == 2 && args[1] == L"--from-toast")
{
return 0;
}
auto commands = ::TerminalApp::AppCommandlineArgs::BuildCommands(args);
for (auto& cmdBlob : commands)

View File

@@ -15,6 +15,7 @@ namespace winrt::TerminalApp::implementation
til::typed_event<IPaneContent> TaskbarProgressChanged;
til::typed_event<IPaneContent> ReadOnlyChanged;
til::typed_event<IPaneContent> FocusRequested;
til::typed_event<IPaneContent, winrt::TerminalApp::NotificationEventArgs> NotificationRequested;
til::typed_event<winrt::Windows::Foundation::IInspectable, Microsoft::Terminal::Settings::Model::Command> DispatchCommandRequested;
};

View File

@@ -231,6 +231,12 @@
Glyph="&#xEA8F;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).BellIndicator, Mode=OneWay}" />
<FontIcon Margin="0,0,8,0"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Glyph="&#xF127;"
Visibility="{x:Bind Item.(local:TabPaletteItem.TabStatus).ActivityIndicator, Mode=OneWay}" />
<FontIcon Margin="0,0,8,0"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="12"

View File

@@ -0,0 +1,129 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "DesktopNotification.h"
#include <WtExeUtils.h>
using namespace winrt::Windows::UI::Notifications;
using namespace winrt::Windows::Data::Xml::Dom;
namespace winrt::TerminalApp::implementation
{
std::atomic<uint64_t> DesktopNotification::_lastNotificationTime{ 0 };
// Method Description:
// - Rate-limits toast notifications so we don't spam the user.
// Return Value:
// - Returns true if a notification is allowed, false if too recent.
bool DesktopNotification::ShouldSendNotification()
{
const auto now = GetTickCount64();
auto last = _lastNotificationTime.load(std::memory_order_relaxed);
// Subtraction wraps cleanly modulo 2^64, so the delta is correct even
// across the (~584 million year) GetTickCount64 rollover.
if (now - last < MinNotificationIntervalMs)
{
return false;
}
// Attempt to update; if another thread beat us, that's fine — we'll skip this one.
return _lastNotificationTime.compare_exchange_strong(last, now, std::memory_order_relaxed);
}
// Method Description:
// - Sends a toast notification with the given title and message.
// - When the user clicks the toast, the `Activated` callback fires
// with the tabIndex that was passed in, so the caller can switch
// to the correct tab and summon the window.
// Arguments:
// - args: The title, message, and tab index to include in the notification.
// - activated: A callback invoked on the background thread when the
// toast is clicked. The uint32_t parameter is the tab index.
void DesktopNotification::SendNotification(const DesktopNotificationArgs& args, std::function<void()> activatedFunc)
{
try
{
if (!ShouldSendNotification())
{
return;
}
// Build the toast XML. We use a simple template with a title and body text.
//
// <toast launch="--from-toast">
// <visual>
// <binding template="ToastGeneric">
// <text>Title</text>
// <text>Message</text>
// </binding>
// </visual>
// </toast>
auto toastXml = ToastNotificationManager::GetTemplateContent(ToastTemplateType::ToastText02);
auto textNodes = toastXml.GetElementsByTagName(L"text");
// First <text> is the title
textNodes.Item(0).InnerText(args.Title);
// Second <text> is the body
textNodes.Item(1).InnerText(args.Message);
auto toastElement = toastXml.DocumentElement();
// When a toast is clicked, Windows launches a new instance of the app
// with the "launch" attribute as command-line arguments. We handle
// toast activation in-process via the Activated event below, so the
// new instance should do nothing. "--from-toast" is recognized by
// AppCommandlineArgs::ParseArgs as a no-op sentinel.
toastElement.SetAttribute(L"launch", L"--from-toast");
toastElement.SetAttribute(L"scenario", L"default");
auto toast = ToastNotification{ toastXml };
// Set the tag and group to enable notification replacement.
// Repeated notifications with the same tag replace the previous one
// rather than stacking in the notification center.
toast.Tag(args.Tag);
toast.Group(L"WindowsTerminal");
// When the user activates (clicks) the toast, fire the callback.
if (activatedFunc)
{
toast.Activated([activatedFunc = std::move(activatedFunc)](const auto& /*sender*/, const auto& /*eventArgs*/) {
activatedFunc();
});
}
// For packaged apps, CreateToastNotifier() uses the package identity automatically.
// For unpackaged apps, we must pass the explicit AUMID that was registered
// at startup via SetCurrentProcessExplicitAppUserModelID.
winrt::Windows::UI::Notifications::ToastNotifier notifier{ nullptr };
if (IsPackaged())
{
notifier = ToastNotificationManager::CreateToastNotifier();
}
else
{
// Retrieve the AUMID that was set by WindowEmperor at startup.
wil::unique_cotaskmem_string aumid;
if (SUCCEEDED(GetCurrentProcessExplicitAppUserModelID(&aumid)))
{
notifier = ToastNotificationManager::CreateToastNotifier(aumid.get());
}
}
if (notifier)
{
notifier.Show(toast);
}
}
catch (...)
{
// Toast notification is a best-effort feature. If it fails (e.g., notifications
// are disabled, or the app is unpackaged without proper AUMID setup), we silently
// ignore the error.
LOG_CAUGHT_EXCEPTION();
}
}
}

View File

@@ -0,0 +1,37 @@
/*++
Copyright (c) Microsoft Corporation
Licensed under the MIT license.
Module Name:
- DesktopNotification.h
Module Description:
- Helper for sending Windows desktop toast notifications. Used to surface
terminal activity events to the user via the Windows notification center.
--*/
#pragma once
#include "pch.h"
namespace winrt::TerminalApp::implementation
{
struct DesktopNotificationArgs
{
winrt::hstring Title;
winrt::hstring Message;
winrt::hstring Tag;
};
class DesktopNotification
{
public:
static bool ShouldSendNotification();
static void SendNotification(const DesktopNotificationArgs& args, std::function<void()> activatedFunc);
private:
static std::atomic<uint64_t> _lastNotificationTime;
// Minimum interval between notifications, in milliseconds (GetTickCount64 units).
static constexpr uint64_t MinNotificationIntervalMs = 5'000;
};
}

View File

@@ -14,6 +14,15 @@ namespace TerminalApp
runtimeclass BellEventArgs
{
Boolean FlashTaskbar { get; };
Boolean SendNotification { get; };
};
runtimeclass NotificationEventArgs
{
String Title { get; };
String Body { get; };
Microsoft.Terminal.Control.OutputNotificationStyle Style { get; };
Boolean AlwaysNotify { get; };
};
interface IPaneContent
@@ -24,7 +33,7 @@ namespace TerminalApp
Windows.Foundation.Size MinimumSize { get; };
String Title { get; };
UInt64 TaskbarState { get; };
Microsoft.Terminal.Control.TaskbarState TaskbarState { get; };
UInt64 TaskbarProgress { get; };
Boolean ReadOnly { get; };
String Icon { get; };
@@ -46,6 +55,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> TaskbarProgressChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> ReadOnlyChanged;
event Windows.Foundation.TypedEventHandler<IPaneContent, Object> FocusRequested;
event Windows.Foundation.TypedEventHandler<IPaneContent, NotificationEventArgs> NotificationRequested;
};

View File

@@ -33,7 +33,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Settings::Model::INewContentArgs GetNewTerminalArgs(BuildStartupKind kind) const;
winrt::hstring Title() { return _filePath; }
uint64_t TaskbarState() { return 0; }
winrt::Microsoft::Terminal::Control::TaskbarState TaskbarState() { return winrt::Microsoft::Terminal::Control::TaskbarState::Clear; }
uint64_t TaskbarProgress() { return 0; }
bool ReadOnly() { return false; }
winrt::hstring Icon() const;

View File

@@ -31,10 +31,14 @@ Pane::Pane(IPaneContent content, const bool lastFocused) :
_lastActive{ lastFocused }
{
_setPaneContent(std::move(content));
_root.Children().Append(_borderFirst);
_CreatePaneHeader();
const auto& control{ _content.GetRoot() };
_borderFirst.Child(control);
// Set up leaf layout: header in _root row 0, content in _borderFirst row 1.
// The TermControl stays as the direct child of _borderFirst (no Grid wrapper)
// so the SwapChainPanel renders correctly.
_SetupLeafLayout(control);
// Register an event with the control to have it inform us when it gains focus.
if (control)
@@ -92,6 +96,10 @@ INewContentArgs Pane::GetTerminalArgsForPane(BuildStartupKind kind) const
{
// Leaves are the only things that have controls
assert(_IsLeaf());
if (!_content)
{
return nullptr;
}
return _content.GetNewTerminalArgs(kind);
}
@@ -1228,6 +1236,12 @@ void Pane::UpdateVisuals()
const auto& brush{ _ComputeBorderColor() };
_borderFirst.BorderBrush(brush);
_borderSecond.BorderBrush(brush);
// Update pane header color to match focus state
if (_paneHeaderBorder && _paneHeaderBorder.Visibility() == winrt::Windows::UI::Xaml::Visibility::Visible)
{
_paneHeaderBorder.Background(brush);
}
}
// Method Description:
@@ -1450,9 +1464,9 @@ void Pane::_CloseChild(const bool closeFirst)
_root.RowDefinitions().Clear();
// Reattach the TermControl to our grid.
_root.Children().Append(_borderFirst);
_CreatePaneHeader();
const auto& control{ _content.GetRoot() };
_borderFirst.Child(control);
_SetupLeafLayout(control);
// Make sure to set our _splitState before focusing the control. If you
// fail to do this, when the tab handles the GotFocus event and asks us
@@ -1755,7 +1769,92 @@ void Pane::_setPaneContent(IPaneContent content)
}
// Method Description:
// - Sets up row/column definitions for this pane. There are three total
// - Creates the pane header UI elements (title bar shown above the content).
// The header is initially collapsed and only shown via ShowPaneHeaders().
void Pane::_CreatePaneHeader()
{
namespace WUX = winrt::Windows::UI::Xaml;
_paneHeaderText = Controls::TextBlock{};
_paneHeaderText.FontSize(12);
_paneHeaderText.Padding({ 8, 2, 8, 2 });
_paneHeaderText.IsTextSelectionEnabled(false);
_paneHeaderText.TextTrimming(WUX::TextTrimming::CharacterEllipsis);
if (_content)
{
_paneHeaderText.Text(_content.Title());
_titleChangedRevoker = _content.TitleChanged(winrt::auto_revoke, [this](auto&&, auto&&) {
_paneHeaderBorder.Dispatcher().RunAsync(
winrt::Windows::UI::Core::CoreDispatcherPriority::Normal,
[this]() {
if (_content && _paneHeaderText)
{
_paneHeaderText.Text(_content.Title());
}
});
});
}
_paneHeaderBorder = Controls::Border{};
_paneHeaderBorder.Padding({ 0, 0, 0, 0 });
_paneHeaderBorder.Child(_paneHeaderText);
_paneHeaderBorder.Visibility(WUX::Visibility::Collapsed);
}
// Method Description:
// - Sets up the leaf pane layout in _root: a header row (auto-sized) and a
// content row (star-sized). The TermControl stays as the direct child of
// _borderFirst so the SwapChainPanel renders correctly.
void Pane::_SetupLeafLayout(const winrt::Windows::UI::Xaml::UIElement& control)
{
auto headerRow = Controls::RowDefinition{};
headerRow.Height(GridLengthHelper::Auto());
auto contentRow = Controls::RowDefinition{};
contentRow.Height(GridLengthHelper::FromValueAndType(1, GridUnitType::Star));
_root.RowDefinitions().Append(headerRow);
_root.RowDefinitions().Append(contentRow);
Controls::Grid::SetRow(_paneHeaderBorder, 0);
Controls::Grid::SetRow(_borderFirst, 1);
_root.Children().Append(_paneHeaderBorder);
_root.Children().Append(_borderFirst);
if (control)
{
_borderFirst.Child(control);
}
}
// Method Description:
// - Show or hide the pane header title bar on all leaf panes in the tree.
// Called by Tab when the number of panes changes.
void Pane::ShowPaneHeaders(bool show)
{
if (_IsLeaf())
{
if (_paneHeaderBorder)
{
namespace WUX = winrt::Windows::UI::Xaml;
_paneHeaderBorder.Visibility(show ? WUX::Visibility::Visible : WUX::Visibility::Collapsed);
if (show)
{
const auto& brush = _ComputeBorderColor();
_paneHeaderBorder.Background(brush);
_paneHeaderText.Foreground(winrt::Windows::UI::Xaml::Media::SolidColorBrush(winrt::Windows::UI::Colors::White()));
}
}
}
else
{
_firstChild->ShowPaneHeaders(show);
_secondChild->ShowPaneHeaders(show);
}
}
// Method Description:
// - Sets up row/column definitions for this pane.There are three total
// row/cols. The middle one is for the separator. The first and third are for
// each of the child panes, and are given a size in pixels, based off the
// available space, and the percent of the space they respectively consume,
@@ -2321,6 +2420,10 @@ std::pair<std::shared_ptr<Pane>, std::shared_ptr<Pane>> Pane::_Split(SplitDirect
_root.RowDefinitions().Clear();
_CreateRowColDefinitions();
// Reset Grid.Row on _borderFirst — it may have been set to row 1 in the
// leaf layout (header=row0, content=row1).
Controls::Grid::SetRow(_borderFirst, 0);
_borderFirst.Child(_firstChild->GetRootElement());
_borderSecond.Child(_secondChild->GetRootElement());

View File

@@ -150,6 +150,7 @@ public:
bool ContainsReadOnly() const;
void EnableBroadcast(bool enabled);
void ShowPaneHeaders(bool show);
void BroadcastKey(const winrt::Microsoft::Terminal::Control::TermControl& sourceControl, const WORD vkey, const WORD scanCode, const winrt::Microsoft::Terminal::Core::ControlKeyStates modifiers, const bool keyDown);
void BroadcastChar(const winrt::Microsoft::Terminal::Control::TermControl& sourceControl, const wchar_t vkey, const WORD scanCode, const winrt::Microsoft::Terminal::Core::ControlKeyStates modifiers);
void BroadcastString(const winrt::Microsoft::Terminal::Control::TermControl& sourceControl, const winrt::hstring& text);
@@ -235,6 +236,11 @@ private:
winrt::Windows::UI::Xaml::Controls::Border _borderFirst{};
winrt::Windows::UI::Xaml::Controls::Border _borderSecond{};
// Per-pane title header (visible when there are split panes)
winrt::Windows::UI::Xaml::Controls::Border _paneHeaderBorder{ nullptr };
winrt::Windows::UI::Xaml::Controls::TextBlock _paneHeaderText{ nullptr };
winrt::TerminalApp::IPaneContent::TitleChanged_revoker _titleChangedRevoker;
PaneResources _themeResources;
#pragma region Properties that need to be transferred between child / parent panes upon splitting / closing
@@ -266,6 +272,8 @@ private:
void _SetupChildCloseHandlers();
winrt::TerminalApp::IPaneContent _takePaneContent();
void _setPaneContent(winrt::TerminalApp::IPaneContent content);
void _CreatePaneHeader();
void _SetupLeafLayout(const winrt::Windows::UI::Xaml::UIElement& control);
bool _HasChild(const std::shared_ptr<Pane> child);
winrt::TerminalApp::TerminalPaneContent _getTerminalContent() const;

View File

@@ -85,6 +85,7 @@ namespace winrt::TerminalApp::implementation
WINRT_PROPERTY(TerminalApp::CommandlineArgs, Command, nullptr);
WINRT_PROPERTY(winrt::hstring, Content);
WINRT_PROPERTY(Windows::Foundation::IReference<Windows::Foundation::Rect>, InitialBounds);
WINRT_PROPERTY(winrt::Microsoft::Terminal::Settings::Model::WindowLayout, PersistedLayout, nullptr);
};
}

View File

@@ -51,5 +51,6 @@ namespace TerminalApp
CommandlineArgs Command { get; };
String Content { get; };
Windows.Foundation.IReference<Windows.Foundation.Rect> InitialBounds { get; };
Microsoft.Terminal.Settings.Model.WindowLayout PersistedLayout;
};
}

View File

@@ -499,24 +499,48 @@
<value>Hinweise von Drittanbietern</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Alle schließen</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Möchten Sie alle Fenster schließen?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Abbrechen</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Alle schließen</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Möchten Sie alle Registerkarten schließen?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Alle schließen</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Möchten Sie diese Registerkarte schließen?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Registerkarte schließen</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Möchten Sie diesen Bereich schließen?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Bereich schließen</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Möchten Sie diese Registerkarten schließen?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Registerkarten schließen</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Möchten Sie diese Bereiche schließen?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Bereiche schließen</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Nicht mehr fragen</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Abbrechen</value>
</data>
@@ -748,6 +772,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Aktivität auf der Registerkarte „{0}“</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Aktivität auf der Registerkarte „{0}“ (Fenster „{1}“)</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Eine neue Registerkarte im angegebenen Startverzeichnis öffnen</value>
</data>
@@ -884,10 +916,10 @@
<value>Wenn diese Option festgelegt ist, wird der Befehl an den Standardbefehl des Profils angefügt, anstatt ihn zu ersetzen.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Verbindung neu starten</value>
<value>Sitzung neu starten</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Verbindung mit aktivem Bereich neu starten</value>
<value>Sitzung im aktiven Bereich neu starten</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Schnipsel</value>

View File

@@ -496,24 +496,48 @@
<value>Third-Party notices</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Close all</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Do you want to close all windows?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Close all</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Do you want to close all tabs?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Close all</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Do you want to close this tab?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Close tab</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Do you want to close this pane?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Close pane</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Do you want to close these tabs?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Close tabs</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Do you want to close these panes?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Close panes</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Don't ask me again</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Cancel</value>
</data>
@@ -719,6 +743,38 @@
<value>unnamed window</value>
<comment>text used to identify when a window hasn't been assigned a name by the user</comment>
</data>
<data name="NameThisWindowMenuItem" xml:space="preserve">
<value>Name this window…</value>
<comment>Menu item text shown when the current window has no name assigned</comment>
</data>
<data name="RenameThisWindowMenuItem" xml:space="preserve">
<value>Rename this window…</value>
<comment>Menu item text shown when the current window already has a name</comment>
</data>
<data name="WindowListUnnamedEntry" xml:space="preserve">
<value>#{0} (unnamed)</value>
<comment>{0} is the window ID number. Shown in the workspace flyout for windows that have no name assigned.</comment>
</data>
<data name="DeleteWorkspaceMenuItem" xml:space="preserve">
<value>Delete workspace?</value>
<comment>Menu item text shown in the right-click context menu on a saved workspace</comment>
</data>
<data name="OpenWorkspaceMenuItem" xml:space="preserve">
<value>Open workspace</value>
<comment>Menu item text for opening a saved workspace</comment>
</data>
<data name="ConfirmDeleteWorkspaceTitle" xml:space="preserve">
<value>Are you sure you want to delete the workspace "{0}"?</value>
<comment>{0} is the workspace name. Shown in a confirmation dialog when the user tries to delete a saved workspace.</comment>
</data>
<data name="ConfirmDeleteWorkspaceDelete" xml:space="preserve">
<value>Delete</value>
<comment>Primary button text on the delete workspace confirmation dialog</comment>
</data>
<data name="ConfirmDeleteWorkspaceCancel" xml:space="preserve">
<value>Cancel</value>
<comment>Cancel button text on the delete workspace confirmation dialog</comment>
</data>
<data name="WindowRenamer.Subtitle" xml:space="preserve">
<value>Enter a new name:</value>
</data>
@@ -745,6 +801,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Activity in tab "{0}"</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Activity in tab "{0}" (window "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Open a new tab in given starting directory</value>
</data>
@@ -881,10 +945,10 @@
<value>If set, the command will be appended to the profile's default command instead of replacing it.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Restart connection</value>
<value>Restart session</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Restart the active pane connection</value>
<value>Restart the session in the active pane</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Snippets</value>

View File

@@ -496,24 +496,48 @@
<value>Avisos de terceros</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Cancelar</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Cerrar todo</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>¿Quiere cerrar todas las ventanas?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Cancelar</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Cerrar todo</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>¿Quieres cerrar todas las pestañas?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Cerrar todo</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>¿Desea cerrar esta pestaña?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Cerrar pestaña</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>¿Desea cerrar este panel?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Cerrar panel</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>¿Desea cerrar estas pestañas?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Cerrar pestañas</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>¿Desea cerrar estos paneles?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Cerrar paneles</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>No volver a preguntarme</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Cancelar</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Actividad en la pestaña "{0}"</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Actividad en la pestaña "{0}" (ventana "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Abrir una nueva pestaña en un directorio de inicio determinado</value>
</data>
@@ -881,10 +913,10 @@
<value>Si se establece, el comando se anexará al comando predeterminado del perfil en lugar de reemplazarlo.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Reiniciar conexión</value>
<value>Reiniciar sesión</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Reiniciar la conexión del panel activo</value>
<value>Reiniciar la sesión en el panel activo</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Fragmentos</value>

View File

@@ -496,24 +496,48 @@
<value>Mentions tierces</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Annuler</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Fermer tout</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Voulez-vous fermer toutes les fenêtres ?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Annuler</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Fermer tout</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Voulez-vous fermer tous les onglets ?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Fermer tout</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Voulez-vous fermer cet onglet ?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Fermer l'onglet</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Voulez-vous fermer ce volet ?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Fermer le volet</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Voulez-vous fermer ces onglets ?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Fermer les onglets</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Voulez-vous fermer ces volets ?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Fermer les panneaux</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Ne plus me le demander</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Annuler</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Activité sous longlet « {0} »</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Activité sous longlet « {0} » (fenêtre « {1} »)</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Ouvrez un nouvel onglet dans le répertoire correspondant</value>
</data>
@@ -881,10 +913,10 @@
<value>Si elle est définie, la commande sera ajoutée à la commande par défaut du profil au lieu de la remplacer.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Redémarrer la connexion</value>
<value>Redémarrer la session</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Redémarrer la connexion du volet actif</value>
<value>Redémarrez la session dans le volet actif</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Extraits</value>

View File

@@ -496,24 +496,48 @@
<value>Comunicazioni di terze parti</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Annulla</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Chiudi tutto</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Vuoi chiudere tutte le finestre?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Annulla</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Chiudi tutto</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Vuoi chiudere tutte le schede?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Chiudi tutto</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Vuoi chiudere questa scheda?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Chiudi scheda</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Vuoi chiudere questo riquadro?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Chiudi riquadro</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Vuoi chiudere queste schede?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Chiudi schede</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Vuoi chiudere questi riquadri?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Chiudi riquadri</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Non chiedermelo più</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Annulla</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Attività nella scheda "{0}"</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Attività nella scheda "{0}" (finestra "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Apri una nuova scheda nella directory di avvio specificata</value>
</data>
@@ -881,10 +913,10 @@
<value>Se impostato, il comando verrà aggiunto al comando predefinito del profilo invece di sostituirlo.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Riavvia connessione</value>
<value>Riavvia la sessione</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Riavvia la connessione al riquadro attivo</value>
<value>Riavvia la sessione nel riquadro attivo</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Frammenti</value>

View File

@@ -497,24 +497,48 @@
<value>サード パーティ通知</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>キャンセル</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>すべて閉じる</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>すべてのウィンドウを閉じますか?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>キャンセル</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>すべて閉じる</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>すべてのタブを閉じますか?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>すべて閉じる</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>このタブを閉じますか?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>タブを閉じる</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>このウィンドウを閉じますか?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>ウィンドウを閉じる</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>これらのタブを閉じますか?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>タブを閉じる</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>これらのウィンドウを閉じますか?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>ウィンドウを閉じる</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>今後、このメッセージを表示しない</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>キャンセル</value>
</data>
@@ -746,6 +770,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>タブ "{0}" のアクティビティ</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>タブ "{0}" のアクティビティ (ウィンドウ "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>指定された開始ディレクトリで新しいタブを開きます</value>
</data>
@@ -882,10 +914,10 @@
<value>設定されている場合、コマンドはプロファイルの既定のコマンドを置き換えるのではなく、追加されます。</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>接続の再起動</value>
<value>セッションの再開</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>アクティブ ペイン接続を再起動します</value>
<value>アクティブなウィンドウでセッションを再起動します</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>抜粋</value>

View File

@@ -496,24 +496,48 @@
<value>타사 통지</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>취소</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>모두 닫기</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>모든 창을 닫으시겠습니까?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>취소</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>모두 닫기</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>모든 탭을 닫으시겠습니까?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>모두 닫기</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>이 탭을 닫으시겠습니까?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>탭 닫기</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>이 창을 닫으시겠습니까?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>창 닫기</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>이러한 탭을 닫으시겠습니까?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>탭 닫기</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>이 창을 닫으시겠습니까?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>창 닫기</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>다시 묻지 않기</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>취소</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>"{0}" 탭의 활동</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>"{0}" 탭의 활동(창 "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>지정된 시작 디렉터리에서 새 탭 열기</value>
</data>
@@ -881,10 +913,10 @@
<value>설정하면 이 명령은 프로필의 기본 명령 대신 프로필의 기본 명령에 추가됩니다.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>연결 다시 시작</value>
<value>세션 다시 시작</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>활성 창 연결 다시 시작</value>
<value>활성 창에서 세션을 다시 시작하세요.</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>짧은 요약</value>

View File

@@ -496,24 +496,48 @@
<value>Avisos de Terceiros</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Cancelar</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Fechar tudo</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Deseja fechar todas as janelas?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Cancelar</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Fechar tudo</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Deseja fechar todas as guias?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Fechar tudo</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Deseja fechar esta guia?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Fechar guia</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Deseja fechar este painel?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Fechar painel</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Deseja fechar estas guias?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Fechar guias</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Deseja fechar estes painéis?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Fechar painéis</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Não me pergunte novamente</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Cancelar</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Atividade na aba "{0}"</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Atividade na aba "{0}" (janela "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Abrir uma nova guia no diretório inicial fornecido</value>
</data>
@@ -881,10 +913,10 @@
<value>Se definido, o comando será acrescentado ao comando padrão do perfil em vez de substituí-lo.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Reiniciar conexão</value>
<value>Reiniciar sessão</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Reiniciar a conexão do painel ativo</value>
<value>Reinicie a sessão no painel ativo</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Trechos</value>

View File

@@ -496,23 +496,47 @@
<value>Ţћĩřð-Ρářŧγ ñοŧīĉęŝ !!! !!!</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<value>Ċдйĉέł !</value>
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Ĉάйçэļ !</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>€ļőşε áļľ !!!</value>
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Ďő убυ ẅåήт ţø ¢ľöѕē äľľ ẃιⁿðŏŵş? !!! !!! !!! </value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<value>Ďõ γбű ẁāŋţ ťó ςℓσśĕ äℓℓ шîйđбẁś? !!! !!! !!! </value>
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Ċľóѕε ªĺĺ !!!</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Ćăʼnċęℓ !</value>
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Ďō γőű шдπŧ ŧò ςłοѕз āĺℓ ţäьš? !!! !!! !!!</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<value>Ćļõѕέ аłℓ !!!</value>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Ĉŀõśê āłĺ !!!</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<value>Đσ ŷőū шдиŧ тò čļòŝз αŀľ ţâвŝ? !!! !!! !!!</value>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Đó уøυ ẅāńť тο çŀǿśę ŧĥíš τάъ? !!! !!! !!!</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Ċℓοѕē ţαъ !!!</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Đò γθũ ώăńт ťǿ ¢ℓσŝę ŧħîŝ ρаńе? !!! !!! !!!</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Ĉŀбśз φдŋё !!!</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Đó ўоú ŵąňτ ŧò çŀσѕė ŧћěśé ţдьş? !!! !!! !!! </value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Ćŀöśé ŧãвś !!!</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Ðǿ ỳбū ŵáήť ŧо ćļόśě τнέšê φăñєš? !!! !!! !!! </value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>€łǿśē рāⁿęѕ !!!</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Đòñ'ť ªѕķ мë àĝáîⁿ !!! !!</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Čǻñčėŀ !</value>
@@ -745,6 +769,14 @@
<value>Ẃϊйδοŵš !!</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Δćţíνïŧý īй τаь "{0}" !!! !!!</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Δсŧìνιŧý įņ ţªь "{0}" (ŵϊņδόώ "{1}") !!! !!! !!! !</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Фφĕń ª пёẅ ţâь ίи ğīνęņ ѕŧāятĩлğ δįŗęćтŏяγ !!! !!! !!! !!! </value>
</data>
@@ -881,10 +913,10 @@
<value>Ĩƒ šęţ, ŧнĕ ¢ömmдлδ ŵîĺł ьέ åφрєйδĕđ τσ ŧђė рřŏƒїłє'ş đзƒªūľţ ¢οmмăńδ іñѕţέáđ øƒ ѓēρļąċĭлĝ їţ. !!! !!! !!! !!! !!! !!! !!! !!! !!! !</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Γēѕŧâяŧ ćǿńńēčťїöл !!! !!</value>
<value>Γēѕŧâяŧ ŝєѕѕïσⁿ !!! !</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Γėşťáгţ ŧħ℮ ãčтĩνέ ρăйё сǿηńëςтιóņ !!! !!! !!! !</value>
<value>Γėşťáгţ ŧħ℮ ŝёšŝīőń įй τђ℮ ăċţΐνе φǻñē !!! !!! !!! !!</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Šņíрρēťş !!</value>

View File

@@ -496,23 +496,47 @@
<value>Ţћĩřð-Ρářŧγ ñοŧīĉęŝ !!! !!!</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<value>Ċдйĉέł !</value>
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Ĉάйçэļ !</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>€ļőşε áļľ !!!</value>
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Ďő убυ ẅåήт ţø ¢ľöѕē äľľ ẃιⁿðŏŵş? !!! !!! !!! </value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<value>Ďõ γбű ẁāŋţ ťó ςℓσśĕ äℓℓ шîйđбẁś? !!! !!! !!! </value>
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Ċľóѕε ªĺĺ !!!</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Ćăʼnċęℓ !</value>
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Ďō γőű шдπŧ ŧò ςłοѕз āĺℓ ţäьš? !!! !!! !!!</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<value>Ćļõѕέ аłℓ !!!</value>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Ĉŀõśê āłĺ !!!</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<value>Đσ ŷőū шдиŧ тò čļòŝз αŀľ ţâвŝ? !!! !!! !!!</value>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Đó уøυ ẅāńť тο çŀǿśę ŧĥíš τάъ? !!! !!! !!!</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Ċℓοѕē ţαъ !!!</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Đò γθũ ώăńт ťǿ ¢ℓσŝę ŧħîŝ ρаńе? !!! !!! !!!</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Ĉŀбśз φдŋё !!!</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Đó ўоú ŵąňτ ŧò çŀσѕė ŧћěśé ţдьş? !!! !!! !!! </value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Ćŀöśé ŧãвś !!!</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Ðǿ ỳбū ŵáήť ŧо ćļόśě τнέšê φăñєš? !!! !!! !!! </value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>€łǿśē рāⁿęѕ !!!</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Đòñ'ť ªѕķ мë àĝáîⁿ !!! !!</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Čǻñčėŀ !</value>
@@ -745,6 +769,14 @@
<value>Ẃϊйδοŵš !!</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Δćţíνïŧý īй τаь "{0}" !!! !!!</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Δсŧìνιŧý įņ ţªь "{0}" (ŵϊņδόώ "{1}") !!! !!! !!! !</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Фφĕń ª пёẅ ţâь ίи ğīνęņ ѕŧāятĩлğ δįŗęćтŏяγ !!! !!! !!! !!! </value>
</data>
@@ -881,10 +913,10 @@
<value>Ĩƒ šęţ, ŧнĕ ¢ömmдлδ ŵîĺł ьέ åφрєйδĕđ τσ ŧђė рřŏƒїłє'ş đзƒªūľţ ¢οmмăńδ іñѕţέáđ øƒ ѓēρļąċĭлĝ їţ. !!! !!! !!! !!! !!! !!! !!! !!! !!! !</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Γēѕŧâяŧ ćǿńńēčťїöл !!! !!</value>
<value>Γēѕŧâяŧ ŝєѕѕïσⁿ !!! !</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Γėşťáгţ ŧħ℮ ãčтĩνέ ρăйё сǿηńëςтιóņ !!! !!! !!! !</value>
<value>Γėşťáгţ ŧħ℮ ŝёšŝīőń įй τђ℮ ăċţΐνе φǻñē !!! !!! !!! !!</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Šņíрρēťş !!</value>

View File

@@ -496,23 +496,47 @@
<value>Ţћĩřð-Ρářŧγ ñοŧīĉęŝ !!! !!!</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<value>Ċдйĉέł !</value>
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Ĉάйçэļ !</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>€ļőşε áļľ !!!</value>
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Ďő убυ ẅåήт ţø ¢ľöѕē äľľ ẃιⁿðŏŵş? !!! !!! !!! </value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<value>Ďõ γбű ẁāŋţ ťó ςℓσśĕ äℓℓ шîйđбẁś? !!! !!! !!! </value>
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Ċľóѕε ªĺĺ !!!</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Ćăʼnċęℓ !</value>
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Ďō γőű шдπŧ ŧò ςłοѕз āĺℓ ţäьš? !!! !!! !!!</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<value>Ćļõѕέ аłℓ !!!</value>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Ĉŀõśê āłĺ !!!</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<value>Đσ ŷőū шдиŧ тò čļòŝз αŀľ ţâвŝ? !!! !!! !!!</value>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Đó уøυ ẅāńť тο çŀǿśę ŧĥíš τάъ? !!! !!! !!!</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Ċℓοѕē ţαъ !!!</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Đò γθũ ώăńт ťǿ ¢ℓσŝę ŧħîŝ ρаńе? !!! !!! !!!</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Ĉŀбśз φдŋё !!!</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Đó ўоú ŵąňτ ŧò çŀσѕė ŧћěśé ţдьş? !!! !!! !!! </value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Ćŀöśé ŧãвś !!!</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Ðǿ ỳбū ŵáήť ŧо ćļόśě τнέšê φăñєš? !!! !!! !!! </value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>€łǿśē рāⁿęѕ !!!</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Đòñ'ť ªѕķ мë àĝáîⁿ !!! !!</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Čǻñčėŀ !</value>
@@ -745,6 +769,14 @@
<value>Ẃϊйδοŵš !!</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Δćţíνïŧý īй τаь "{0}" !!! !!!</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Δсŧìνιŧý įņ ţªь "{0}" (ŵϊņδόώ "{1}") !!! !!! !!! !</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Фφĕń ª пёẅ ţâь ίи ğīνęņ ѕŧāятĩлğ δįŗęćтŏяγ !!! !!! !!! !!! </value>
</data>
@@ -881,10 +913,10 @@
<value>Ĩƒ šęţ, ŧнĕ ¢ömmдлδ ŵîĺł ьέ åφрєйδĕđ τσ ŧђė рřŏƒїłє'ş đзƒªūľţ ¢οmмăńδ іñѕţέáđ øƒ ѓēρļąċĭлĝ їţ. !!! !!! !!! !!! !!! !!! !!! !!! !!! !</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Γēѕŧâяŧ ćǿńńēčťїöл !!! !!</value>
<value>Γēѕŧâяŧ ŝєѕѕïσⁿ !!! !</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Γėşťáгţ ŧħ℮ ãčтĩνέ ρăйё сǿηńëςтιóņ !!! !!! !!! !</value>
<value>Γėşťáгţ ŧħ℮ ŝёšŝīőń įй τђ℮ ăċţΐνе φǻñē !!! !!! !!! !!</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Šņíрρēťş !!</value>

View File

@@ -496,24 +496,48 @@
<value>Уведомления третьих лиц</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>Отмена</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>Закрыть все</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>Закрыть все окна?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>Отмена</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>Закрыть все</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>Закрыть все вкладки?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>Закрыть все</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>Закрыть эту вкладку?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>Закрыть вкладку</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>Закрыть эту панель?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>Закрыть область</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>Закрыть эти вкладки?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>Закрыть вкладки</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>Закрыть эти панели?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>Закрыть панели</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>Больше не спрашивать</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>Отмена</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>Активность на вкладке "{0}"</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>Активность на вкладке "{0}" (окно "{1}")</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>Открыть новую вкладку в указанном начальном каталоге</value>
</data>
@@ -881,10 +913,10 @@
<value>Если этот параметр настроен, команда будет добавлена к стандартной команде профиля, а не заменит ее.</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>Перезапустить подключение</value>
<value>Перезапустить сеанс</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>Перезапустить соединение с активной панелью.</value>
<value>Перезапустите сеанс в активной панели</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>Фрагменты</value>

View File

@@ -496,24 +496,48 @@
<value>第三方通知</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>全部关闭</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>是否要关闭所有窗口?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>取消</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>全部关闭</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>是否要关闭所有标签页?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>全部关闭</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>是否要关闭此选项卡?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>关闭选项卡</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>是否要关闭此窗格?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>关闭窗格</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>是否要关闭这些选项卡?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>关闭选项卡</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>是否要关闭这些窗格?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>关闭窗格</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>不再询问</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>取消</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>选项卡“{0}”中的活动</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>选项卡“{0}”(窗口“{1}”)中的活动</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>在给定的起始目录中打开新选项卡</value>
</data>
@@ -881,10 +913,10 @@
<value>如果设置,该命令将追加到配置文件的默认命令,而不是替换它。</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>重新启动连接</value>
<value>重启会话</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>重新启动活动窗格连接</value>
<value>重活动窗格中的会话</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>片段</value>

View File

@@ -496,24 +496,48 @@
<value>第三方注意事項</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="QuitDialog.CloseButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="QuitDialog.PrimaryButtonText" xml:space="preserve">
<value>全部關閉</value>
</data>
<data name="QuitDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>您要關閉所有視窗嗎?</value>
</data>
<data name="CloseAllDialog.CloseButtonText" xml:space="preserve">
<value>取消</value>
</data>
<data name="CloseAllDialog.PrimaryButtonText" xml:space="preserve">
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>全部關閉</value>
</data>
<data name="CloseAllDialog.Title" xml:space="preserve">
<data name="ConfirmCloseDialog_WindowTitle" xml:space="preserve">
<value>您要關閉所有索引標籤嗎?</value>
</data>
<data name="ConfirmCloseDialog_WindowPrimary" xml:space="preserve">
<value>全部關閉</value>
</data>
<data name="ConfirmCloseDialog_TabTitle" xml:space="preserve">
<value>是否要關閉此索引標籤?</value>
</data>
<data name="ConfirmCloseDialog_TabPrimary" xml:space="preserve">
<value>關閉索引標籤</value>
</data>
<data name="ConfirmCloseDialog_PaneTitle" xml:space="preserve">
<value>是否要關閉此窗格?</value>
</data>
<data name="ConfirmCloseDialog_PanePrimary" xml:space="preserve">
<value>關閉窗格</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsTitle" xml:space="preserve">
<value>是否要關閉這些索引標籤?</value>
</data>
<data name="ConfirmCloseDialog_MultipleTabsPrimary" xml:space="preserve">
<value>關閉索引標籤</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesTitle" xml:space="preserve">
<value>是否要關閉這些窗格?</value>
</data>
<data name="ConfirmCloseDialog_MultiplePanesPrimary" xml:space="preserve">
<value>關閉窗格</value>
</data>
<data name="DontAskAgainCheckBox.Content" xml:space="preserve">
<value>不要再問我</value>
</data>
<data name="CloseReadOnlyDialog.CloseButtonText" xml:space="preserve">
<value>取消</value>
</data>
@@ -745,6 +769,14 @@
<value>Windows</value>
<comment>This is displayed as a label for the context menu item that holds the submenu of available windows.</comment>
</data>
<data name="NotificationMessage_TabActivity" xml:space="preserve">
<value>索引標籤「{0}」中的活動</value>
<comment>{0} is the tab title. Shown as the body of a desktop notification when tab activity is detected.</comment>
</data>
<data name="NotificationMessage_TabActivityInWindow" xml:space="preserve">
<value>索引標籤「{0}」(視窗「{1}」) 中的活動</value>
<comment>{0} is the tab title, {1} is the window name. Shown as the body of a desktop notification when tab activity is detected and the window has a name.</comment>
</data>
<data name="DropPathTabRun.Text" xml:space="preserve">
<value>開啟指定起始目錄中的新索引標籤</value>
</data>
@@ -881,10 +913,10 @@
<value>如果設定,命令會附加到設定檔的預設命令,而不是取代命令。</value>
</data>
<data name="RestartConnectionText" xml:space="preserve">
<value>重新啟動連線</value>
<value>重新啟動工作模式</value>
</data>
<data name="RestartConnectionToolTip" xml:space="preserve">
<value>重新啟動使用中窗格連線</value>
<value>使用中窗格重新啟動工作階段</value>
</data>
<data name="SnippetPaneTitle.Text" xml:space="preserve">
<value>片斷</value>

View File

@@ -23,7 +23,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Settings::Model::INewContentArgs GetNewTerminalArgs(BuildStartupKind kind) const;
winrt::hstring Title() { return L"Scratchpad"; }
uint64_t TaskbarState() { return 0; }
winrt::Microsoft::Terminal::Control::TaskbarState TaskbarState() { return winrt::Microsoft::Terminal::Control::TaskbarState::Clear; }
uint64_t TaskbarProgress() { return 0; }
bool ReadOnly() { return false; }
winrt::hstring Icon() const;

View File

@@ -23,7 +23,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Settings::Model::INewContentArgs GetNewTerminalArgs(const BuildStartupKind kind) const;
winrt::hstring Title() { return RS_(L"SettingsTab"); }
uint64_t TaskbarState() { return 0; }
winrt::Microsoft::Terminal::Control::TaskbarState TaskbarState() { return winrt::Microsoft::Terminal::Control::TaskbarState::Clear; }
uint64_t TaskbarProgress() { return 0; }
bool ReadOnly() { return false; }
winrt::hstring Icon() const;

View File

@@ -24,7 +24,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Settings::Model::INewContentArgs GetNewTerminalArgs(BuildStartupKind kind) const;
winrt::hstring Title() { return RS_(L"SnippetPaneTitle/Text"); }
uint64_t TaskbarState() { return 0; }
winrt::Microsoft::Terminal::Control::TaskbarState TaskbarState() { return winrt::Microsoft::Terminal::Control::TaskbarState::Clear; }
uint64_t TaskbarProgress() { return 0; }
bool ReadOnly() { return false; }
winrt::hstring Icon() const;

View File

@@ -35,7 +35,6 @@ namespace winrt::TerminalApp::implementation
_activePane = nullptr;
_closePaneMenuItem.Visibility(WUX::Visibility::Collapsed);
_restartConnectionMenuItem.Visibility(WUX::Visibility::Collapsed);
auto firstId = _nextPaneId;
@@ -86,6 +85,7 @@ namespace winrt::TerminalApp::implementation
_MakeTabViewItem();
_CreateContextMenu();
_UpdateMenuItemStates();
_headerControl.TabStatus(_tabStatus);
@@ -123,6 +123,12 @@ namespace winrt::TerminalApp::implementation
_bellIndicatorTimer.Stop();
}
void Tab::_ActivityIndicatorTimerTick(const Windows::Foundation::IInspectable& /*sender*/, const Windows::Foundation::IInspectable& /*e*/)
{
ShowActivityIndicator(false);
_activityIndicatorTimer.Stop();
}
// Method Description:
// - Initializes a TabViewItem for this Tab instance.
// Arguments:
@@ -329,6 +335,10 @@ namespace winrt::TerminalApp::implementation
{
ShowBellIndicator(false);
}
if (_tabStatus.ActivityIndicator())
{
ShowActivityIndicator(false);
}
}
}
@@ -361,6 +371,10 @@ namespace winrt::TerminalApp::implementation
// The tabWidthMode may have changed, update the header control accordingly
_UpdateHeaderControlMaxWidth();
// Refresh pane header visibility based on the current setting
const auto showHeaders = settings.GlobalSettings().ShowPaneHeaders() && _rootPane->GetLeafPaneCount() > 1;
_rootPane->ShowPaneHeaders(showHeaders);
// Update the settings on all our panes.
_rootPane->WalkTree([&](const auto& pane) {
pane->UpdateSettings(settings);
@@ -459,6 +473,26 @@ namespace winrt::TerminalApp::implementation
_bellIndicatorTimer.Start();
}
void Tab::ShowActivityIndicator(const bool show)
{
ASSERT_UI_THREAD();
_tabStatus.ActivityIndicator(show);
}
void Tab::ActivateActivityIndicatorTimer()
{
ASSERT_UI_THREAD();
if (!_activityIndicatorTimer)
{
_activityIndicatorTimer.Interval(std::chrono::milliseconds(2000));
_activityIndicatorTimer.Tick({ get_weak(), &Tab::_ActivityIndicatorTimerTick });
}
_activityIndicatorTimer.Start();
}
// Method Description:
// - Gets the title string of the last focused terminal control in our tree.
// Returns the empty string if there is no such control.
@@ -646,6 +680,14 @@ namespace winrt::TerminalApp::implementation
// After split, Close Pane Menu Item should be visible
_closePaneMenuItem.Visibility(WUX::Visibility::Visible);
// Show pane headers now that we have multiple panes (if the setting is enabled)
try
{
const auto settings{ winrt::TerminalApp::implementation::AppLogic::CurrentAppSettings() };
_rootPane->ShowPaneHeaders(settings.GlobalSettings().ShowPaneHeaders());
}
CATCH_LOG();
// The active pane has an id if it is a leaf
if (activePaneId)
{
@@ -844,14 +886,14 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - direction: The direction to move the separator in.
// Return Value:
// - <none>
void Tab::ResizePane(const ResizeDirection& direction)
// - whether a pane was resized
bool Tab::ResizePane(const ResizeDirection& direction)
{
ASSERT_UI_THREAD();
// NOTE: This _must_ be called on the root pane, so that it can propagate
// throughout the entire tree.
_rootPane->ResizePane(direction);
return _rootPane->ResizePane(direction);
}
// Method Description:
@@ -1148,6 +1190,14 @@ namespace winrt::TerminalApp::implementation
tab->TabRaiseVisualBell.raise();
}
// Send a desktop toast notification if requested, but only if
// the pane isn't already in the belled state. This prevents
// sending repeated toasts for repeated BEL characters.
if (bellArgs.SendNotification() && !tab->_tabStatus.BellIndicator())
{
tab->TabToastNotificationRequested.raise(tab->Title(), L"", sender);
}
// Show the bell indicator in the tab header
tab->ShowBellIndicator(true);
@@ -1166,6 +1216,55 @@ namespace winrt::TerminalApp::implementation
events.RestartTerminalRequested = terminal.RestartTerminalRequested(winrt::auto_revoke, { get_weak(), &Tab::_bubbleRestartTerminalRequested });
}
events.NotificationRequested = content.NotificationRequested(
winrt::auto_revoke,
[dispatcher, weakThis](TerminalApp::IPaneContent sender, auto notifArgs) -> safe_void_coroutine {
const auto weakThisCopy = weakThis;
co_await wil::resume_foreground(dispatcher);
if (const auto tab{ weakThisCopy.get() })
{
const auto activeContent = tab->GetActiveContent();
const auto isActivePaneContent = activeContent && activeContent == sender;
if (!notifArgs.AlwaysNotify() && isActivePaneContent &&
tab->_focusState != WUX::FocusState::Unfocused)
{
co_return;
}
const auto style = notifArgs.Style();
if (WI_IsFlagSet(style, OutputNotificationStyle::Taskbar))
{
tab->TabRaiseVisualBell.raise();
}
if (WI_IsFlagSet(style, winrt::Microsoft::Terminal::Control::OutputNotificationStyle::Audible))
{
if (const auto termContent{ sender.try_as<TerminalApp::TerminalPaneContent>() })
{
termContent.PlayNotificationSound();
}
}
if (WI_IsFlagSet(style, winrt::Microsoft::Terminal::Control::OutputNotificationStyle::Tab))
{
tab->ShowActivityIndicator(true);
if (tab->_focusState != WUX::FocusState::Unfocused)
{
tab->ActivateActivityIndicatorTimer();
}
}
if (WI_IsFlagSet(style, winrt::Microsoft::Terminal::Control::OutputNotificationStyle::Notification))
{
const auto title = notifArgs.Title().empty() ? tab->Title() : notifArgs.Title();
tab->TabToastNotificationRequested.raise(title, notifArgs.Body(), sender);
}
}
});
if (_tabStatus.IsInputBroadcastActive())
{
if (const auto& termContent{ content.try_as<TerminalApp::TerminalPaneContent>() })
@@ -1222,11 +1321,10 @@ namespace winrt::TerminalApp::implementation
const auto taskbarState = state.State();
// The progress of the control changed, but not necessarily the progress of the tab.
// Set the tab's progress ring to the active pane's progress
if (taskbarState > 0)
if (taskbarState != winrt::Microsoft::Terminal::Control::TaskbarState::Clear)
{
if (taskbarState == 3)
if (taskbarState == winrt::Microsoft::Terminal::Control::TaskbarState::Indeterminate)
{
// 3 is the indeterminate state, set the progress ring as such
_tabStatus.IsProgressRingIndeterminate(true);
}
else
@@ -1254,7 +1352,7 @@ namespace winrt::TerminalApp::implementation
// Method Description:
// - Set an indicator on the tab if any pane is in a closed connection state.
// - Show/hide the Restart Connection context menu entry depending on active pane's state.
// - Show/hide the Restart Session context menu entry depending on active pane's state.
// Arguments:
// - <none>
// Return Value:
@@ -1271,13 +1369,6 @@ namespace winrt::TerminalApp::implementation
_tabStatus.IsConnectionClosed(isClosed);
}
if (_activePane)
{
_restartConnectionMenuItem.Visibility(_activePane->IsConnectionClosed() ?
WUX::Visibility::Visible :
WUX::Visibility::Collapsed);
}
}
void Tab::_RestartActivePaneConnection()
@@ -1324,6 +1415,7 @@ namespace winrt::TerminalApp::implementation
if (_rootPane->GetLeafPaneCount() == 1)
{
_closePaneMenuItem.Visibility(WUX::Visibility::Collapsed);
_rootPane->ShowPaneHeaders(false);
}
_RecalculateAndApplyReadOnly();
@@ -1348,6 +1440,22 @@ namespace winrt::TerminalApp::implementation
}
});
}
_UpdateMenuItemStates();
}
void Tab::_UpdateMenuItemStates()
{
// Terminal-specific menu items
const auto content = _activePane ? _activePane->GetContent() : nullptr;
const auto isTerm = content && content.try_as<winrt::TerminalApp::TerminalPaneContent>() != nullptr;
_duplicateTabMenuItem.IsEnabled(isTerm);
_exportTabMenuItem.IsEnabled(isTerm);
_findMenuItem.IsEnabled(isTerm);
_restartConnectionMenuItem.IsEnabled(isTerm);
// Snippets Pane can technically be split
_splitTabMenuItem.IsEnabled(isTerm || (content && content.try_as<winrt::TerminalApp::SnippetsPaneContent>() != nullptr));
}
// Method Description:
@@ -1393,6 +1501,10 @@ namespace winrt::TerminalApp::implementation
{
tab->ShowBellIndicator(false);
}
if (tab->_tabStatus.ActivityIndicator())
{
tab->ShowActivityIndicator(false);
}
}
});
@@ -1652,106 +1764,100 @@ namespace winrt::TerminalApp::implementation
Automation::AutomationProperties::SetHelpText(renameTabMenuItem, renameTabToolTip);
}
Controls::MenuFlyoutItem duplicateTabMenuItem;
{
// "Duplicate tab"
Controls::FontIcon duplicateTabSymbol;
duplicateTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
duplicateTabSymbol.Glyph(L"\xF5ED");
duplicateTabMenuItem.Click({ get_weak(), &Tab::_duplicateTabClicked });
duplicateTabMenuItem.Text(RS_(L"DuplicateTabText"));
duplicateTabMenuItem.Icon(duplicateTabSymbol);
_duplicateTabMenuItem.Click({ get_weak(), &Tab::_duplicateTabClicked });
_duplicateTabMenuItem.Text(RS_(L"DuplicateTabText"));
_duplicateTabMenuItem.Icon(duplicateTabSymbol);
const auto duplicateTabToolTip = RS_(L"DuplicateTabToolTip");
WUX::Controls::ToolTipService::SetToolTip(duplicateTabMenuItem, box_value(duplicateTabToolTip));
Automation::AutomationProperties::SetHelpText(duplicateTabMenuItem, duplicateTabToolTip);
WUX::Controls::ToolTipService::SetToolTip(_duplicateTabMenuItem, box_value(duplicateTabToolTip));
Automation::AutomationProperties::SetHelpText(_duplicateTabMenuItem, duplicateTabToolTip);
}
Controls::MenuFlyoutItem splitTabMenuItem;
{
// "Split tab"
Controls::FontIcon splitTabSymbol;
splitTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
splitTabSymbol.Glyph(L"\xF246"); // ViewDashboard
splitTabMenuItem.Click({ get_weak(), &Tab::_splitTabClicked });
splitTabMenuItem.Text(RS_(L"SplitTabText"));
splitTabMenuItem.Icon(splitTabSymbol);
_splitTabMenuItem.Click({ get_weak(), &Tab::_splitTabClicked });
_splitTabMenuItem.Text(RS_(L"SplitTabText"));
_splitTabMenuItem.Icon(splitTabSymbol);
const auto splitTabToolTip = RS_(L"SplitTabToolTip");
WUX::Controls::ToolTipService::SetToolTip(splitTabMenuItem, box_value(splitTabToolTip));
Automation::AutomationProperties::SetHelpText(splitTabMenuItem, splitTabToolTip);
WUX::Controls::ToolTipService::SetToolTip(_splitTabMenuItem, box_value(splitTabToolTip));
Automation::AutomationProperties::SetHelpText(_splitTabMenuItem, splitTabToolTip);
}
Controls::MenuFlyoutItem closePaneMenuItem = _closePaneMenuItem;
{
// "Close pane"
closePaneMenuItem.Click({ get_weak(), &Tab::_closePaneClicked });
closePaneMenuItem.Text(RS_(L"ClosePaneText"));
_closePaneMenuItem.Click({ get_weak(), &Tab::_closePaneClicked });
_closePaneMenuItem.Text(RS_(L"ClosePaneText"));
const auto closePaneToolTip = RS_(L"ClosePaneToolTip");
WUX::Controls::ToolTipService::SetToolTip(closePaneMenuItem, box_value(closePaneToolTip));
Automation::AutomationProperties::SetHelpText(closePaneMenuItem, closePaneToolTip);
WUX::Controls::ToolTipService::SetToolTip(_closePaneMenuItem, box_value(closePaneToolTip));
Automation::AutomationProperties::SetHelpText(_closePaneMenuItem, closePaneToolTip);
}
Controls::MenuFlyoutItem exportTabMenuItem;
{
// "Export tab"
Controls::FontIcon exportTabSymbol;
exportTabSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
exportTabSymbol.Glyph(L"\xE74E"); // Save
exportTabMenuItem.Click({ get_weak(), &Tab::_exportTextClicked });
exportTabMenuItem.Text(RS_(L"ExportTabText"));
exportTabMenuItem.Icon(exportTabSymbol);
_exportTabMenuItem.Click({ get_weak(), &Tab::_exportTextClicked });
_exportTabMenuItem.Text(RS_(L"ExportTabText"));
_exportTabMenuItem.Icon(exportTabSymbol);
const auto exportTabToolTip = RS_(L"ExportTabToolTip");
WUX::Controls::ToolTipService::SetToolTip(exportTabMenuItem, box_value(exportTabToolTip));
Automation::AutomationProperties::SetHelpText(exportTabMenuItem, exportTabToolTip);
WUX::Controls::ToolTipService::SetToolTip(_exportTabMenuItem, box_value(exportTabToolTip));
Automation::AutomationProperties::SetHelpText(_exportTabMenuItem, exportTabToolTip);
}
Controls::MenuFlyoutItem findMenuItem;
{
// "Find"
Controls::FontIcon findSymbol;
findSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
findSymbol.Glyph(L"\xF78B"); // SearchMedium
findMenuItem.Click({ get_weak(), &Tab::_findClicked });
findMenuItem.Text(RS_(L"FindText"));
findMenuItem.Icon(findSymbol);
_findMenuItem.Click({ get_weak(), &Tab::_findClicked });
_findMenuItem.Text(RS_(L"FindText"));
_findMenuItem.Icon(findSymbol);
const auto findToolTip = RS_(L"FindToolTip");
WUX::Controls::ToolTipService::SetToolTip(findMenuItem, box_value(findToolTip));
Automation::AutomationProperties::SetHelpText(findMenuItem, findToolTip);
WUX::Controls::ToolTipService::SetToolTip(_findMenuItem, box_value(findToolTip));
Automation::AutomationProperties::SetHelpText(_findMenuItem, findToolTip);
}
Controls::MenuFlyoutItem restartConnectionMenuItem = _restartConnectionMenuItem;
{
// "Restart connection"
// "Restart session"
Controls::FontIcon restartConnectionSymbol;
restartConnectionSymbol.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
restartConnectionSymbol.Glyph(L"\xE72C");
restartConnectionMenuItem.Click([weakThis](auto&&, auto&&) {
_restartConnectionMenuItem.Click([weakThis](auto&&, auto&&) {
if (auto tab{ weakThis.get() })
{
tab->_RestartActivePaneConnection();
}
});
restartConnectionMenuItem.Text(RS_(L"RestartConnectionText"));
restartConnectionMenuItem.Icon(restartConnectionSymbol);
_restartConnectionMenuItem.Text(RS_(L"RestartConnectionText"));
_restartConnectionMenuItem.Icon(restartConnectionSymbol);
const auto restartConnectionToolTip = RS_(L"RestartConnectionToolTip");
WUX::Controls::ToolTipService::SetToolTip(restartConnectionMenuItem, box_value(restartConnectionToolTip));
Automation::AutomationProperties::SetHelpText(restartConnectionMenuItem, restartConnectionToolTip);
WUX::Controls::ToolTipService::SetToolTip(_restartConnectionMenuItem, box_value(restartConnectionToolTip));
Automation::AutomationProperties::SetHelpText(_restartConnectionMenuItem, restartConnectionToolTip);
}
// Build the menu
@@ -1759,16 +1865,16 @@ namespace winrt::TerminalApp::implementation
Controls::MenuFlyoutSeparator menuSeparator;
contextMenuFlyout.Items().Append(chooseColorMenuItem);
contextMenuFlyout.Items().Append(renameTabMenuItem);
contextMenuFlyout.Items().Append(duplicateTabMenuItem);
contextMenuFlyout.Items().Append(splitTabMenuItem);
contextMenuFlyout.Items().Append(_duplicateTabMenuItem);
contextMenuFlyout.Items().Append(_splitTabMenuItem);
_AppendMoveMenuItems(contextMenuFlyout);
contextMenuFlyout.Items().Append(exportTabMenuItem);
contextMenuFlyout.Items().Append(findMenuItem);
contextMenuFlyout.Items().Append(restartConnectionMenuItem);
contextMenuFlyout.Items().Append(_exportTabMenuItem);
contextMenuFlyout.Items().Append(_findMenuItem);
contextMenuFlyout.Items().Append(_restartConnectionMenuItem);
contextMenuFlyout.Items().Append(menuSeparator);
auto closeSubMenu = _AppendCloseMenuItems(contextMenuFlyout);
closeSubMenu.Items().Append(closePaneMenuItem);
closeSubMenu.Items().Append(_closePaneMenuItem);
// GH#5750 - When the context menu is dismissed with ESC, toss the focus
// back to our control.

View File

@@ -48,12 +48,15 @@ namespace winrt::TerminalApp::implementation
void ShowBellIndicator(const bool show);
void ActivateBellIndicatorTimer();
void ShowActivityIndicator(const bool show);
void ActivateActivityIndicatorTimer();
float CalcSnappedDimension(const bool widthOrHeight, const float dimension) const;
std::optional<winrt::Microsoft::Terminal::Settings::Model::SplitDirection> PreCalculateCanSplit(winrt::Microsoft::Terminal::Settings::Model::SplitDirection splitType,
const float splitSize,
winrt::Windows::Foundation::Size availableSpace) const;
void ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
bool ResizePane(const winrt::Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
bool NavigateFocus(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
bool SwapPane(const winrt::Microsoft::Terminal::Settings::Model::FocusDirection& direction);
bool FocusPane(const uint32_t id);
@@ -121,6 +124,7 @@ namespace winrt::TerminalApp::implementation
til::typed_event<TerminalApp::Tab, IInspectable> ActivePaneChanged;
til::event<winrt::delegate<>> TabRaiseVisualBell;
til::event<winrt::delegate<winrt::hstring /*title*/, winrt::hstring /*body*/, winrt::TerminalApp::IPaneContent /*content*/>> TabToastNotificationRequested;
til::typed_event<IInspectable, IInspectable> TaskbarProgressChanged;
// The TabViewIndex is the index this Tab object resides in TerminalPage's _tabs vector.
@@ -140,11 +144,17 @@ namespace winrt::TerminalApp::implementation
static constexpr double HeaderRenameBoxWidthTitleLength{ std::numeric_limits<double>::infinity() };
winrt::Windows::UI::Xaml::FocusState _focusState{ winrt::Windows::UI::Xaml::FocusState::Unfocused };
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeOtherTabsMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _duplicateTabMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _splitTabMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveToNewWindowMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveRightMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _moveLeftMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _exportTabMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _findMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _restartConnectionMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeOtherTabsMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closeTabsAfterMenuItem{};
winrt::Windows::UI::Xaml::Controls::MenuFlyoutItem _closePaneMenuItem{};
winrt::TerminalApp::ShortcutActionDispatch _dispatch;
Microsoft::Terminal::Settings::Model::IActionMapView _actionMap{ nullptr };
winrt::hstring _keyChord{};
@@ -159,9 +169,6 @@ namespace winrt::TerminalApp::implementation
std::shared_ptr<Pane> _activePane{ nullptr };
std::shared_ptr<Pane> _zoomedPane{ nullptr };
Windows::UI::Xaml::Controls::MenuFlyoutItem _closePaneMenuItem;
Windows::UI::Xaml::Controls::MenuFlyoutItem _restartConnectionMenuItem;
winrt::Microsoft::Terminal::Settings::Model::IconStyle _lastIconStyle;
winrt::hstring _lastIconPath{};
std::optional<winrt::Windows::UI::Color> _runtimeTabColor{};
@@ -182,6 +189,7 @@ namespace winrt::TerminalApp::implementation
winrt::TerminalApp::IPaneContent::ConnectionStateChanged_revoker ConnectionStateChanged;
winrt::TerminalApp::IPaneContent::ReadOnlyChanged_revoker ReadOnlyChanged;
winrt::TerminalApp::IPaneContent::FocusRequested_revoker FocusRequested;
winrt::TerminalApp::IPaneContent::NotificationRequested_revoker NotificationRequested;
// These events literally only apply if the content is a TermControl.
winrt::Microsoft::Terminal::Control::TermControl::KeySent_revoker KeySent;
@@ -210,6 +218,9 @@ namespace winrt::TerminalApp::implementation
SafeDispatcherTimer _bellIndicatorTimer;
void _BellIndicatorTimerTick(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
SafeDispatcherTimer _activityIndicatorTimer;
void _ActivityIndicatorTimerTick(const Windows::Foundation::IInspectable& sender, const Windows::Foundation::IInspectable& e);
void _UpdateHeaderControlMaxWidth();
void _CreateContextMenu();
@@ -220,6 +231,7 @@ namespace winrt::TerminalApp::implementation
void _AttachEventHandlersToPane(std::shared_ptr<Pane> pane);
void _UpdateActivePane(std::shared_ptr<Pane> pane);
void _UpdateMenuItemStates();
winrt::hstring _GetActiveTitle() const;
@@ -230,8 +242,6 @@ namespace winrt::TerminalApp::implementation
void _UpdateConnectionClosedState();
void _RestartActivePaneConnection();
void _DuplicateTab();
winrt::Windows::UI::Xaml::Media::Brush _BackgroundBrush();
void _MakeTabViewItem();

View File

@@ -32,6 +32,12 @@
FontSize="12"
Glyph="&#xEA8F;"
Visibility="{x:Bind TabStatus.BellIndicator, Mode=OneWay}" />
<FontIcon x:Name="HeaderActivityIndicator"
Margin="0,0,8,0"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="8"
Glyph="&#xF127;"
Visibility="{x:Bind TabStatus.ActivityIndicator, Mode=OneWay}" />
<FontIcon x:Name="HeaderZoomIcon"
Margin="0,0,8,0"
FontFamily="{ThemeResource SymbolThemeFontFamily}"

View File

@@ -17,6 +17,7 @@
#include "TabRowControl.h"
#include "DebugTapConnection.h"
#include "DesktopNotification.h"
#include "..\TerminalSettingsModel\FileUtils.h"
#include "../TerminalSettingsAppAdapterLib/TerminalSettings.h"
@@ -150,6 +151,18 @@ namespace winrt::TerminalApp::implementation
}
});
// When a tab requests a desktop toast notification, send the toast
// and handle activation by summoning this window and switching to the tab.
newTabImpl->TabToastNotificationRequested([weakThis{ get_weak() }, weakTab{ newTabImpl->get_weak() }](const winrt::hstring& title, const winrt::hstring& body, const winrt::TerminalApp::IPaneContent& content) {
if (const auto page{ weakThis.get() })
{
if (const auto tab{ weakTab.get() })
{
page->_SendDesktopNotification(title, body, tab, content);
}
}
});
auto tabViewItem = newTabImpl->TabViewItem();
_tabView.TabItems().InsertAt(insertPosition, tabViewItem);
@@ -394,7 +407,9 @@ namespace winrt::TerminalApp::implementation
// - Removes the tab (both TerminalControl and XAML) after prompting for approval
// Arguments:
// - tab: the tab to remove
winrt::Windows::Foundation::IAsyncAction TerminalPage::_HandleCloseTabRequested(winrt::TerminalApp::Tab tab)
// - skipConfirmClose: if true, skip the confirmOnClose check. Used when
// an aggregate confirmation has already been shown (i.e. close other tabs)
winrt::Windows::Foundation::IAsyncAction TerminalPage::_HandleCloseTabRequested(winrt::TerminalApp::Tab tab, bool skipConfirmClose)
{
winrt::com_ptr<TerminalPage> strong;
@@ -413,10 +428,43 @@ namespace winrt::TerminalApp::implementation
}
}
// Skip the per-tab confirmOnClose check when the caller has already
// shown an aggregate confirmation dialog (e.g. _RemoveTabs).
if (!skipConfirmClose)
{
const auto tabImpl = _GetTabImpl(tab);
if (tabImpl && _ShouldWarnOnCloseTab(tabImpl))
{
const auto weak = get_weak();
auto warningResult = co_await _ShowConfirmCloseDialog(ConfirmCloseDialogKind::Tab);
strong = weak.get();
if (!strong || warningResult != ContentDialogResult::Primary)
{
co_return;
}
}
}
auto t = winrt::get_self<implementation::Tab>(tab);
auto actions = t->BuildStartupActions(BuildStartupKind::None);
_AddPreviouslyClosedPaneOrTab(std::move(actions));
// If this is the last tab in a named window, persist the workspace
// layout now while tab content is still alive. After tab.Close()
// the pane content will be torn down by the time _RemoveTab runs.
if (_tabs.Size() == 1)
{
const auto& windowName = _WindowProperties.WindowName();
if (!windowName.empty())
{
if (const auto layout = GetWindowLayout())
{
ApplicationState::SharedInstance().SaveWorkspace(windowName, layout);
}
}
}
tab.Close();
}
@@ -438,6 +486,13 @@ namespace winrt::TerminalApp::implementation
const auto focusedTabIndex{ _GetFocusedTabIndex() };
// NOTE: Workspace persistence for named windows used to live here,
// but by the time _RemoveTab runs the pane content may already be
// torn down (e.g. from the close-pane path). Instead, workspace
// saves are handled earlier:
// - Close-pane (last pane): in _HandleClosePaneRequested
// - Close-tab: in _HandleCloseTabRequested
// Removing the tab from the collection should destroy its control and disconnect its connection,
// but it doesn't always do so. The UI tree may still be holding the control and preventing its destruction.
tab.Shutdown();
@@ -765,6 +820,28 @@ namespace winrt::TerminalApp::implementation
}
_AddPreviouslyClosedPaneOrTab(std::move(state.args));
// If this is the last pane on the last tab of a named window, persist
// the workspace layout now while the pane content is still alive.
// We can't wait until _RemoveTab, because pane->Close() below will
// destroy the content before _RemoveTab is reached.
if (_tabs.Size() == 1)
{
if (const auto activeTab{ _GetFocusedTabImpl() })
{
if (activeTab->GetLeafPaneCount() == 1)
{
const auto& windowName = _WindowProperties.WindowName();
if (!windowName.empty())
{
if (const auto layout = GetWindowLayout())
{
ApplicationState::SharedInstance().SaveWorkspace(windowName, layout);
}
}
}
}
}
// If specified, detach before closing to directly update the pane structure
pane->Close();
}
@@ -782,6 +859,26 @@ namespace winrt::TerminalApp::implementation
if (const auto pane{ activeTab->GetActivePane() })
{
const auto weak = get_weak();
// Check if we should warn before closing a single pane
// (only triggers on Always — Automatic doesn't warn for single pane)
const auto setting = _settings.GlobalSettings().ConfirmOnClose();
if (setting == ConfirmOnClose::Always)
{
// If this is the last pane, closing it closes the tab,
// so use the tab dialog text instead.
const auto kind = activeTab->GetLeafPaneCount() == 1 ? ConfirmCloseDialogKind::Tab : ConfirmCloseDialogKind::Pane;
auto warningResult = co_await _ShowConfirmCloseDialog(kind);
// Hold a strong reference to `this` for the rest of the
// method; we may be the last holder after `co_await`.
auto strong = weak.get();
if (!strong || warningResult != ContentDialogResult::Primary)
{
co_return;
}
}
if (co_await _PaneConfirmCloseReadOnly(pane))
{
if (const auto strong = weak.get())
@@ -795,10 +892,37 @@ namespace winrt::TerminalApp::implementation
// Method Description:
// - Close all panes with the given IDs sequentially.
// - Shows a single aggregate confirmation dialog upfront if the confirmOnClose setting warrants it.
// Arguments:
// - weakTab: weak reference to the tab that the pane belongs to.
// - weakTab: weak reference to the tab that the panes belong to.
// - paneIds: collection of the IDs of the panes that are marked for removal.
void TerminalPage::_ClosePanes(weak_ref<Tab> weakTab, std::vector<uint32_t> paneIds)
safe_void_coroutine TerminalPage::_ClosePanes(weak_ref<Tab> weakTab, std::vector<uint32_t> paneIds)
{
// Show a single aggregate confirmation for closing multiple panes.
if (_settings.GlobalSettings().ConfirmOnClose() != ConfirmOnClose::Never)
{
const auto weak = get_weak();
auto warningResult = co_await _ShowConfirmCloseDialog(ConfirmCloseDialogKind::MultiplePanes);
// Hold a strong reference to `this` after the co_await; we may
// be the last holder if the page was being torn down.
auto strong = weak.get();
if (!strong || warningResult != ContentDialogResult::Primary)
{
co_return;
}
}
_CloseRemainingPanes(weakTab, std::move(paneIds));
}
// Method Description:
// - Recursively closes panes by ID, chaining each close via the
// ClosedByParent callback. Called after confirmation has already
// been handled by _ClosePanes.
// Arguments:
// - weakTab: weak reference to the tab that the panes belong to
// - paneIds: remaining pane IDs to close
void TerminalPage::_CloseRemainingPanes(weak_ref<Tab> weakTab, std::vector<uint32_t> paneIds)
{
if (auto strongTab{ weakTab.get() })
{
@@ -813,10 +937,9 @@ namespace winrt::TerminalApp::implementation
pane->ClosedByParent([ids{ std::move(paneIds) }, weakThis{ get_weak() }, weakTab]() {
if (auto strongThis{ weakThis.get() })
{
strongThis->_ClosePanes(weakTab, std::move(ids));
strongThis->_CloseRemainingPanes(weakTab, std::move(ids));
}
});
// Close the pane which will eventually trigger the closed by parent event
_HandleClosePaneRequested(pane);
break;
@@ -841,18 +964,37 @@ namespace winrt::TerminalApp::implementation
// Method Description:
// - Closes provided tabs one by one
// - Shows a single aggregate confirmation dialog upfront if the confirmOnClose setting warrants it.
// Arguments:
// - tabs - tabs to remove
safe_void_coroutine TerminalPage::_RemoveTabs(const std::vector<winrt::TerminalApp::Tab> tabs)
{
if (tabs.empty())
{
co_return;
}
// Show a single aggregate confirmation instead of per-tab dialogs.
const auto weak = get_weak();
if (_settings.GlobalSettings().ConfirmOnClose() != ConfirmOnClose::Never)
{
auto warningResult = co_await _ShowConfirmCloseDialog(ConfirmCloseDialogKind::MultipleTabs);
// Hold a strong reference to `this` after the co_await so that
// the for-loop below can safely dispatch on us.
auto strong = weak.get();
if (!strong || warningResult != ContentDialogResult::Primary)
{
co_return;
}
}
for (auto& tab : tabs)
{
winrt::Windows::Foundation::IAsyncAction action{ nullptr };
if (const auto strong = weak.get())
{
action = _HandleCloseTabRequested(tab);
action = _HandleCloseTabRequested(tab, /*skipConfirmClose*/ true);
}
if (!action)
@@ -1185,4 +1327,132 @@ namespace winrt::TerminalApp::implementation
{
return _tabs.Size() > 1;
}
// Method Description:
// - Attempts to find and focus the given tab in this window.
// Arguments:
// - tab: The tab to focus.
// Return Value:
// - true if the tab was found and focused, false otherwise.
bool TerminalPage::FocusTab(const winrt::TerminalApp::Tab& tab)
{
if (const auto tabIndex{ _GetTabIndex(tab) })
{
_SelectTab(tabIndex.value());
return true;
}
return false;
}
// Method Description:
// - Sends a desktop toast notification with the given title and body.
// When the toast is activated (clicked), the window is summoned and
// the originating tab is focused.
// Arguments:
// - tabTitle: The title to display in the notification.
// - body: The body text. If empty, a standard tab-activity message is built.
// - tab: The tab to switch to when the toast is activated.
void TerminalPage::_SendDesktopNotification(const winrt::hstring& tabTitle, const winrt::hstring& body, const winrt::com_ptr<Tab>& tab, const winrt::TerminalApp::IPaneContent& content)
{
// Don't send a notification if the window is focused and the requesting
// pane is the active pane. The user is already looking at it.
if (_activated && tab == _GetFocusedTabImpl())
{
if (const auto activePane{ tab->GetActivePane() })
{
if (activePane->GetContent() == content)
{
return;
}
}
}
// Build the notification message.
// If a custom body is provided (e.g. from OSC 777), use the title/body directly.
// Otherwise, build the standard tab-activity notification message.
winrt::hstring notificationTitle;
winrt::hstring message;
if (!body.empty())
{
notificationTitle = tabTitle;
message = body;
}
else
{
// Use the window name if available for context; otherwise just use the tab title.
// Use the raw WindowName (not WindowNameForDisplay) so we don't include
// the "<unnamed window>" placeholder in the notification body.
const auto windowName = _WindowProperties ? _WindowProperties.WindowName() : winrt::hstring{};
if (!windowName.empty())
{
message = RS_fmt(L"NotificationMessage_TabActivityInWindow", std::wstring_view{ tabTitle }, std::wstring_view{ windowName });
}
else
{
message = RS_fmt(L"NotificationMessage_TabActivity", std::wstring_view{ tabTitle });
}
notificationTitle = CascadiaSettings::ApplicationDisplayName();
}
// Use the Tab object's identity hash as a stable toast tag.
// This survives tab reordering and cross-window moves.
const auto tabHash = std::hash<winrt::Windows::Foundation::IUnknown>{}(*tab);
#ifdef _WIN64
const hstring tabTag{ fmt::format(FMT_COMPILE(L"wt-tab-{:016x}"), tabHash) };
#else
const hstring tabTag{ fmt::format(FMT_COMPILE(L"wt-tab-{:08x}"), tabHash) };
#endif
const implementation::DesktopNotificationArgs args{
.Title = notificationTitle,
.Message = message,
.Tag = tabTag
};
implementation::DesktopNotification::SendNotification(args, [weakThis{ get_weak() }, weakTab{ tab->get_weak() }, weakContent{ winrt::make_weak(content) }]() {
if (const auto page{ weakThis.get() })
{
// The toast Activated callback runs on a background thread.
// Marshal to the UI thread for tab focus and window summon.
page->Dispatcher().RunAsync(winrt::Windows::UI::Core::CoreDispatcherPriority::Normal, [weakThis, weakTab, weakContent]() {
if (const auto p{ weakThis.get() })
{
if (const auto t{ weakTab.get() })
{
// Try to find and focus the tab in this window first.
if (const auto tabIndex{ p->_GetTabIndex(*t) })
{
p->SummonWindowRequested.raise(nullptr, nullptr);
p->_SelectTab(tabIndex.value());
// Focus the specific pane that raised the notification.
if (const auto paneContent{ weakContent.get() })
{
const auto rootPane = t->GetRootPane();
rootPane->WalkTree([&](const auto& pane) {
if (pane->GetContent() == paneContent)
{
rootPane->FocusPane(pane);
}
});
}
}
else
{
// The tab may have moved to another window.
// Raise FocusTabRequested so the emperor can
// search all windows for it.
p->FocusTabRequested.raise(nullptr, *t);
}
}
else
{
// Tab was closed. Just summon this window.
p->SummonWindowRequested.raise(nullptr, nullptr);
}
}
});
}
});
}
}

View File

@@ -25,6 +25,15 @@ namespace winrt::TerminalApp::implementation
InitializeComponent();
}
void TabRowControl::WorkspaceName(const winrt::hstring& value)
{
if (_WorkspaceName != value)
{
_WorkspaceName = value;
PropertyChanged.raise(*this, WUX::Data::PropertyChangedEventArgs{ L"WorkspaceName" });
}
}
// Method Description:
// - Bound in the Xaml editor to the [+] button.
// Arguments:

View File

@@ -19,6 +19,14 @@ namespace winrt::TerminalApp::implementation
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(bool, ShowElevationShield, PropertyChanged.raise, false);
WINRT_OBSERVABLE_PROPERTY(bool, ShowWindowsButton, PropertyChanged.raise, true);
public:
winrt::hstring WorkspaceName() const noexcept { return _WorkspaceName; }
void WorkspaceName(const winrt::hstring& value);
private:
winrt::hstring _WorkspaceName{};
};
}

View File

@@ -9,5 +9,7 @@ namespace TerminalApp
TabRowControl();
Microsoft.UI.Xaml.Controls.TabView TabView { get; };
Boolean ShowElevationShield;
Boolean ShowWindowsButton;
String WorkspaceName;
}
}

View File

@@ -8,6 +8,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:TerminalApp"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mtu="using:Microsoft.Terminal.UI"
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
Background="{ThemeResource TabViewBackground}"
mc:Ignorable="d">
@@ -35,14 +36,44 @@
TabWidthMode="Equal">
<mux:TabView.TabStripHeader>
<!-- EA18 is the "Shield" glyph -->
<FontIcon x:Uid="ElevationShield"
Margin="9,4,0,4"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
Glyph="&#xEA18;"
Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
<StackPanel Orientation="Horizontal">
<!-- EA18 is the "Shield" glyph -->
<FontIcon x:Uid="ElevationShield"
Margin="9,4,0,4"
FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="16"
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
Glyph="&#xEA18;"
Visibility="{x:Bind ShowElevationShield, Mode=OneWay}" />
<!-- Workspace/windows button -->
<Button x:Name="WorkspaceDropdown"
Margin="4,0,0,4"
Padding="8,0,0,0"
VerticalAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
Visibility="{x:Bind ShowWindowsButton, Mode=OneWay}">
<Button.Content>
<StackPanel Orientation="Horizontal"
Spacing="8">
<!-- EE40 is the "TaskViewSettings" glyph -->
<FontIcon FontFamily="{ThemeResource SymbolThemeFontFamily}"
FontSize="12"
Glyph="&#xEE40;" />
<TextBlock x:Name="WorkspaceNameText"
Padding="0,0,8,0"
VerticalAlignment="Center"
FontSize="12"
Text="{x:Bind WorkspaceName, Mode=OneWay}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(WorkspaceName), Mode=OneWay}" />
</StackPanel>
</Button.Content>
<Button.Flyout>
<MenuFlyout x:Name="WorkspaceFlyout" />
</Button.Flyout>
</Button>
</StackPanel>
</mux:TabView.TabStripHeader>
<mux:TabView.TabStripFooter>

View File

@@ -9,27 +9,28 @@ namespace winrt::TerminalApp::implementation
{
// Default to unset, 0%.
TaskbarState::TaskbarState() :
TaskbarState(0, 0) {};
TaskbarState(winrt::Microsoft::Terminal::Control::TaskbarState::Clear, 0) {};
TaskbarState::TaskbarState(const uint64_t dispatchTypesState, const uint64_t progressParam) :
_State{ dispatchTypesState },
TaskbarState::TaskbarState(const winrt::Microsoft::Terminal::Control::TaskbarState state, const uint64_t progressParam) :
_State{ state },
_Progress{ progressParam } {}
uint64_t TaskbarState::Priority() const
{
// This seemingly nonsensical ordering is from
// https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate#how-the-taskbar-button-chooses-the-progress-indicator-for-a-group
using TbState = winrt::Microsoft::Terminal::Control::TaskbarState;
switch (_State)
{
case 0: // Clear = 0,
case TbState::Clear:
return 5;
case 1: // Set = 1,
case TbState::Set:
return 3;
case 2: // Error = 2,
case TbState::Error:
return 1;
case 3: // Indeterminate = 3,
case TbState::Indeterminate:
return 4;
case 4: // Paused = 4
case TbState::Paused:
return 2;
}
// Here, return 6, to definitely be greater than all the other valid values.

View File

@@ -16,13 +16,13 @@ namespace winrt::TerminalApp::implementation
{
public:
TaskbarState();
TaskbarState(const uint64_t dispatchTypesState, const uint64_t progress);
TaskbarState(const winrt::Microsoft::Terminal::Control::TaskbarState state, const uint64_t progress);
static int ComparePriority(const winrt::TerminalApp::TaskbarState& lhs, const winrt::TerminalApp::TaskbarState& rhs);
uint64_t Priority() const;
WINRT_PROPERTY(uint64_t, State, 0);
WINRT_PROPERTY(winrt::Microsoft::Terminal::Control::TaskbarState, State, winrt::Microsoft::Terminal::Control::TaskbarState::Clear);
WINRT_PROPERTY(uint64_t, Progress, 0);
};
}

View File

@@ -6,9 +6,9 @@ namespace TerminalApp
[default_interface] runtimeclass TaskbarState
{
TaskbarState();
TaskbarState(UInt64 dispatchTypesState, UInt64 progress);
TaskbarState(Microsoft.Terminal.Control.TaskbarState state, UInt64 progress);
UInt64 State{ get; };
Microsoft.Terminal.Control.TaskbarState State{ get; };
UInt64 Progress{ get; };
UInt64 Priority { get; };
}

View File

@@ -174,6 +174,7 @@
<DependentUpon>TerminalPaneContent.idl</DependentUpon>
</ClInclude>
<ClInclude Include="Toast.h" />
<ClInclude Include="DesktopNotification.h" />
<ClInclude Include="TerminalSettingsCache.h" />
<ClInclude Include="SuggestionsControl.h">
<DependentUpon>SuggestionsControl.xaml</DependentUpon>
@@ -287,6 +288,7 @@
</ClCompile>
<ClCompile Include="$(GeneratedFilesDir)module.g.cpp" />
<ClCompile Include="Toast.cpp" />
<ClCompile Include="DesktopNotification.cpp" />
<ClCompile Include="TerminalSettingsCache.cpp" />
<ClCompile Include="SuggestionsControl.cpp">
<DependentUpon>SuggestionsControl.xaml</DependentUpon>

View File

@@ -25,6 +25,8 @@
#include "TerminalSettingsCache.h"
#include "LaunchPositionRequest.g.cpp"
#include "WindowListEntry.g.cpp"
#include "WindowListRequest.g.cpp"
#include "RenameWindowRequestedArgs.g.cpp"
#include "RequestMoveContentArgs.g.cpp"
#include "TerminalPage.g.cpp"
@@ -334,6 +336,21 @@ namespace winrt::TerminalApp::implementation
auto tabRowImpl = winrt::get_self<implementation::TabRowControl>(_tabRow);
_newTabButton = tabRowImpl->NewTabButton();
_workspaceFlyout = tabRowImpl->WorkspaceFlyout();
_workspaceDropdown = tabRowImpl->WorkspaceDropdown();
// Set the initial workspace name from the window name.
// Use raw WindowName() so unnamed windows show no text.
_tabRow.WorkspaceName(_WindowProperties.WindowName());
// Rebuild the workspace flyout each time it opens so it always
// reflects the latest set of persisted workspaces.
_workspaceFlyout.Opening([weakThis{ get_weak() }](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->_PopulateWorkspaceFlyout();
}
});
if (_settings.GlobalSettings().ShowTabsInTitlebar())
{
@@ -443,6 +460,12 @@ namespace winrt::TerminalApp::implementation
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
// Apply the ShowWindowsButton theme setting.
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
{
_tabRow.ShowWindowsButton(theme.Window() ? theme.Window().ShowWindowsButton() : true);
}
_adjustProcessPriorityThrottled = std::make_shared<ThrottledFunc<>>(
DispatcherQueue::GetForCurrentThread(),
til::throttled_func_options{
@@ -884,26 +907,78 @@ namespace winrt::TerminalApp::implementation
}
// Method Description:
// - Displays a dialog to warn the user that they are about to close all open windows.
// Once the user clicks the OK button, shut down the application.
// If cancel is clicked, the dialog will close.
// - Displays the unified close confirmation dialog configured for the
// given scenario. Resets the "don't ask me again" checkbox before showing.
// If the user confirms and checked "don't ask me again", sets
// confirmOnClose to Never and writes settings to disk.
// - Only one dialog can be visible at a time. If another dialog is visible
// when this is called, nothing happens. See _ShowDialog for details
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowQuitDialog()
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowConfirmCloseDialog(ConfirmCloseDialogKind kind)
{
return _ShowDialogHelper(L"QuitDialog");
}
// Load the dialog (triggers x:Load) and configure its strings.
const auto dialog = FindName(L"ConfirmCloseDialog").as<ContentDialog>();
// Method Description:
// - Displays a dialog for warnings found while closing the terminal app using
// key binding with multiple tabs opened. Display messages to warn user
// that more than 1 tab is opened, and once the user clicks the OK button, remove
// all the tabs and shut down and app. If cancel is clicked, the dialog will close
// - Only one dialog can be visible at a time. If another dialog is visible
// when this is called, nothing happens. See _ShowDialog for details
winrt::Windows::Foundation::IAsyncOperation<ContentDialogResult> TerminalPage::_ShowCloseWarningDialog()
{
return _ShowDialogHelper(L"CloseAllDialog");
winrt::hstring title;
winrt::hstring primary;
switch (kind)
{
case ConfirmCloseDialogKind::CloseAll:
title = RS_(L"ConfirmCloseDialog_CloseAllTitle");
primary = RS_(L"ConfirmCloseDialog_CloseAllPrimary");
break;
case ConfirmCloseDialogKind::Window:
title = RS_(L"ConfirmCloseDialog_WindowTitle");
primary = RS_(L"ConfirmCloseDialog_WindowPrimary");
break;
case ConfirmCloseDialogKind::Tab:
title = RS_(L"ConfirmCloseDialog_TabTitle");
primary = RS_(L"ConfirmCloseDialog_TabPrimary");
break;
case ConfirmCloseDialogKind::MultiplePanes:
title = RS_(L"ConfirmCloseDialog_MultiplePanesTitle");
primary = RS_(L"ConfirmCloseDialog_MultiplePanesPrimary");
break;
case ConfirmCloseDialogKind::MultipleTabs:
title = RS_(L"ConfirmCloseDialog_MultipleTabsTitle");
primary = RS_(L"ConfirmCloseDialog_MultipleTabsPrimary");
break;
case ConfirmCloseDialogKind::Pane:
title = RS_(L"ConfirmCloseDialog_PaneTitle");
primary = RS_(L"ConfirmCloseDialog_PanePrimary");
break;
}
dialog.Title(winrt::box_value(title));
dialog.PrimaryButtonText(primary);
dialog.CloseButtonText(RS_(L"ConfirmCloseDialog_Cancel"));
// BODGY: After a ContentDialog is dismissed, FindName() can no longer
// resolve children inside it. Use Content() to get the checkbox directly.
const auto checkbox = dialog.Content().as<CheckBox>();
checkbox.IsChecked(false);
auto result = ContentDialogResult::None;
if (auto presenter{ _dialogPresenter.get() })
{
const auto weak = get_weak();
result = co_await presenter.ShowDialog(dialog);
// ShowDialog blocks until the dialog is dismissed, so it is
// possible for `this` to be torn down while we wait. Re-acquire
// a strong reference before touching any of our state.
const auto strong = weak.get();
if (!strong)
{
co_return ContentDialogResult::None;
}
if (result == ContentDialogResult::Primary && checkbox.IsChecked().Value())
{
_settings.GlobalSettings().ConfirmOnClose(ConfirmOnClose::Never);
_settings.WriteSettingsToDisk();
}
}
co_return result;
}
// Method Description:
@@ -2209,12 +2284,13 @@ namespace winrt::TerminalApp::implementation
// signal that we want to close everything.
safe_void_coroutine TerminalPage::RequestQuit()
{
if (!_displayingCloseDialog)
const auto setting = _settings.GlobalSettings().ConfirmOnClose();
if (setting != ConfirmOnClose::Never && !_displayingCloseDialog)
{
_displayingCloseDialog = true;
const auto weak = get_weak();
auto warningResult = co_await _ShowQuitDialog();
auto warningResult = co_await _ShowConfirmCloseDialog(ConfirmCloseDialogKind::CloseAll);
const auto strong = weak.get();
if (!strong)
{
@@ -2227,19 +2303,19 @@ namespace winrt::TerminalApp::implementation
{
co_return;
}
QuitRequested.raise(nullptr, nullptr);
}
QuitRequested.raise(nullptr, nullptr);
}
void TerminalPage::PersistState()
WindowLayout TerminalPage::GetWindowLayout()
{
// This method may be called for a window even if it hasn't had a tab yet or lost all of them.
// We shouldn't persist such windows.
const auto tabCount = _tabs.Size();
if (_startupState != StartupState::Initialized || tabCount == 0)
{
return;
return nullptr;
}
std::vector<ActionAndArgs> actions;
@@ -2254,7 +2330,7 @@ namespace winrt::TerminalApp::implementation
// Avoid persisting a window with zero tabs, because `BuildStartupActions` happened to return an empty vector.
if (actions.empty())
{
return;
return nullptr;
}
// if the focused tab was not the last tab, restore that
@@ -2303,16 +2379,105 @@ namespace winrt::TerminalApp::implementation
RequestLaunchPosition.raise(*this, launchPosRequest);
layout.InitialPosition(launchPosRequest.Position());
ApplicationState::SharedInstance().AppendPersistedWindowLayout(layout);
return layout;
}
void TerminalPage::PersistState()
{
// There are two persistence mechanisms in play here:
// * PersistedWindowLayouts (vector) — consumed on next startup to
// re-open a matching set of windows. Cleared after restore.
// * PersistedWorkspaces (name-keyed map) — the full tab/buffer
// state of a named window, claimed by name on demand via
// ApplicationState::TakeWorkspace.
//
// For named windows we save the full layout into the workspace map
// and drop a lightweight `openWorkspace` stub into the generic vector,
// so the generic restore path re-opens the named window which in
// turn claims its own workspace. Unnamed windows don't have a stable
// key, so their full layout is stored directly in the vector.
if (const auto layout = GetWindowLayout())
{
const auto& windowName = _WindowProperties.WindowName();
if (!windowName.empty())
{
// Persist the full layout into the workspace collection.
ApplicationState::SharedInstance().SaveWorkspace(windowName, layout);
// Build a minimal layout with just an openWorkspace action
// so the generic restore path re-opens this workspace by name.
std::vector<ActionAndArgs> actions;
ActionAndArgs action;
action.Action(ShortcutAction::OpenWorkspace);
OpenWorkspaceArgs args{ windowName };
action.Args(args);
actions.emplace_back(std::move(action));
WindowLayout stub;
stub.TabLayout(winrt::single_threaded_vector<ActionAndArgs>(std::move(actions)));
ApplicationState::SharedInstance().AppendPersistedWindowLayout(stub);
}
else
{
ApplicationState::SharedInstance().AppendPersistedWindowLayout(layout);
}
}
}
// Method Description:
// - Close the terminal app. If there is more
// than one tab opened, show a warning dialog.
// - Determines whether a close-window action should show a confirmation
// dialog, based on the confirmOnClose setting and the current window state.
// Arguments:
// - <none>
// Return Value:
// - true, if a warning dialog should be shown before closing the window
bool TerminalPage::_ShouldWarnOnClose() const
{
const auto setting = _settings.GlobalSettings().ConfirmOnClose();
switch (setting)
{
case ConfirmOnClose::Always:
return true;
case ConfirmOnClose::Automatic:
{
// Warn if there's more than one tab, or the one tab has more than one pane.
return _HasMultipleTabs() || _GetTabImpl(_tabs.GetAt(0))->GetLeafPaneCount() > 1;
}
case ConfirmOnClose::Never:
default:
return false;
}
}
// Method Description:
// - Determines whether closing a specific tab should show a confirmation
// dialog, based on the confirmOnClose setting and the tab's state.
// Arguments:
// - tab: The tab being closed
// Return Value:
// - true, if a warning dialog should be shown before closing the tab
bool TerminalPage::_ShouldWarnOnCloseTab(const winrt::com_ptr<Tab>& tab) const
{
const auto setting = _settings.GlobalSettings().ConfirmOnClose();
switch (setting)
{
case ConfirmOnClose::Always:
return true;
case ConfirmOnClose::Automatic:
// Warn if this tab has more than one pane.
return tab->GetLeafPaneCount() > 1;
case ConfirmOnClose::Never:
default:
return false;
}
}
// Method Description:
// - Close the terminal app. If the confirmOnClose setting indicates we should
// warn for the current window state, show a warning dialog.
safe_void_coroutine TerminalPage::CloseWindow()
{
if (_HasMultipleTabs() &&
_settings.GlobalSettings().ConfirmCloseAllTabs() &&
if (_ShouldWarnOnClose() &&
!_displayingCloseDialog)
{
if (_newTabButton && _newTabButton.Flyout())
@@ -2321,7 +2486,17 @@ namespace winrt::TerminalApp::implementation
}
_DismissTabContextMenus();
_displayingCloseDialog = true;
auto warningResult = co_await _ShowCloseWarningDialog();
const auto weak = get_weak();
auto warningResult = co_await _ShowConfirmCloseDialog(ConfirmCloseDialogKind::Window);
// Hold a strong reference to `this` after the co_await; we may
// be the last holder if the window was already being torn down.
auto strong = weak.get();
if (!strong)
{
co_return;
}
_displayingCloseDialog = false;
if (warningResult != ContentDialogResult::Primary)
@@ -2790,14 +2965,15 @@ namespace winrt::TerminalApp::implementation
// Arguments:
// - direction: The direction to move the separator in.
// Return Value:
// - <none>
void TerminalPage::_ResizePane(const ResizeDirection& direction)
// - whether a pane was resized
bool TerminalPage::_ResizePane(const ResizeDirection& direction)
{
if (const auto tabImpl{ _GetFocusedTabImpl() })
{
_UnZoomIfNeeded();
tabImpl->ResizePane(direction);
return tabImpl->ResizePane(direction);
}
return false;
}
// Method Description:
@@ -3196,13 +3372,15 @@ namespace winrt::TerminalApp::implementation
return true;
}
bool TerminalPage::_IsUriConsideredSomewhatSafe(const winrt::Windows::Foundation::Uri& parsedUri)
bool TerminalPage::_IsUriConsideredSomewhatSafe(const winrt::Windows::Foundation::Uri& parsedUri) const
{
if (parsedUri.SchemeName() == L"http" || parsedUri.SchemeName() == L"https")
const auto& schemeName = parsedUri.SchemeName();
if (schemeName == L"http" || schemeName == L"https")
{
return true;
}
if (parsedUri.SchemeName() == L"file")
if (schemeName == L"file")
{
static const auto pathext{ wil::TryGetEnvironmentVariableW<std::wstring>(L"PATHEXT") };
const auto filename = parsedUri.Path();
@@ -3216,6 +3394,16 @@ namespace winrt::TerminalApp::implementation
return true;
}
if (const auto& safeSchemes = _settings.GlobalSettings().SafeUriSchemes())
{
for (const auto& scheme : safeSchemes)
{
if (til::equals_insensitive_ascii(schemeName, scheme))
{
return true;
}
}
}
return false;
}
@@ -3934,6 +4122,12 @@ namespace winrt::TerminalApp::implementation
_tabRow.ShowElevationShield(IsRunningElevated() && _settings.GlobalSettings().ShowAdminShield());
// Apply the ShowWindowsButton theme setting.
if (const auto theme = _settings.GlobalSettings().CurrentTheme())
{
_tabRow.ShowWindowsButton(theme.Window() ? theme.Window().ShowWindowsButton() : true);
}
Media::SolidColorBrush transparent{ Windows::UI::Colors::Transparent() };
_tabView.Background(transparent);
@@ -5574,6 +5768,199 @@ namespace winrt::TerminalApp::implementation
}
}
// Rebuild the workspace flyout contents. Called every time the flyout opens
// Rebuild the workspace flyout contents. Called every time the flyout opens
// so it reflects the current set of persisted workspaces.
void TerminalPage::_PopulateWorkspaceFlyout()
{
if (!_workspaceFlyout)
{
return;
}
_workspaceFlyout.Items().Clear();
// --- "Name / Rename this window" ---
{
MenuFlyoutItem item{};
item.Text(_WindowProperties.WindowName().empty() ? RS_(L"NameThisWindowMenuItem") : RS_(L"RenameThisWindowMenuItem"));
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE8AC"); // Rename glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.Click([weakThis{ get_weak() }](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->_actionDispatch->DoAction(ActionAndArgs{ ShortcutAction::OpenWindowRenamer, nullptr });
}
});
_workspaceFlyout.Items().Append(item);
}
// --- Gather open window info first so we can filter workspaces ---
const auto windowListReq{ winrt::make<WindowListRequest>() };
RequestWindowList.raise(*this, windowListReq);
const auto windowEntries = windowListReq.Entries();
std::set<winrt::hstring> openWindowNames;
if (windowEntries)
{
for (const auto& entry : windowEntries)
{
const auto& name = entry.Name();
if (!name.empty())
{
openWindowNames.emplace(name);
}
}
}
// --- Saved workspaces section (only those not currently open) ---
// Collect workspace names that aren't currently open so we can show
// them both as top-level "open" items and inside the delete sub-menu.
const auto workspaces = ApplicationState::SharedInstance().AllPersistedWorkspaces();
if (workspaces && workspaces.Size() > 0)
{
bool addedSeparator = false;
for (const auto& pair : workspaces)
{
const auto name = pair.Key();
// Skip workspaces that correspond to a currently-open window.
if (openWindowNames.count(name))
{
continue;
}
if (!addedSeparator)
{
_workspaceFlyout.Items().Append(MenuFlyoutSeparator{});
addedSeparator = true;
}
MenuFlyoutItem item{};
item.Text(name);
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE8F1"); // SwitchApps glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.Click([weakThis{ get_weak() }, name](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->_OpenWorkspaceWindow(name);
}
});
// Right-click to delete: attach a context flyout with a
// "Delete workspace?" item that opens a confirmation dialog.
{
WUX::Controls::MenuFlyout deleteFlyout{};
deleteFlyout.Placement(WUX::Controls::Primitives::FlyoutPlacementMode::BottomEdgeAlignedRight);
WUX::Controls::MenuFlyoutItem deleteItem{};
deleteItem.Text(RS_(L"DeleteWorkspaceMenuItem"));
WUX::Controls::FontIcon trashIcon{};
trashIcon.Glyph(L"\xE74D"); // Delete glyph
trashIcon.FontFamily(Media::FontFamily{ L"Segoe Fluent Icons, Segoe MDL2 Assets" });
deleteItem.Icon(trashIcon);
deleteItem.Click([weakThis{ get_weak() }, name](auto&&, auto&&) -> safe_void_coroutine {
auto page{ weakThis.get() };
if (!page)
{
co_return;
}
// Build and show a confirmation ContentDialog.
ContentDialog dialog{};
dialog.Title(winrt::box_value(winrt::hstring{ RS_fmt(L"ConfirmDeleteWorkspaceTitle", name) }));
dialog.PrimaryButtonText(RS_(L"ConfirmDeleteWorkspaceDelete"));
dialog.CloseButtonText(RS_(L"ConfirmDeleteWorkspaceCancel"));
dialog.DefaultButton(ContentDialogButton::Close);
if (auto presenter{ page->_dialogPresenter.get() })
{
const auto result = co_await presenter.ShowDialog(dialog);
// Re-check after co_await
page = weakThis.get();
if (!page)
{
co_return;
}
if (result == ContentDialogResult::Primary)
{
ApplicationState::SharedInstance().RemoveWorkspace(name);
page->_PopulateWorkspaceFlyout();
}
}
});
deleteFlyout.Items().Append(deleteItem);
WUX::Controls::Primitives::FlyoutBase::SetAttachedFlyout(item, deleteFlyout);
item.ContextRequested([item](auto&&, auto&&) {
WUX::Controls::Primitives::FlyoutBase::ShowAttachedFlyout(item);
});
}
_workspaceFlyout.Items().Append(item);
}
}
// --- Open windows section ---
if (windowEntries && windowEntries.Size() > 0)
{
_workspaceFlyout.Items().Append(MenuFlyoutSeparator{});
const auto thisWindowId = _WindowProperties.WindowId();
for (const auto& entry : windowEntries)
{
const auto id = entry.Id();
const auto& name = entry.Name();
winrt::hstring displayText;
if (name.empty())
{
displayText = winrt::hstring{ RS_fmt(L"WindowListUnnamedEntry", id) };
}
else
{
displayText = winrt::hstring{ fmt::format(FMT_COMPILE(L"#{}: {}"), id, name) };
}
MenuFlyoutItem item{};
item.Text(displayText);
if (id == thisWindowId)
{
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE73E"); // CheckMark glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.IsEnabled(false);
}
else
{
auto iconElement = UI::IconPathConverter::IconWUX(L"\uE737"); // ChromeRestore glyph
Automation::AutomationProperties::SetAccessibilityView(iconElement, Automation::Peers::AccessibilityView::Raw);
item.Icon(iconElement);
item.Click([weakThis{ get_weak() }, id](auto&&, auto&&) {
if (auto page{ weakThis.get() })
{
page->SummonWindowByIdRequested.raise(*page, winrt::make<SummonWindowByIdRequestedArgs>(id));
}
});
}
_workspaceFlyout.Items().Append(item);
}
}
}
// Handler for our WindowProperties's PropertyChanged event. We'll use this
// to pop the "Identify Window" toast when the user renames our window.
void TerminalPage::_windowPropertyChanged(const IInspectable& /*sender*/, const WUX::Data::PropertyChangedEventArgs& args)
@@ -5583,6 +5970,10 @@ namespace winrt::TerminalApp::implementation
return;
}
// Keep the workspace dropdown label in sync with the window name.
// Use raw WindowName() so clearing the name hides the text.
_tabRow.WorkspaceName(_WindowProperties.WindowName());
// DON'T display the confirmation if this is the name we were
// given on startup!
if (_startupState == StartupState::Initialized)

View File

@@ -10,8 +10,11 @@
#include "AppKeyBindings.h"
#include "AppCommandlineArgs.h"
#include "RenameWindowRequestedArgs.g.h"
#include "SummonWindowByIdRequestedArgs.g.h"
#include "RequestMoveContentArgs.g.h"
#include "LaunchPositionRequest.g.h"
#include "WindowListEntry.g.h"
#include "WindowListRequest.g.h"
#include "Toast.h"
#include "WindowsPackageManagerFactory.h"
@@ -54,6 +57,16 @@ namespace winrt::TerminalApp::implementation
ScrollDown = 1
};
enum class ConfirmCloseDialogKind
{
Pane,
Tab,
MultiplePanes,
MultipleTabs,
Window,
CloseAll
};
struct RenameWindowRequestedArgs : RenameWindowRequestedArgsT<RenameWindowRequestedArgs>
{
WINRT_PROPERTY(winrt::hstring, ProposedName);
@@ -63,6 +76,15 @@ namespace winrt::TerminalApp::implementation
_ProposedName{ name } {};
};
struct SummonWindowByIdRequestedArgs : SummonWindowByIdRequestedArgsT<SummonWindowByIdRequestedArgs>
{
WINRT_PROPERTY(uint64_t, WindowId);
public:
SummonWindowByIdRequestedArgs(uint64_t id) :
_WindowId{ id } {};
};
struct RequestMoveContentArgs : RequestMoveContentArgsT<RequestMoveContentArgs>
{
WINRT_PROPERTY(winrt::hstring, Window);
@@ -84,6 +106,25 @@ namespace winrt::TerminalApp::implementation
til::property<winrt::Microsoft::Terminal::Settings::Model::LaunchPosition> Position;
};
struct WindowListEntry : WindowListEntryT<WindowListEntry>
{
WindowListEntry() = default;
til::property<uint64_t> Id;
til::property<winrt::hstring> Name;
};
struct WindowListRequest : WindowListRequestT<WindowListRequest>
{
WindowListRequest() :
_Entries{ winrt::single_threaded_vector<winrt::TerminalApp::WindowListEntry>() } {}
winrt::Windows::Foundation::Collections::IVector<winrt::TerminalApp::WindowListEntry> Entries() const { return _Entries; }
private:
winrt::Windows::Foundation::Collections::IVector<winrt::TerminalApp::WindowListEntry> _Entries;
};
struct WinGetSearchParams
{
winrt::Microsoft::Management::Deployment::PackageMatchField Field;
@@ -122,6 +163,7 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine RequestQuit();
safe_void_coroutine CloseWindow();
winrt::Microsoft::Terminal::Settings::Model::WindowLayout GetWindowLayout();
void PersistState();
std::vector<IPaneContent> Panes() const;
@@ -168,6 +210,7 @@ namespace winrt::TerminalApp::implementation
void OpenSettingsUI();
void WindowActivated(const bool activated);
bool FocusTab(const winrt::TerminalApp::Tab& tab);
bool OnDirectKeyEvent(const uint32_t vkey, const uint8_t scanCode, const bool down);
@@ -192,6 +235,8 @@ namespace winrt::TerminalApp::implementation
til::typed_event<IInspectable, IInspectable> IdentifyWindowsRequested;
til::typed_event<IInspectable, winrt::TerminalApp::RenameWindowRequestedArgs> RenameWindowRequested;
til::typed_event<IInspectable, IInspectable> SummonWindowRequested;
til::typed_event<IInspectable, winrt::TerminalApp::SummonWindowByIdRequestedArgs> SummonWindowByIdRequested;
til::typed_event<IInspectable, winrt::TerminalApp::Tab> FocusTabRequested;
til::typed_event<IInspectable, winrt::Microsoft::Terminal::Control::WindowSizeChangedEventArgs> WindowSizeChanged;
til::typed_event<IInspectable, IInspectable> OpenSystemMenu;
@@ -203,6 +248,7 @@ namespace winrt::TerminalApp::implementation
til::typed_event<Windows::Foundation::IInspectable, winrt::TerminalApp::RequestReceiveContentArgs> RequestReceiveContent;
til::typed_event<IInspectable, winrt::TerminalApp::LaunchPositionRequest> RequestLaunchPosition;
til::typed_event<IInspectable, winrt::TerminalApp::WindowListRequest> RequestWindowList;
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, TitlebarBrush, PropertyChanged.raise, nullptr);
WINRT_OBSERVABLE_PROPERTY(winrt::Windows::UI::Xaml::Media::Brush, FrameBrush, PropertyChanged.raise, nullptr);
@@ -225,6 +271,8 @@ namespace winrt::TerminalApp::implementation
TerminalApp::TabRowControl _tabRow{ nullptr };
Windows::UI::Xaml::Controls::Grid _tabContent{ nullptr };
Microsoft::UI::Xaml::Controls::SplitButton _newTabButton{ nullptr };
Windows::UI::Xaml::Controls::MenuFlyout _workspaceFlyout{ nullptr };
Windows::UI::Xaml::Controls::Button _workspaceDropdown{ nullptr };
winrt::TerminalApp::ColorPickupFlyout _tabColorPicker{ nullptr };
Microsoft::Terminal::Settings::Model::CascadiaSettings _settings{ nullptr };
@@ -301,8 +349,7 @@ namespace winrt::TerminalApp::implementation
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowDialogHelper(const std::wstring_view& name);
void _ShowAboutDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowQuitDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowCloseWarningDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowConfirmCloseDialog(ConfirmCloseDialogKind kind);
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowCloseReadOnlyDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowMultiLinePasteWarningDialog();
winrt::Windows::Foundation::IAsyncOperation<winrt::Windows::UI::Xaml::Controls::ContentDialogResult> _ShowLargePasteWarningDialog();
@@ -324,6 +371,7 @@ namespace winrt::TerminalApp::implementation
void _restartPaneConnection(const TerminalApp::TerminalPaneContent&, const winrt::Windows::Foundation::IInspectable&);
safe_void_coroutine _OpenNewWindow(const Microsoft::Terminal::Settings::Model::INewContentArgs newContentArgs);
safe_void_coroutine _OpenWorkspaceWindow(const winrt::hstring name);
void _OpenNewTerminalViaDropdown(const Microsoft::Terminal::Settings::Model::NewTerminalArgs newTerminalArgs);
@@ -349,7 +397,7 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine _ExportTab(const Tab& tab, winrt::hstring filepath);
winrt::Windows::Foundation::IAsyncAction _HandleCloseTabRequested(winrt::TerminalApp::Tab tab);
winrt::Windows::Foundation::IAsyncAction _HandleCloseTabRequested(winrt::TerminalApp::Tab tab, bool skipConfirmClose = false);
void _CloseTabAtIndex(uint32_t index);
void _RemoveTab(const winrt::TerminalApp::Tab& tab);
safe_void_coroutine _RemoveTabs(const std::vector<winrt::TerminalApp::Tab> tabs);
@@ -400,9 +448,12 @@ namespace winrt::TerminalApp::implementation
TerminalApp::Tab _GetTabByTabViewItem(const IInspectable& tabViewItem) const noexcept;
void _HandleClosePaneRequested(std::shared_ptr<Pane> pane);
bool _ShouldWarnOnClose() const;
bool _ShouldWarnOnCloseTab(const winrt::com_ptr<Tab>& tab) const;
safe_void_coroutine _SetFocusedTab(const winrt::TerminalApp::Tab tab);
safe_void_coroutine _CloseFocusedPane();
void _ClosePanes(weak_ref<Tab> weakTab, std::vector<uint32_t> paneIds);
safe_void_coroutine _ClosePanes(weak_ref<Tab> weakTab, std::vector<uint32_t> paneIds);
void _CloseRemainingPanes(weak_ref<Tab> weakTab, std::vector<uint32_t> paneIds);
winrt::Windows::Foundation::IAsyncOperation<bool> _PaneConfirmCloseReadOnly(std::shared_ptr<Pane> pane);
void _AddPreviouslyClosedPaneOrTab(std::vector<Microsoft::Terminal::Settings::Model::ActionAndArgs>&& args);
@@ -412,7 +463,7 @@ namespace winrt::TerminalApp::implementation
const Microsoft::Terminal::Settings::Model::SplitDirection splitType,
const float splitSize,
std::shared_ptr<Pane> newPane);
void _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
bool _ResizePane(const Microsoft::Terminal::Settings::Model::ResizeDirection& direction);
void _ToggleSplitOrientation();
void _ScrollPage(ScrollDirection scrollDirection);
@@ -424,7 +475,7 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine _OpenHyperlinkHandler(const IInspectable sender, const Microsoft::Terminal::Control::OpenHyperlinkEventArgs eventArgs);
static bool _IsUriSupported(const winrt::Windows::Foundation::Uri& parsedUri);
static bool _IsUriConsideredSomewhatSafe(const winrt::Windows::Foundation::Uri& parsedUri);
bool _IsUriConsideredSomewhatSafe(const winrt::Windows::Foundation::Uri& parsedUri) const;
void _ShowCouldNotOpenDialog(winrt::hstring reason, winrt::hstring uri);
bool _CopyText(bool dismissSelection, bool singleLine, bool withControlSequences, Microsoft::Terminal::Control::CopyFormat formats);
@@ -563,6 +614,7 @@ namespace winrt::TerminalApp::implementation
void _PopulateContextMenu(const Microsoft::Terminal::Control::TermControl& control, const Microsoft::UI::Xaml::Controls::CommandBarFlyout& sender, const bool withSelection);
void _PopulateQuickFixMenu(const Microsoft::Terminal::Control::TermControl& control, const Windows::UI::Xaml::Controls::MenuFlyout& sender);
void _PopulateWorkspaceFlyout();
winrt::Windows::UI::Xaml::Controls::MenuFlyout _CreateRunAsAdminFlyout(int profileIndex);
winrt::Microsoft::Terminal::Control::TermControl _senderOrActiveControl(const winrt::Windows::Foundation::IInspectable& sender);
@@ -571,6 +623,8 @@ namespace winrt::TerminalApp::implementation
void _activePaneChanged(winrt::TerminalApp::Tab tab, Windows::Foundation::IInspectable args);
safe_void_coroutine _doHandleSuggestions(Microsoft::Terminal::Settings::Model::SuggestionsArgs realArgs);
void _SendDesktopNotification(const winrt::hstring& tabTitle, const winrt::hstring& body, const winrt::com_ptr<Tab>& tab, const winrt::TerminalApp::IPaneContent& content);
#pragma region ActionHandlers
// These are all defined in AppActionHandlers.cpp
#define ON_ALL_ACTIONS(action) DECLARE_ACTION_HANDLER(action);
@@ -587,4 +641,5 @@ namespace winrt::TerminalApp::implementation
namespace winrt::TerminalApp::factory_implementation
{
BASIC_FACTORY(TerminalPage);
BASIC_FACTORY(WindowListEntry);
}

View File

@@ -19,6 +19,10 @@ namespace TerminalApp
{
String ProposedName { get; };
};
[default_interface] runtimeclass SummonWindowByIdRequestedArgs
{
UInt64 WindowId { get; };
};
[default_interface] runtimeclass RequestMoveContentArgs
{
String Window { get; };
@@ -50,6 +54,20 @@ namespace TerminalApp
Microsoft.Terminal.Settings.Model.LaunchPosition Position;
}
[default_interface] runtimeclass WindowListEntry
{
WindowListEntry();
UInt64 Id;
String Name;
}
// Raised by TerminalPage when it needs the list of open windows.
// The handler (AppHost) fills Entries synchronously.
[default_interface] runtimeclass WindowListRequest
{
Windows.Foundation.Collections.IVector<WindowListEntry> Entries { get; };
}
[default_interface] runtimeclass TerminalPage : Windows.UI.Xaml.Controls.Page, Windows.UI.Xaml.Data.INotifyPropertyChanged, Microsoft.Terminal.UI.IDirectKeyListener
{
TerminalPage(WindowProperties properties, ContentManager manager);
@@ -93,6 +111,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> IdentifyWindowsRequested;
event Windows.Foundation.TypedEventHandler<Object, RenameWindowRequestedArgs> RenameWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, SummonWindowByIdRequestedArgs> SummonWindowByIdRequested;
event Windows.Foundation.TypedEventHandler<Object, Microsoft.Terminal.Control.WindowSizeChangedEventArgs> WindowSizeChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
@@ -103,5 +122,6 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, RequestReceiveContentArgs> RequestReceiveContent;
event Windows.Foundation.TypedEventHandler<Object, LaunchPositionRequest> RequestLaunchPosition;
event Windows.Foundation.TypedEventHandler<Object, WindowListRequest> RequestWindowList;
}
}

View File

@@ -86,17 +86,12 @@
Grid.Row="2"
x:Load="False" />
<ContentDialog x:Name="QuitDialog"
x:Uid="QuitDialog"
<ContentDialog x:Name="ConfirmCloseDialog"
Grid.Row="2"
x:Load="False"
DefaultButton="Primary" />
<ContentDialog x:Name="CloseAllDialog"
x:Uid="CloseAllDialog"
Grid.Row="2"
x:Load="False"
DefaultButton="Primary" />
DefaultButton="Primary">
<CheckBox x:Uid="DontAskAgainCheckBox" />
</ContentDialog>
<ContentDialog x:Name="CloseReadOnlyDialog"
x:Uid="CloseReadOnlyDialog"

View File

@@ -10,6 +10,7 @@
#include "../../types/inc/utils.hpp"
#include "BellEventArgs.g.cpp"
#include "NotificationEventArgs.g.cpp"
#include "TerminalPaneContent.g.cpp"
using namespace winrt::Windows::Foundation;
@@ -34,6 +35,7 @@ namespace winrt::TerminalApp::implementation
{
_controlEvents._ConnectionStateChanged = _control.ConnectionStateChanged(winrt::auto_revoke, { this, &TerminalPaneContent::_controlConnectionStateChangedHandler });
_controlEvents._WarningBell = _control.WarningBell(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlWarningBellHandler });
_controlEvents._PromptStarted = _control.PromptStarted(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlPromptStartedHandler });
_controlEvents._CloseTerminalRequested = _control.CloseTerminalRequested(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_closeTerminalRequestedHandler });
_controlEvents._RestartTerminalRequested = _control.RestartTerminalRequested(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_restartTerminalRequestedHandler });
@@ -42,6 +44,9 @@ namespace winrt::TerminalApp::implementation
_controlEvents._SetTaskbarProgress = _control.SetTaskbarProgress(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlSetTaskbarProgress });
_controlEvents._ReadOnlyChanged = _control.ReadOnlyChanged(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlReadOnlyChanged });
_controlEvents._FocusFollowMouseRequested = _control.FocusFollowMouseRequested(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlFocusFollowMouseRequested });
_controlEvents._ShowNotification = _control.ShowNotification(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlShowNotification });
_controlEvents._OutputStarted = _control.OutputStarted(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlOutputStartedHandler });
_controlEvents._OutputBurstEnded = _control.OutputIdle(winrt::auto_revoke, { get_weak(), &TerminalPaneContent::_controlOutputBurstEndedHandler });
}
void TerminalPaneContent::_removeControlEvents()
{
@@ -173,6 +178,16 @@ namespace winrt::TerminalApp::implementation
{
TaskbarProgressChanged.raise(*this, nullptr);
}
winrt::Microsoft::Terminal::Control::TaskbarState TerminalPaneContent::TaskbarState()
{
return _control.TaskbarState();
}
uint64_t TerminalPaneContent::TaskbarProgress()
{
return _control.TaskbarProgress();
}
void TerminalPaneContent::_controlReadOnlyChanged(const IInspectable&, const IInspectable&)
{
ReadOnlyChanged.raise(*this, nullptr);
@@ -182,6 +197,11 @@ namespace winrt::TerminalApp::implementation
FocusRequested.raise(*this, nullptr);
}
void TerminalPaneContent::_controlShowNotification(const IInspectable& /*sender*/, const ShowNotificationEventArgs& args)
{
NotificationRequested.raise(*this, winrt::make<implementation::NotificationEventArgs>(OutputNotificationStyle::Notification, true, args.Title(), args.Body()));
}
// Method Description:
// - Called when our attached control is closed. Triggers listeners to our close
// event, if we're a leaf pane.
@@ -261,6 +281,25 @@ namespace winrt::TerminalApp::implementation
// has the 'visual' flag set
// Arguments:
// - <unused>
void TerminalPaneContent::PlayNotificationSound()
{
if (_profile)
{
auto sounds{ _profile.BellSound() };
if (sounds && sounds.Size() > 0)
{
winrt::hstring soundPath{ sounds.GetAt(rand() % sounds.Size()).Resolved() };
winrt::Windows::Foundation::Uri uri{ soundPath };
_playBellSound(uri);
}
else
{
const auto soundAlias = reinterpret_cast<LPCTSTR>(SND_ALIAS_SYSTEMHAND);
PlaySound(soundAlias, NULL, SND_ALIAS_ID | SND_ASYNC | SND_SENTRY);
}
}
}
void TerminalPaneContent::_controlWarningBellHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
const winrt::Windows::Foundation::IInspectable& /*eventArgs*/)
{
@@ -272,18 +311,7 @@ namespace winrt::TerminalApp::implementation
if (WI_IsFlagSet(_profile.BellStyle(), winrt::Microsoft::Terminal::Settings::Model::BellStyle::Audible))
{
// Audible is set, play the sound
auto sounds{ _profile.BellSound() };
if (sounds && sounds.Size() > 0)
{
winrt::hstring soundPath{ sounds.GetAt(rand() % sounds.Size()).Resolved() };
winrt::Windows::Foundation::Uri uri{ soundPath };
_playBellSound(uri);
}
else
{
const auto soundAlias = reinterpret_cast<LPCTSTR>(SND_ALIAS_SYSTEMHAND);
PlaySound(soundAlias, NULL, SND_ALIAS_ID | SND_ASYNC | SND_SENTRY);
}
PlayNotificationSound();
}
if (WI_IsFlagSet(_profile.BellStyle(), winrt::Microsoft::Terminal::Settings::Model::BellStyle::Window))
@@ -291,9 +319,73 @@ namespace winrt::TerminalApp::implementation
_control.BellLightOn();
}
// raise the event with the bool value corresponding to the taskbar flag
// raise the event with the bool values corresponding to the taskbar and notification flags
BellRequested.raise(*this,
*winrt::make_self<TerminalApp::implementation::BellEventArgs>(WI_IsFlagSet(_profile.BellStyle(), BellStyle::Taskbar)));
*winrt::make_self<TerminalApp::implementation::BellEventArgs>(
WI_IsFlagSet(_profile.BellStyle(), BellStyle::Taskbar),
WI_IsFlagSet(_profile.BellStyle(), BellStyle::Notification)));
}
}
}
void TerminalPaneContent::_controlPromptStartedHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
const winrt::Windows::Foundation::IInspectable& /*eventArgs*/)
{
if (_profile)
{
const auto notifyStyle = _profile.NotifyOnNextPrompt();
if (notifyStyle != OutputNotificationStyle::None)
{
if (const auto thresholdInSeconds = _profile.NotifyOnNextPromptThreshold(); thresholdInSeconds > 0)
{
if (_lastOutputStartedAt == 0)
{
return;
}
if (const auto elapsedMs = GetTickCount64() - _lastOutputStartedAt; elapsedMs < (static_cast<uint64_t>(thresholdInSeconds) * 1000))
{
_lastOutputStartedAt = 0;
return;
}
}
_lastOutputStartedAt = 0;
NotificationRequested.raise(*this,
*winrt::make_self<TerminalApp::implementation::NotificationEventArgs>(notifyStyle, false));
}
}
}
void TerminalPaneContent::_controlOutputStartedHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
const winrt::Windows::Foundation::IInspectable& /*eventArgs*/)
{
_lastOutputStartedAt = GetTickCount64();
}
// The underlying TermControl::OutputIdle event is fired on the trailing
// edge of a 100ms-debounced output burst (see ControlCore::Initialize).
// When "notifyOnActivity" is enabled, we get one event per burst of
// output, which naturally coalesces a stream of output into a single notification.
void TerminalPaneContent::_controlOutputBurstEndedHandler(const winrt::Windows::Foundation::IInspectable& /*sender*/,
const winrt::Windows::Foundation::IInspectable& /*eventArgs*/)
{
if (_profile)
{
const auto notifyStyle = _profile.NotifyOnActivity();
if (notifyStyle != OutputNotificationStyle::None)
{
const auto now = GetTickCount64();
const auto thresholdSeconds = _profile.NotifyOnActivityThreshold();
if (thresholdSeconds > 0 &&
_lastActivityNotificationAt != 0 &&
(now - _lastActivityNotificationAt) < (static_cast<uint64_t>(thresholdSeconds) * 1000))
{
return;
}
_lastActivityNotificationAt = now;
NotificationRequested.raise(*this,
*winrt::make_self<TerminalApp::implementation::NotificationEventArgs>(notifyStyle, false));
}
}
}

View File

@@ -4,6 +4,7 @@
#pragma once
#include "TerminalPaneContent.g.h"
#include "BellEventArgs.g.h"
#include "NotificationEventArgs.g.h"
#include "BasicPaneEvents.h"
namespace winrt::TerminalApp::implementation
@@ -13,10 +14,23 @@ namespace winrt::TerminalApp::implementation
struct BellEventArgs : public BellEventArgsT<BellEventArgs>
{
public:
BellEventArgs(bool flashTaskbar) :
FlashTaskbar(flashTaskbar) {}
BellEventArgs(bool flashTaskbar, bool sendNotification) :
FlashTaskbar(flashTaskbar), SendNotification(sendNotification) {}
til::property<bool> FlashTaskbar;
til::property<bool> SendNotification;
};
struct NotificationEventArgs : public NotificationEventArgsT<NotificationEventArgs>
{
public:
NotificationEventArgs(winrt::Microsoft::Terminal::Control::OutputNotificationStyle style, bool alwaysNotify = true, const winrt::hstring& title = {}, const winrt::hstring& body = {}) :
Style(style), AlwaysNotify(alwaysNotify), Title(title), Body(body) {}
til::property<winrt::Microsoft::Terminal::Control::OutputNotificationStyle> Style;
til::property<bool> AlwaysNotify;
til::property<winrt::hstring> Title;
til::property<winrt::hstring> Body;
};
struct TerminalPaneContent : TerminalPaneContentT<TerminalPaneContent>, BasicPaneEvents
@@ -36,6 +50,7 @@ namespace winrt::TerminalApp::implementation
void UpdateSettings(const winrt::Microsoft::Terminal::Settings::Model::CascadiaSettings& settings);
void MarkAsDefterm();
void PlayNotificationSound();
winrt::Microsoft::Terminal::Settings::Model::Profile GetProfile() const
{
@@ -43,8 +58,8 @@ namespace winrt::TerminalApp::implementation
}
winrt::hstring Title() { return _control.Title(); }
uint64_t TaskbarState() { return _control.TaskbarState(); }
uint64_t TaskbarProgress() { return _control.TaskbarProgress(); }
winrt::Microsoft::Terminal::Control::TaskbarState TaskbarState();
uint64_t TaskbarProgress();
bool ReadOnly() { return _control.ReadOnly(); }
winrt::hstring Icon() const;
Windows::Foundation::IReference<winrt::Windows::UI::Color> TabColor() const noexcept;
@@ -67,10 +82,18 @@ namespace winrt::TerminalApp::implementation
winrt::Windows::Media::Playback::MediaPlayer _bellPlayer{ nullptr };
bool _bellPlayerCreated{ false };
// Tracks the GetTickCount64() for NotifyOnActivityThreshold
// and NotifyOnNextPromptThreshold respectively.
uint64_t _lastActivityNotificationAt{ 0 };
uint64_t _lastOutputStartedAt{ 0 };
struct ControlEventTokens
{
winrt::Microsoft::Terminal::Control::TermControl::ConnectionStateChanged_revoker _ConnectionStateChanged;
winrt::Microsoft::Terminal::Control::TermControl::WarningBell_revoker _WarningBell;
winrt::Microsoft::Terminal::Control::TermControl::PromptStarted_revoker _PromptStarted;
winrt::Microsoft::Terminal::Control::TermControl::OutputStarted_revoker _OutputStarted;
winrt::Microsoft::Terminal::Control::TermControl::OutputIdle_revoker _OutputBurstEnded;
winrt::Microsoft::Terminal::Control::TermControl::CloseTerminalRequested_revoker _CloseTerminalRequested;
winrt::Microsoft::Terminal::Control::TermControl::RestartTerminalRequested_revoker _RestartTerminalRequested;
@@ -79,6 +102,7 @@ namespace winrt::TerminalApp::implementation
winrt::Microsoft::Terminal::Control::TermControl::SetTaskbarProgress_revoker _SetTaskbarProgress;
winrt::Microsoft::Terminal::Control::TermControl::ReadOnlyChanged_revoker _ReadOnlyChanged;
winrt::Microsoft::Terminal::Control::TermControl::FocusFollowMouseRequested_revoker _FocusFollowMouseRequested;
winrt::Microsoft::Terminal::Control::TermControl::ShowNotification_revoker _ShowNotification;
} _controlEvents;
void _setupControlEvents();
@@ -89,6 +113,9 @@ namespace winrt::TerminalApp::implementation
safe_void_coroutine _controlConnectionStateChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);
void _controlWarningBellHandler(const winrt::Windows::Foundation::IInspectable& sender,
const winrt::Windows::Foundation::IInspectable& e);
void _controlPromptStartedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& eventArgs);
void _controlOutputStartedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& eventArgs);
void _controlOutputBurstEndedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& eventArgs);
void _controlReadOnlyChangedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& e);
void _controlTitleChanged(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
@@ -96,6 +123,7 @@ namespace winrt::TerminalApp::implementation
void _controlSetTaskbarProgress(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
void _controlReadOnlyChanged(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
void _controlFocusFollowMouseRequested(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& args);
void _controlShowNotification(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Microsoft::Terminal::Control::ShowNotificationEventArgs& args);
void _closeTerminalRequestedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);
void _restartTerminalRequestedHandler(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::Foundation::IInspectable& /*args*/);

View File

@@ -11,6 +11,7 @@ namespace TerminalApp
Microsoft.Terminal.Control.TermControl GetTermControl();
void MarkAsDefterm();
void PlayNotificationSound();
Microsoft.Terminal.Settings.Model.Profile GetProfile();

View File

@@ -17,6 +17,7 @@ namespace winrt::TerminalApp::implementation
WINRT_OBSERVABLE_PROPERTY(bool, IsProgressRingActive, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, IsProgressRingIndeterminate, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, BellIndicator, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, ActivityIndicator, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, IsReadOnlyActive, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(uint32_t, ProgressValue, PropertyChanged.raise);
WINRT_OBSERVABLE_PROPERTY(bool, IsInputBroadcastActive, PropertyChanged.raise);

View File

@@ -12,6 +12,7 @@ namespace TerminalApp
Boolean IsProgressRingActive { get; set; };
Boolean IsProgressRingIndeterminate { get; set; };
Boolean BellIndicator { get; set; };
Boolean ActivityIndicator { get; set; };
UInt32 ProgressValue { get; set; };
Boolean IsReadOnlyActive { get; set; };
Boolean IsInputBroadcastActive { get; set; };

View File

@@ -108,13 +108,19 @@ static Documents::Run _BuildErrorRun(const winrt::hstring& text, const ResourceD
Documents::Run textRun;
textRun.Text(text);
// Color the text red (light theme) or yellow (dark theme) based on the system theme
auto key = winrt::box_value(L"ErrorTextBrush");
if (resources.HasKey(key))
// GH #18147 - In High Contrast mode, don't override the foreground.
// Let the text inherit the system HC text color from its parent element,
// since SystemErrorTextColor doesn't adapt to High Contrast themes.
if (!winrt::Windows::UI::ViewManagement::AccessibilitySettings{}.HighContrast())
{
auto g = resources.Lookup(key);
auto brush = g.try_as<winrt::Windows::UI::Xaml::Media::Brush>();
textRun.Foreground(brush);
// Color the text red (light theme) or yellow (dark theme) based on the system theme
auto key = winrt::box_value(L"ErrorTextBrush");
if (resources.HasKey(key))
{
auto g = resources.Lookup(key);
auto brush = g.try_as<winrt::Windows::UI::Xaml::Media::Brush>();
textRun.Foreground(brush);
}
}
return textRun;
@@ -252,6 +258,15 @@ namespace winrt::TerminalApp::implementation
AppLogic::Current()->NotifyRootInitialized();
}
WindowLayout TerminalWindow::GetWindowLayout()
{
if (_root)
{
return _root->GetWindowLayout();
}
return nullptr;
}
void TerminalWindow::PersistState()
{
if (_root)
@@ -1097,6 +1112,11 @@ namespace winrt::TerminalApp::implementation
_initialContentArgs = wil::to_vector(args);
}
void TerminalWindow::SetPersistedLayout(const winrt::Microsoft::Terminal::Settings::Model::WindowLayout& layout)
{
_cachedLayout = layout;
}
// Method Description:
// - Parse the provided commandline arguments into actions, and try to
// perform them immediately.
@@ -1205,10 +1225,26 @@ namespace winrt::TerminalApp::implementation
}
}
bool TerminalWindow::FocusTab(const winrt::TerminalApp::Tab& tab)
{
if (_root)
{
return _root->FocusTab(tab);
}
return false;
}
void TerminalWindow::WindowName(const winrt::hstring& name)
{
const auto oldIsQuakeMode = _WindowProperties->IsQuakeWindow();
const auto oldName = _WindowProperties->WindowName();
_WindowProperties->WindowName(name);
// If this window had a persisted workspace under the old name, rename
// that entry too so we don't leave a stale copy behind.
if (!oldName.empty() && !name.empty() && oldName != name)
{
ApplicationState::SharedInstance().RenameWorkspace(oldName, name);
}
if (!_root)
{
return;

View File

@@ -71,6 +71,7 @@ namespace winrt::TerminalApp::implementation
void Create();
winrt::Microsoft::Terminal::Settings::Model::WindowLayout GetWindowLayout();
void PersistState();
void UpdateSettings(winrt::TerminalApp::SettingsLoadEventArgs args);
@@ -79,6 +80,7 @@ namespace winrt::TerminalApp::implementation
int32_t SetStartupCommandline(TerminalApp::CommandlineArgs args);
void SetStartupContent(const winrt::hstring& content, const Windows::Foundation::IReference<Windows::Foundation::Rect>& contentBounds);
void SetPersistedLayout(const winrt::Microsoft::Terminal::Settings::Model::WindowLayout& layout);
int32_t ExecuteCommandline(TerminalApp::CommandlineArgs args);
void SetSettingsStartupArgs(const std::vector<winrt::Microsoft::Terminal::Settings::Model::ActionAndArgs>& actions);
@@ -92,6 +94,7 @@ namespace winrt::TerminalApp::implementation
bool ShowTabsFullscreen() const;
bool AutoHideWindow();
void IdentifyWindow();
bool FocusTab(const winrt::TerminalApp::Tab& tab);
std::optional<uint32_t> LoadPersistedLayoutIdx() const;
winrt::Microsoft::Terminal::Settings::Model::WindowLayout LoadPersistedLayout();
@@ -221,6 +224,8 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(SetTaskbarProgress, winrt::Windows::Foundation::IInspectable, winrt::Windows::Foundation::IInspectable, _root, SetTaskbarProgress);
FORWARDED_TYPED_EVENT(IdentifyWindowsRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, IdentifyWindowsRequested);
FORWARDED_TYPED_EVENT(SummonWindowRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, SummonWindowRequested);
FORWARDED_TYPED_EVENT(SummonWindowByIdRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::SummonWindowByIdRequestedArgs, _root, SummonWindowByIdRequested);
FORWARDED_TYPED_EVENT(FocusTabRequested, Windows::Foundation::IInspectable, winrt::TerminalApp::Tab, _root, FocusTabRequested);
FORWARDED_TYPED_EVENT(OpenSystemMenu, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, OpenSystemMenu);
FORWARDED_TYPED_EVENT(QuitRequested, Windows::Foundation::IInspectable, Windows::Foundation::IInspectable, _root, QuitRequested);
FORWARDED_TYPED_EVENT(ShowWindowChanged, Windows::Foundation::IInspectable, winrt::Microsoft::Terminal::Control::ShowWindowArgs, _root, ShowWindowChanged);
@@ -229,6 +234,7 @@ namespace winrt::TerminalApp::implementation
FORWARDED_TYPED_EVENT(RequestReceiveContent, Windows::Foundation::IInspectable, winrt::TerminalApp::RequestReceiveContentArgs, _root, RequestReceiveContent);
FORWARDED_TYPED_EVENT(RequestLaunchPosition, Windows::Foundation::IInspectable, winrt::TerminalApp::LaunchPositionRequest, _root, RequestLaunchPosition);
FORWARDED_TYPED_EVENT(RequestWindowList, Windows::Foundation::IInspectable, winrt::TerminalApp::WindowListRequest, _root, RequestWindowList);
#ifdef UNIT_TESTING
friend class TerminalAppLocalTests::CommandlineTest;

View File

@@ -4,6 +4,7 @@
import "IPaneContent.idl";
import "TerminalPage.idl";
import "ShortcutActionDispatch.idl";
import "Tab.idl";
namespace TerminalApp
{
@@ -55,11 +56,13 @@ namespace TerminalApp
Int32 SetStartupCommandline(CommandlineArgs args);
void SetStartupContent(String json, Windows.Foundation.IReference<Windows.Foundation.Rect> bounds);
void SetPersistedLayout(Microsoft.Terminal.Settings.Model.WindowLayout layout);
Int32 ExecuteCommandline(CommandlineArgs args);
Boolean ShouldImmediatelyHandoffToElevated();
void HandoffToElevated();
Microsoft.Terminal.Settings.Model.WindowLayout GetWindowLayout();
void PersistState();
Windows.UI.Xaml.UIElement GetRoot();
@@ -74,6 +77,7 @@ namespace TerminalApp
Boolean ShowTabsFullscreen { get; };
void IdentifyWindow();
Boolean FocusTab(TerminalApp.Tab tab);
void SetPersistedLayoutIdx(UInt32 idx);
void RequestExitFullscreen();
@@ -126,6 +130,8 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, Object> IdentifyWindowsRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> IsQuakeWindowChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> SummonWindowRequested;
event Windows.Foundation.TypedEventHandler<Object, SummonWindowByIdRequestedArgs> SummonWindowByIdRequested;
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.Tab> FocusTabRequested;
event Windows.Foundation.TypedEventHandler<Object, Object> OpenSystemMenu;
event Windows.Foundation.TypedEventHandler<Object, Object> QuitRequested;
event Windows.Foundation.TypedEventHandler<Object, TerminalApp.SystemMenuChangeArgs> SystemMenuChangeRequested;
@@ -137,6 +143,7 @@ namespace TerminalApp
event Windows.Foundation.TypedEventHandler<Object, RequestMoveContentArgs> RequestMoveContent;
event Windows.Foundation.TypedEventHandler<Object, RequestReceiveContentArgs> RequestReceiveContent;
event Windows.Foundation.TypedEventHandler<Object, LaunchPositionRequest> RequestLaunchPosition;
event Windows.Foundation.TypedEventHandler<Object, WindowListRequest> RequestWindowList;
void AttachContent(String content, UInt32 tabIndex);
void SendContentToOther(RequestReceiveContentArgs args);

View File

@@ -54,6 +54,9 @@
#include <winrt/Windows.Media.Playback.h>
#include <winrt/Windows.Management.Deployment.h>
#include <winrt/Windows.UI.Notifications.h>
#include <winrt/Windows.Data.Xml.Dom.h>
#include <winrt/Microsoft.UI.Xaml.Controls.h>
#include <winrt/Microsoft.UI.Xaml.Controls.Primitives.h>
#include <winrt/Microsoft.UI.Xaml.XamlTypeInfo.h>

View File

@@ -139,6 +139,15 @@ namespace winrt::Microsoft::Terminal::Control::implementation
auto pfnSearchMissingCommand = [this](auto&& PH1, auto&& PH2) { _terminalSearchMissingCommand(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2)); };
_terminal->SetSearchMissingCommandCallback(pfnSearchMissingCommand);
auto pfnShowNotification = [this](auto&& PH1, auto&& PH2) { _terminalShowNotification(std::forward<decltype(PH1)>(PH1), std::forward<decltype(PH2)>(PH2)); };
_terminal->SetShowNotificationCallback(pfnShowNotification);
auto pfnPromptStarted = [this] { _terminalPromptStarted(); };
_terminal->SetPromptStartedCallback(pfnPromptStarted);
auto pfnOutputStarted = [this] { _terminalOutputStarted(); };
_terminal->SetOutputStartedCallback(pfnOutputStarted);
auto pfnClearQuickFix = [this] { ClearQuickFix(); };
_terminal->SetClearQuickFixCallback(pfnClearQuickFix);
@@ -913,6 +922,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_hasUnfocusedAppearance = static_cast<bool>(newAppearance);
_unfocusedAppearance = _hasUnfocusedAppearance ? newAppearance : settings;
// Cache the auto-detect setting in an atomic so the off-thread output/prompt
// callbacks can read it without synchronizing with _settings. If the effective
// taskbar state changes (because a command is currently active and the setting
// toggled), notify listeners.
const auto nowEnabled = _settings.AutoDetectRunningCommand();
const auto wasEnabled = _autoDetectCommandActivity.exchange(nowEnabled, std::memory_order_relaxed);
if (wasEnabled != nowEnabled && _commandActive.load(std::memory_order_relaxed))
{
TaskbarProgressChanged.raise(*this, nullptr);
}
const auto lock = _terminal->LockForWriting();
_builtinGlyphs = _settings.EnableBuiltinGlyphs();
@@ -1547,10 +1567,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - Gets the internal taskbar state value
// Return Value:
// - The taskbar state of this control
const size_t ControlCore::TaskbarState() const noexcept
const Control::TaskbarState ControlCore::TaskbarState() const noexcept
{
const auto lock = _terminal->LockForReading();
return _terminal->GetTaskbarState();
const auto vtState = static_cast<Control::TaskbarState>(_terminal->GetTaskbarState());
if (vtState == Control::TaskbarState::Clear &&
_autoDetectCommandActivity.load(std::memory_order_relaxed) &&
_commandActive.load(std::memory_order_relaxed))
{
return Control::TaskbarState::Indeterminate;
}
return vtState;
}
// Method Description:
@@ -1580,6 +1607,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
return _terminal->GetViewport().Height();
}
// Function Description:
// - Gets the width of the terminal in columns. This is just the
// width of the viewport.
// Return Value:
// - The width of the terminal in columns
int ControlCore::ViewWidth() const
{
const auto lock = _terminal->LockForReading();
return _terminal->GetViewport().Width();
}
// Function Description:
// - Gets the height of the terminal in lines of text. This includes the
// history AND the viewport.
@@ -1599,6 +1637,26 @@ namespace winrt::Microsoft::Terminal::Control::implementation
WarningBell.raise(*this, nullptr);
}
void ControlCore::_terminalPromptStarted()
{
if (_commandActive.exchange(false, std::memory_order_relaxed) &&
_autoDetectCommandActivity.load(std::memory_order_relaxed))
{
TaskbarProgressChanged.raise(*this, nullptr);
}
PromptStarted.raise(*this, nullptr);
}
void ControlCore::_terminalOutputStarted()
{
if (!_commandActive.exchange(true, std::memory_order_relaxed) &&
_autoDetectCommandActivity.load(std::memory_order_relaxed))
{
TaskbarProgressChanged.raise(*this, nullptr);
}
OutputStarted.raise(*this, nullptr);
}
// Method Description:
// - Called for the Terminal's TitleChanged callback. This will re-raise
// a new winrt TypedEvent that can be listened to.
@@ -1691,6 +1749,11 @@ namespace winrt::Microsoft::Terminal::Control::implementation
SearchMissingCommand.raise(*this, make<implementation::SearchMissingCommandEventArgs>(hstring{ missingCommand }, bufferRow));
}
void ControlCore::_terminalShowNotification(std::wstring_view title, std::wstring_view body)
{
ShowNotification.raise(*this, make<implementation::ShowNotificationEventArgs>(hstring{ title }, hstring{ body }));
}
void ControlCore::OpenCWD()
{
const auto workingDirectory = WorkingDirectory();
@@ -2338,6 +2401,13 @@ namespace winrt::Microsoft::Terminal::Control::implementation
}
_terminal->Write(sequence);
// Clear scroll marks so they don't remain stale in the scrollbar.
// The Scrollback case is already handled by the \x1b[3J path (TextBuffer::ClearScrollback).
if (clearType != ClearBufferType::Scrollback)
{
_terminal->ClearAllMarks();
}
}
if (clearType == Control::ClearBufferType::Screen || clearType == Control::ClearBufferType::All)

View File

@@ -161,7 +161,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void OpenCWD();
#pragma region ICoreState
const size_t TaskbarState() const noexcept;
const Control::TaskbarState TaskbarState() const noexcept;
const size_t TaskbarProgress() const noexcept;
hstring Title();
@@ -172,6 +172,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
int ScrollOffset();
int ViewHeight() const;
int ViewWidth() const;
int BufferHeight() const;
bool HasSelection() const;
@@ -275,6 +276,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
til::typed_event<IInspectable, Control::TitleChangedEventArgs> TitleChanged;
til::typed_event<IInspectable, Control::WriteToClipboardEventArgs> WriteToClipboard;
til::typed_event<> WarningBell;
til::typed_event<> PromptStarted;
til::typed_event<> OutputStarted;
til::typed_event<> TabColorChanged;
til::typed_event<> BackgroundColorChanged;
til::typed_event<IInspectable, Control::ScrollPositionChangedArgs> ScrollPositionChanged;
@@ -292,6 +295,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
til::typed_event<IInspectable, Control::OpenHyperlinkEventArgs> OpenHyperlink;
til::typed_event<IInspectable, Control::CompletionsChangedEventArgs> CompletionsChanged;
til::typed_event<IInspectable, Control::SearchMissingCommandEventArgs> SearchMissingCommand;
til::typed_event<IInspectable, Control::ShowNotificationEventArgs> ShowNotification;
til::typed_event<> RefreshQuickFixUI;
til::typed_event<IInspectable, Control::WindowSizeChangedEventArgs> WindowSizeChanged;
@@ -323,6 +327,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
#pragma region TerminalCoreCallbacks
void _terminalWarningBell();
void _terminalPromptStarted();
void _terminalOutputStarted();
void _terminalTitleChanged(std::wstring_view wstr);
void _terminalScrollPositionChanged(const int viewTop,
const int viewHeight,
@@ -333,6 +339,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const int velocity,
const std::chrono::microseconds duration);
void _terminalSearchMissingCommand(std::wstring_view missingCommand, const til::CoordType& bufferRow);
void _terminalShowNotification(std::wstring_view title, std::wstring_view body);
void _terminalWindowSizeChanged(int32_t width, int32_t height);
void _terminalCompletionsChanged(std::wstring_view menuJson, unsigned int replaceLength);
@@ -419,6 +426,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
std::optional<til::point> _lastHoveredCell;
uint16_t _lastHoveredId{ 0 };
std::atomic<bool> _initializedTerminal{ false };
std::atomic<bool> _autoDetectCommandActivity{ false };
std::atomic<bool> _commandActive{ false };
bool _isReadOnly{ false };
bool _closing{ false };

View File

@@ -192,12 +192,15 @@ namespace Microsoft.Terminal.Control
event Windows.Foundation.TypedEventHandler<Object, TitleChangedEventArgs> TitleChanged;
event Windows.Foundation.TypedEventHandler<Object, WriteToClipboardEventArgs> WriteToClipboard;
event Windows.Foundation.TypedEventHandler<Object, Object> WarningBell;
event Windows.Foundation.TypedEventHandler<Object, Object> PromptStarted;
event Windows.Foundation.TypedEventHandler<Object, Object> OutputStarted;
event Windows.Foundation.TypedEventHandler<Object, Object> TabColorChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> BackgroundColorChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> TaskbarProgressChanged;
event Windows.Foundation.TypedEventHandler<Object, Object> RendererEnteredErrorState;
event Windows.Foundation.TypedEventHandler<Object, ShowWindowArgs> ShowWindowChanged;
event Windows.Foundation.TypedEventHandler<Object, SearchMissingCommandEventArgs> SearchMissingCommand;
event Windows.Foundation.TypedEventHandler<Object, ShowNotificationEventArgs> ShowNotification;
event Windows.Foundation.TypedEventHandler<Object, Object> RefreshQuickFixUI;
event Windows.Foundation.TypedEventHandler<Object, WindowSizeChangedEventArgs> WindowSizeChanged;

View File

@@ -309,8 +309,10 @@ namespace winrt::Microsoft::Terminal::Control::implementation
const auto isOnOriginalPosition = _lastMouseClickPosNoSelection == pixelPosition;
// Rounded coordinates for text selection.
// Don't round in VT mouse mode; cell-level precision matters more
const auto round = !_core->IsVtMouseModeEnabled();
// Don't round in VT mouse mode; cell-level precision matters more.
// Only round for single-click: for double/triple-click, rounding
// can push the position to the next cell, selecting the wrong word.
const auto round = multiClickMapper == 1 && !_core->IsVtMouseModeEnabled();
_core->LeftClickOnTerminal(_getTerminalPosition(til::point{ pixelPosition }, round),
multiClickMapper,
altEnabled,

View File

@@ -20,6 +20,7 @@
#include "CharSentEventArgs.g.h"
#include "StringSentEventArgs.g.h"
#include "SearchMissingCommandEventArgs.g.h"
#include "ShowNotificationEventArgs.g.h"
#include "WindowSizeChangedEventArgs.g.h"
namespace winrt::Microsoft::Terminal::Control::implementation
@@ -252,6 +253,17 @@ namespace winrt::Microsoft::Terminal::Control::implementation
til::property<til::CoordType> BufferRow;
};
struct ShowNotificationEventArgs : public ShowNotificationEventArgsT<ShowNotificationEventArgs>
{
public:
ShowNotificationEventArgs(const winrt::hstring& title, const winrt::hstring& body) :
Title(title),
Body(body) {}
til::property<winrt::hstring> Title;
til::property<winrt::hstring> Body;
};
struct WindowSizeChangedEventArgs : public WindowSizeChangedEventArgsT<WindowSizeChangedEventArgs>
{
public:

View File

@@ -160,6 +160,12 @@ namespace Microsoft.Terminal.Control
Int32 BufferRow { get; };
}
runtimeclass ShowNotificationEventArgs
{
String Title { get; };
String Body { get; };
}
runtimeclass WindowSizeChangedEventArgs
{
Int32 Width;

View File

@@ -29,6 +29,30 @@ namespace Microsoft.Terminal.Control
MinGW,
};
[flags]
enum OutputNotificationStyle
{
None = 0,
Taskbar = 0x1,
Audible = 0x2,
Tab = 0x4,
Notification = 0x8,
All = 0xffffffff
};
// Mirrors Microsoft::Console::VirtualTerminal::DispatchTypes::TaskbarState
// (which is shared with conhost and lives outside the WinRT projection).
// Values must remain numerically identical so the conversion at the
// ControlCore boundary is a 1:1 cast.
enum TaskbarState
{
Clear = 0,
Set = 1,
Error = 2,
Indeterminate = 3,
Paused = 4,
};
// Class Description:
// TerminalSettings encapsulates all settings that control the
// TermControl's behavior. In these settings there is both the entirety
@@ -78,6 +102,12 @@ namespace Microsoft.Terminal.Control
PathTranslationStyle PathTranslationStyle { get; };
String DragDropDelimiter { get; };
OutputNotificationStyle NotifyOnActivity { get; };
OutputNotificationStyle NotifyOnNextPrompt { get; };
Int32 NotifyOnActivityThreshold { get; };
Int32 NotifyOnNextPromptThreshold { get; };
Boolean AutoDetectRunningCommand { get; };
// NOTE! When adding something here, make sure to update ControlProperties.h too!
};
}

View File

@@ -1,6 +1,8 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import "IControlSettings.idl";
namespace Microsoft.Terminal.Control
{
enum MarkCategory
@@ -31,7 +33,7 @@ namespace Microsoft.Terminal.Control
interface ICoreState
{
String Title { get; };
UInt64 TaskbarState { get; };
Microsoft.Terminal.Control.TaskbarState TaskbarState { get; };
UInt64 TaskbarProgress { get; };
String WorkingDirectory { get; };

View File

@@ -328,6 +328,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_revokers.CompletionsChanged = _core.CompletionsChanged(winrt::auto_revoke, { get_weak(), &TermControl::_bubbleCompletionsChanged });
_revokers.RestartTerminalRequested = _core.RestartTerminalRequested(winrt::auto_revoke, { get_weak(), &TermControl::_bubbleRestartTerminalRequested });
_revokers.SearchMissingCommand = _core.SearchMissingCommand(winrt::auto_revoke, { get_weak(), &TermControl::_bubbleSearchMissingCommand });
_revokers.ShowNotification = _core.ShowNotification(winrt::auto_revoke, { get_weak(), &TermControl::_bubbleShowNotification });
_revokers.WindowSizeChanged = _core.WindowSizeChanged(winrt::auto_revoke, { get_weak(), &TermControl::_bubbleWindowSizeChanged });
_revokers.WriteToClipboard = _core.WriteToClipboard(winrt::auto_revoke, { get_weak(), &TermControl::_bubbleWriteToClipboard });
@@ -393,6 +394,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// attached content before we set up the throttled func, and that'll A/V
_revokers.coreScrollPositionChanged = _core.ScrollPositionChanged(winrt::auto_revoke, { get_weak(), &TermControl::_ScrollPositionChanged });
_revokers.WarningBell = _core.WarningBell(winrt::auto_revoke, { get_weak(), &TermControl::_coreWarningBell });
_revokers.PromptStarted = _core.PromptStarted(winrt::auto_revoke, { get_weak(), &TermControl::_corePromptStarted });
_revokers.OutputStarted = _core.OutputStarted(winrt::auto_revoke, { get_weak(), &TermControl::_coreOutputStarted });
static constexpr auto AutoScrollUpdateInterval = std::chrono::microseconds(static_cast<int>(1.0 / 30.0 * 1000000));
_autoScrollTimer.Interval(AutoScrollUpdateInterval);
@@ -2456,6 +2459,46 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
_automationPeer.UpdateControlBounds();
}
// Show resize overlay with columns x rows
_ShowResizeOverlay();
}
// Method Description:
// - Shows a centered overlay with the current terminal dimensions (columns x rows).
// Used during window resize and font size changes. Skipped for disabled controls
// (e.g. the Settings preview terminal) to avoid visual noise.
void TermControl::_ShowResizeOverlay()
{
// Don't show the overlay in the Settings preview control
if (!IsEnabled())
{
return;
}
const auto coreImpl = winrt::get_self<ControlCore>(_core);
const auto cols = coreImpl->ViewWidth();
const auto rows = coreImpl->ViewHeight();
if (cols > 0 && rows > 0)
{
ResizeOverlayText().Text(fmt::format(FMT_COMPILE(L"{} \u00D7 {}"), cols, rows));
ResizeOverlay().Visibility(Visibility::Visible);
if (!_resizeOverlayTimer)
{
_resizeOverlayTimer.emplace();
_resizeOverlayTimer->Interval(std::chrono::milliseconds(750));
_resizeOverlayTimer->Tick([weakThis = get_weak()](auto&&, auto&&) {
if (auto self = weakThis.get())
{
self->ResizeOverlay().Visibility(Visibility::Collapsed);
self->_resizeOverlayTimer->Stop();
}
});
}
_resizeOverlayTimer->Start();
}
}
// Method Description:
@@ -3356,7 +3399,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
// - Gets the internal taskbar state value
// Return Value:
// - The taskbar state of this control
const uint64_t TermControl::TaskbarState() const noexcept
const Control::TaskbarState TermControl::TaskbarState() const noexcept
{
return _core.TaskbarState();
}
@@ -3726,6 +3769,16 @@ namespace winrt::Microsoft::Terminal::Control::implementation
_playWarningBell->Run();
}
void TermControl::_corePromptStarted(const IInspectable& /*sender*/, const IInspectable& /*args*/)
{
PromptStarted.raise(*this, nullptr);
}
void TermControl::_coreOutputStarted(const IInspectable& /*sender*/, const IInspectable& /*args*/)
{
OutputStarted.raise(*this, nullptr);
}
hstring TermControl::ReadEntireBuffer() const
{
return _core.ReadEntireBuffer();
@@ -3843,6 +3896,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void TermControl::_coreOutputIdle(const IInspectable& /*sender*/, const IInspectable& /*args*/)
{
_refreshSearch();
OutputIdle.raise(*this, nullptr);
}
void TermControl::OwningHwnd(uint64_t owner)

View File

@@ -86,7 +86,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void ColorSelection(Control::SelectionColor fg, Control::SelectionColor bg, Core::MatchMode matchMode);
#pragma region ICoreState
const uint64_t TaskbarState() const noexcept;
const Control::TaskbarState TaskbarState() const noexcept;
const uint64_t TaskbarProgress() const noexcept;
hstring Title();
@@ -211,6 +211,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
til::typed_event<IInspectable, IInspectable> FocusFollowMouseRequested;
til::typed_event<Control::TermControl, Windows::UI::Xaml::RoutedEventArgs> Initialized;
til::typed_event<> WarningBell;
til::typed_event<> PromptStarted;
til::typed_event<> OutputStarted;
til::typed_event<> OutputIdle;
til::typed_event<IInspectable, Control::KeySentEventArgs> KeySent;
til::typed_event<IInspectable, Control::CharSentEventArgs> CharSent;
til::typed_event<IInspectable, Control::StringSentEventArgs> StringSent;
@@ -230,6 +233,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
BUBBLED_FORWARDED_TYPED_EVENT(RestartTerminalRequested, IInspectable, IInspectable);
BUBBLED_FORWARDED_TYPED_EVENT(WriteToClipboard, IInspectable, Control::WriteToClipboardEventArgs);
BUBBLED_FORWARDED_TYPED_EVENT(PasteFromClipboard, IInspectable, Control::PasteFromClipboardEventArgs);
BUBBLED_FORWARDED_TYPED_EVENT(ShowNotification, IInspectable, Control::ShowNotificationEventArgs);
// clang-format on
@@ -316,6 +320,9 @@ namespace winrt::Microsoft::Terminal::Control::implementation
winrt::hstring _restorePath;
bool _showMarksInScrollbar{ false };
std::optional<SafeDispatcherTimer> _resizeOverlayTimer;
void _ShowResizeOverlay();
bool _isBackgroundLight{ false };
bool _detached{ false };
til::CoordType _searchScrollOffset = 0;
@@ -424,6 +431,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
void _coreTransparencyChanged(IInspectable sender, Control::TransparencyChangedEventArgs args);
void _coreRaisedNotice(const IInspectable& s, const Control::NoticeEventArgs& args);
void _coreWarningBell(const IInspectable& sender, const IInspectable& args);
void _corePromptStarted(const IInspectable& sender, const IInspectable& args);
void _coreOutputStarted(const IInspectable& sender, const IInspectable& args);
void _coreOutputIdle(const IInspectable& sender, const IInspectable& args);
winrt::Windows::Foundation::Point _toPosInDips(const Core::Point terminalCellPos);
@@ -449,6 +458,8 @@ namespace winrt::Microsoft::Terminal::Control::implementation
{
Control::ControlCore::ScrollPositionChanged_revoker coreScrollPositionChanged;
Control::ControlCore::WarningBell_revoker WarningBell;
Control::ControlCore::PromptStarted_revoker PromptStarted;
Control::ControlCore::OutputStarted_revoker OutputStarted;
Control::ControlCore::RendererEnteredErrorState_revoker RendererEnteredErrorState;
Control::ControlCore::BackgroundColorChanged_revoker BackgroundColorChanged;
Control::ControlCore::FontSizeChanged_revoker FontSizeChanged;
@@ -468,6 +479,7 @@ namespace winrt::Microsoft::Terminal::Control::implementation
Control::ControlCore::CompletionsChanged_revoker CompletionsChanged;
Control::ControlCore::RestartTerminalRequested_revoker RestartTerminalRequested;
Control::ControlCore::SearchMissingCommand_revoker SearchMissingCommand;
Control::ControlCore::ShowNotification_revoker ShowNotification;
Control::ControlCore::RefreshQuickFixUI_revoker RefreshQuickFixUI;
Control::ControlCore::WindowSizeChanged_revoker WindowSizeChanged;

View File

@@ -69,6 +69,9 @@ namespace Microsoft.Terminal.Control
event Windows.Foundation.TypedEventHandler<Object, Object> SetTaskbarProgress;
event Windows.Foundation.TypedEventHandler<Object, NoticeEventArgs> RaiseNotice;
event Windows.Foundation.TypedEventHandler<Object, Object> WarningBell;
event Windows.Foundation.TypedEventHandler<Object, Object> PromptStarted;
event Windows.Foundation.TypedEventHandler<Object, Object> OutputStarted;
event Windows.Foundation.TypedEventHandler<Object, Object> OutputIdle;
event Windows.Foundation.TypedEventHandler<Object, Object> HidePointerCursor;
event Windows.Foundation.TypedEventHandler<Object, Object> RestorePointerCursor;
event Windows.Foundation.TypedEventHandler<Object, Object> TabColorChanged;
@@ -82,6 +85,7 @@ namespace Microsoft.Terminal.Control
event Windows.Foundation.TypedEventHandler<Object, CharSentEventArgs> CharSent;
event Windows.Foundation.TypedEventHandler<Object, StringSentEventArgs> StringSent;
event Windows.Foundation.TypedEventHandler<Object, SearchMissingCommandEventArgs> SearchMissingCommand;
event Windows.Foundation.TypedEventHandler<Object, ShowNotificationEventArgs> ShowNotification;
Microsoft.UI.Xaml.Controls.CommandBarFlyout ContextMenu { get; };

View File

@@ -1365,6 +1365,24 @@
</Grid>
<!-- Resize overlay: shows columns x rows when terminal is resized -->
<Border x:Name="ResizeOverlay"
Padding="16,8,16,8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="{ThemeResource SystemControlBackgroundAltHighBrush}"
BorderBrush="{ThemeResource SystemAccentColor}"
BorderThickness="1"
CornerRadius="{ThemeResource OverlayCornerRadius}"
IsHitTestVisible="False"
Visibility="Collapsed">
<TextBlock x:Name="ResizeOverlayText"
FontSize="18"
FontWeight="SemiBold"
Foreground="{ThemeResource SystemControlForegroundBaseHighBrush}"
TextAlignment="Center" />
</Border>
<Grid x:Name="RendererFailedNotice"
HorizontalAlignment="Center"
VerticalAlignment="Center"

View File

@@ -124,6 +124,7 @@ namespace Microsoft.Terminal.Core
Boolean AllowKittyKeyboardMode { get; };
Boolean AllowVtChecksumReport { get; };
Boolean AllowVtClipboardWrite { get; };
Boolean AllowOscNotifications { get; };
Boolean TrimBlockSelection { get; };
Boolean DetectURLs { get; };

View File

@@ -98,7 +98,6 @@ void Terminal::UpdateSettings(ICoreSettings settings)
_answerbackMessage = settings.AnswerbackMessage();
_wordDelimiters = settings.WordDelimiters();
_suppressApplicationTitle = settings.SuppressApplicationTitle();
_startingTitle = settings.StartingTitle();
_trimBlockSelection = settings.TrimBlockSelection();
_autoMarkPrompts = settings.AutoMarkPrompts();
_rainbowSuggestions = settings.RainbowSuggestions();
@@ -124,6 +123,11 @@ void Terminal::UpdateSettings(ICoreSettings settings)
// Save the changes made above and in UpdateAppearance as the new default render settings.
GetRenderSettings().SaveDefaultSettings();
if (!_startingTitle)
{
_startingTitle = settings.StartingTitle();
}
if (!_startingTabColor && settings.StartingTabColor())
{
_startingTabColor = settings.StartingTabColor().Value();
@@ -263,6 +267,7 @@ void Terminal::SetOptionalFeatures(winrt::Microsoft::Terminal::Core::ICoreSettin
auto features = til::enumset<ITermDispatch::OptionalFeature>{};
features.set(ITermDispatch::OptionalFeature::ChecksumReport, settings.AllowVtChecksumReport());
features.set(ITermDispatch::OptionalFeature::ClipboardWrite, settings.AllowVtClipboardWrite());
features.set(ITermDispatch::OptionalFeature::DesktopNotification, settings.AllowOscNotifications());
engine.Dispatch().SetOptionalFeatures(features);
}
@@ -763,6 +768,11 @@ TerminalInput::OutputType Terminal::SendCharEvent(const wchar_t ch, const WORD s
// This changed the scrollbar marks - raise a notification to update them
_NotifyScrollEvent();
}
// regardless, notify that we started command output
if (_pfnOutputStarted)
{
_pfnOutputStarted();
}
}
}
@@ -1248,7 +1258,7 @@ const std::optional<til::color> Terminal::GetTabColor() const
// - Gets the internal taskbar state value
// Return Value:
// - The taskbar state
const size_t Microsoft::Terminal::Core::Terminal::GetTaskbarState() const noexcept
const Microsoft::Console::VirtualTerminal::DispatchTypes::TaskbarState Microsoft::Terminal::Core::Terminal::GetTaskbarState() const noexcept
{
return _taskbarState;
}
@@ -1272,11 +1282,26 @@ void Microsoft::Terminal::Core::Terminal::SetSearchMissingCommandCallback(std::f
_pfnSearchMissingCommand.swap(pfn);
}
void Microsoft::Terminal::Core::Terminal::SetShowNotificationCallback(std::function<void(std::wstring_view, std::wstring_view)> pfn) noexcept
{
_pfnShowNotification.swap(pfn);
}
void Microsoft::Terminal::Core::Terminal::SetClearQuickFixCallback(std::function<void()> pfn) noexcept
{
_pfnClearQuickFix.swap(pfn);
}
void Terminal::SetPromptStartedCallback(std::function<void()> pfn) noexcept
{
_pfnPromptStarted.swap(pfn);
}
void Terminal::SetOutputStartedCallback(std::function<void()> pfn) noexcept
{
_pfnOutputStarted.swap(pfn);
}
// Method Description:
// - Stores the search highlighted regions in the terminal
void Terminal::SetSearchHighlights(const std::vector<til::point_span>& highlights) noexcept

View File

@@ -159,12 +159,14 @@ public:
bool IsVtInputEnabled() const noexcept override;
void NotifyBufferRotation(const int delta) override;
void NotifyShellIntegrationMark() override;
void NotifyShellIntegrationMark(ShellIntegrationMark mark) override;
void InvokeCompletions(std::wstring_view menuJson, unsigned int replaceLength) override;
void SearchMissingCommand(const std::wstring_view command) override;
void ShowNotification(const std::wstring_view title, const std::wstring_view body) override;
#pragma endregion
void ClearMark();
@@ -233,8 +235,11 @@ public:
void SetPlayMidiNoteCallback(std::function<void(const int, const int, const std::chrono::microseconds)> pfn) noexcept;
void CompletionsChangedCallback(std::function<void(std::wstring_view, unsigned int)> pfn) noexcept;
void SetSearchMissingCommandCallback(std::function<void(std::wstring_view, const til::CoordType)> pfn) noexcept;
void SetShowNotificationCallback(std::function<void(std::wstring_view, std::wstring_view)> pfn) noexcept;
void SetClearQuickFixCallback(std::function<void()> pfn) noexcept;
void SetWindowSizeChangedCallback(std::function<void(int32_t, int32_t)> pfn) noexcept;
void SetPromptStartedCallback(std::function<void()> pfn) noexcept;
void SetOutputStartedCallback(std::function<void()> pfn) noexcept;
void SetSearchHighlights(const std::vector<til::point_span>& highlights) noexcept;
void SetSearchHighlightFocused(size_t focusedIdx) noexcept;
void ScrollToSearchHighlight(til::CoordType searchScrollOffset);
@@ -243,7 +248,7 @@ public:
const std::optional<til::color> GetTabColor() const;
const size_t GetTaskbarState() const noexcept;
const ::Microsoft::Console::VirtualTerminal::DispatchTypes::TaskbarState GetTaskbarState() const noexcept;
const size_t GetTaskbarProgress() const noexcept;
void ColorSelection(const TextAttribute& attr, winrt::Microsoft::Terminal::Core::MatchMode matchMode);
@@ -341,15 +346,18 @@ private:
std::function<void(const int, const int, const std::chrono::microseconds)> _pfnPlayMidiNote;
std::function<void(std::wstring_view, unsigned int)> _pfnCompletionsChanged;
std::function<void(std::wstring_view, const til::CoordType)> _pfnSearchMissingCommand;
std::function<void(std::wstring_view, std::wstring_view)> _pfnShowNotification;
std::function<void()> _pfnClearQuickFix;
std::function<void(int32_t, int32_t)> _pfnWindowSizeChanged;
std::function<void()> _pfnPromptStarted;
std::function<void()> _pfnOutputStarted;
RenderSettings _renderSettings;
std::unique_ptr<::Microsoft::Console::VirtualTerminal::StateMachine> _stateMachine;
::Microsoft::Console::VirtualTerminal::TerminalInput _terminalInput;
std::optional<std::wstring> _title;
std::wstring _startingTitle;
std::optional<std::wstring> _startingTitle;
std::optional<til::color> _startingTabColor;
std::vector<til::point_span> _searchHighlights;
@@ -363,6 +371,9 @@ private:
til::enumset<Mode> _systemMode{ Mode::AutoWrap };
::Microsoft::Console::VirtualTerminal::DispatchTypes::TaskbarState _taskbarState{ ::Microsoft::Console::VirtualTerminal::DispatchTypes::TaskbarState::Clear };
size_t _taskbarProgress = 0;
bool _focused = false;
bool _snapOnInput = true;
bool _altGrAliasing = true;
@@ -371,9 +382,6 @@ private:
bool _autoMarkPrompts = false;
bool _rainbowSuggestions = false;
size_t _taskbarState = 0;
size_t _taskbarProgress = 0;
size_t _hyperlinkPatternId = 0;
std::wstring _answerbackMessage;

View File

@@ -91,8 +91,12 @@ void Terminal::SetWindowTitle(const std::wstring_view title)
_assertLocked();
if (!_suppressApplicationTitle)
{
_title.emplace(title.empty() ? _startingTitle : title);
_pfnTitleChanged(_title.value());
_title.reset();
if (!title.empty())
{
_title.emplace(title);
}
_pfnTitleChanged(GetConsoleTitle());
}
}
@@ -112,6 +116,13 @@ bool Terminal::ResizeWindow(const til::CoordType width, const til::CoordType hei
return false;
}
const auto currentDimensions = _GetMutableViewport().Dimensions();
if (width == currentDimensions.width && height == currentDimensions.height)
{
return false;
}
if (_pfnWindowSizeChanged)
{
_pfnWindowSizeChanged(width, height);
@@ -162,7 +173,7 @@ void Terminal::SetTaskbarProgress(const ::Microsoft::Console::VirtualTerminal::D
{
_assertLocked();
_taskbarState = static_cast<size_t>(state);
_taskbarState = state;
switch (state)
{
@@ -369,6 +380,14 @@ void Terminal::SearchMissingCommand(const std::wstring_view command)
}
}
void Terminal::ShowNotification(const std::wstring_view title, const std::wstring_view body)
{
if (_pfnShowNotification)
{
_pfnShowNotification(title, body);
}
}
void Terminal::NotifyBufferRotation(const int delta)
{
// Update our selection, so it doesn't move as the buffer is cycled
@@ -405,8 +424,26 @@ void Terminal::NotifyBufferRotation(const int delta)
}
}
void Terminal::NotifyShellIntegrationMark()
void Terminal::NotifyShellIntegrationMark(ShellIntegrationMark mark)
{
// Notify the scrollbar that marks have been added so it can refresh the mark indicators
_NotifyScrollEvent();
switch (mark)
{
case ShellIntegrationMark::Prompt:
if (_pfnPromptStarted)
{
_pfnPromptStarted();
}
break;
case ShellIntegrationMark::Output:
if (_pfnOutputStarted)
{
_pfnOutputStarted();
}
break;
default:
break;
}
}

View File

@@ -184,11 +184,18 @@ void Terminal::SelectNewRegion(const til::point coordStart, const til::point coo
std::wstring_view Terminal::GetConsoleTitle() const noexcept
{
_assertLocked();
if (_title.has_value())
if (_title)
{
return *_title;
}
return _startingTitle;
if (_startingTitle)
{
return *_startingTitle;
}
return {};
}
// Method Description:

View File

@@ -352,8 +352,14 @@ namespace winrt::Microsoft::Terminal::Settings
_AllowKittyKeyboardMode = profile.AllowKittyKeyboardMode();
_AllowVtChecksumReport = profile.AllowVtChecksumReport();
_AllowVtClipboardWrite = profile.AllowVtClipboardWrite();
_AllowOscNotifications = profile.AllowOscNotifications();
_PathTranslationStyle = profile.PathTranslationStyle();
_DragDropDelimiter = profile.DragDropDelimiter();
_NotifyOnActivity = profile.NotifyOnActivity();
_NotifyOnNextPrompt = profile.NotifyOnNextPrompt();
_NotifyOnActivityThreshold = profile.NotifyOnActivityThreshold();
_NotifyOnNextPromptThreshold = profile.NotifyOnNextPromptThreshold();
_AutoDetectRunningCommand = profile.AutoDetectRunningCommand();
}
// Method Description:

View File

@@ -7,7 +7,9 @@
#include "LibraryResources.h"
#include "../TerminalSettingsModel/AllShortcutActions.h"
using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Xaml::Controls;
using namespace winrt::Windows::UI::Xaml::Navigation;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
@@ -42,4 +44,65 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
TraceLoggingKeyword(MICROSOFT_KEYWORD_MEASURES),
TelemetryPrivacyDataTag(PDT_ProductAndServiceUsage));
}
// Builds the "view all" flyout lazily on the first click of a
// row's "..." button, then caches it on the button so subsequent clicks
// just re-show it.
void Actions::ViewAllKeyChordsButton_Click(const IInspectable& sender, const RoutedEventArgs& /*e*/)
{
const auto button = sender.try_as<Button>();
if (!button)
{
return;
}
// Retrieve cached flyout, if possible
if (const auto existing = button.Flyout())
{
existing.ShowAt(button);
return;
}
const auto cmdVM = button.DataContext().try_as<Editor::CommandViewModel>();
if (!cmdVM)
{
return;
}
Flyout flyout;
flyout.Placement(Primitives::FlyoutPlacementMode::Bottom);
flyout.FlyoutPresenterStyle(Resources().Lookup(box_value(L"EdgeToEdgeFlyoutPresenterStyle")).as<winrt::Windows::UI::Xaml::Style>());
StackPanel content;
content.Orientation(Orientation::Vertical);
content.MinWidth(120.0);
if (cmdVM.HasNoKeyChords())
{
const auto emptyTemplate = Resources().Lookup(box_value(L"ViewAllKeyChordsFlyoutEmptyStateTemplate")).as<DataTemplate>();
content.Children().Append(emptyTemplate.LoadContent().as<UIElement>());
}
else
{
const auto separatorTemplate = Resources().Lookup(box_value(L"ViewAllKeyChordsFlyoutSeparatorTemplate")).as<DataTemplate>();
const auto itemTemplate = Resources().Lookup(box_value(L"ViewAllKeyChordsFlyoutItemTemplate")).as<DataTemplate>();
const auto chords = cmdVM.KeyChordList();
const auto count = chords.Size();
for (uint32_t i = 0; i < count; ++i)
{
if (i > 0)
{
content.Children().Append(separatorTemplate.LoadContent().as<UIElement>());
}
auto chordVisual = itemTemplate.LoadContent().as<Editor::KeyChordVisual>();
chordVisual.KeyChord(chords.GetAt(i).CurrentKeys());
content.Children().Append(chordVisual);
}
}
flyout.Content(content);
button.Flyout(flyout);
flyout.ShowAt(button);
}
}

View File

@@ -17,6 +17,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void OnNavigatedTo(const winrt::Windows::UI::Xaml::Navigation::NavigationEventArgs& e);
void ViewAllKeyChordsButton_Click(const winrt::Windows::Foundation::IInspectable& sender, const winrt::Windows::UI::Xaml::RoutedEventArgs& e);
til::property_changed_event PropertyChanged;
WINRT_OBSERVABLE_PROPERTY(Editor::ActionsViewModel, ViewModel, PropertyChanged.raise, nullptr);

View File

@@ -8,7 +8,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.Terminal.Settings.Editor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mtu="using:Microsoft.Terminal.UI"
mc:Ignorable="d">
<Page.Resources>
@@ -17,182 +16,116 @@
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Theme Dictionary -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#333333" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#B5B5B5" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlForegroundPointerOver"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#333333" />
<SolidColorBrush x:Key="TextControlForegroundFocused"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#404040" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!-- TextBox colors ! -->
<SolidColorBrush x:Key="TextControlBackground"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextBoxPlaceholderTextThemeBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBorderBrush"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForeground"
Color="#636363" />
<SolidColorBrush x:Key="TextControlBackgroundPointerOver"
Color="#DADADA" />
<SolidColorBrush x:Key="TextControlBorderBrushPointerOver"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPointerOver"
Color="#FF4343" />
<SolidColorBrush x:Key="TextControlBackgroundFocused"
Color="#CCCCCC" />
<SolidColorBrush x:Key="TextControlBorderBrushFocused"
Color="#636363" />
<SolidColorBrush x:Key="TextControlButtonForegroundPressed"
Color="#FFFFFF" />
<SolidColorBrush x:Key="TextControlButtonBackgroundPressed"
Color="#FF4343" />
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{StaticResource ControlCornerRadius}" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Border" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<!-- Styles -->
<Style x:Key="KeyBindingContainerStyle"
<Style x:Key="ActionRowItemContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="Padding" Value="12,4,4,4" />
<Setter Property="Padding" Value="{StaticResource SettingsCardPadding}" />
<Setter Property="MinHeight" Value="{StaticResource SettingsCardMinHeight}" />
<Setter Property="Margin" Value="{StaticResource SettingsCardItemMargin}" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="XYFocusKeyboardNavigation" Value="Enabled" />
<Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
</Style>
<Style x:Key="KeyBindingNameTextBlockStyle"
<Style x:Key="ActionRowNameTextStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
</Style>
<Style x:Key="KeyChordEditorStyle"
TargetType="local:KeyChordListener">
<Setter Property="HorizontalAlignment" Value="Right" />
<Style x:Key="ActionRowSubtleButtonStyle"
BasedOn="{StaticResource DefaultButtonStyle}"
TargetType="Button">
<Setter Property="MinWidth" Value="32" />
<Setter Property="Width" Value="32" />
<Setter Property="Height" Value="32" />
<Setter Property="Padding" Value="0" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<!-- Converters & Misc. -->
<SolidColorBrush x:Key="ActionContainerBackgroundEditing"
Color="{ThemeResource SystemListMediumColor}" />
<SolidColorBrush x:Key="ActionContainerBackground"
Color="Transparent" />
<!--
FlyoutPresenter style with no internal padding so a full-width Border
separator inside the flyout can reach the flyout's left/right edges.
-->
<Style x:Key="EdgeToEdgeFlyoutPresenterStyle"
BasedOn="{StaticResource DefaultFlyoutPresenterStyle}"
TargetType="FlyoutPresenter">
<Setter Property="Padding" Value="0" />
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
</Style>
<!-- Templates -->
<DataTemplate x:Key="ViewAllKeyChordsFlyoutSeparatorTemplate">
<Border Height="1"
Margin="0,4,0,4"
Background="{ThemeResource DividerStrokeColorDefaultBrush}" />
</DataTemplate>
<DataTemplate x:Key="ViewAllKeyChordsFlyoutEmptyStateTemplate">
<TextBlock x:Uid="Actions_NoKeyBindings"
Margin="12,8,12,8"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Style="{StaticResource SecondaryTextBlockStyle}" />
</DataTemplate>
<DataTemplate x:Key="ViewAllKeyChordsFlyoutItemTemplate">
<local:KeyChordVisual Margin="{ThemeResource MenuFlyoutItemThemePaddingNarrow}"
HorizontalAlignment="Right" />
</DataTemplate>
<DataTemplate x:Key="CommandTemplate"
x:DataType="local:CommandViewModel">
<ListViewItem AutomationProperties.Name="{x:Bind DisplayNameAndKeyChordAutomationPropName, Mode=OneWay}"
Style="{StaticResource KeyBindingContainerStyle}">
<Grid ColumnSpacing="8">
<Grid.ColumnDefinitions>
<!-- command name -->
<ColumnDefinition Width="*" />
<!-- key chord -->
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<Grid AutomationProperties.Name="{x:Bind DisplayNameAndKeyChordAutomationPropName, Mode=OneWay}"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<!-- command name -->
<ColumnDefinition Width="*" />
<!-- key chord -->
<ColumnDefinition Width="Auto" />
<!-- edit button -->
<ColumnDefinition Width="Auto" />
<!-- "..." button -->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<!-- Command Name -->
<TextBlock Grid.Column="0"
FontWeight="Normal"
Style="{StaticResource KeyBindingNameTextBlockStyle}"
Text="{x:Bind DisplayName, Mode=OneWay}" />
<!-- Key Chord Text -->
<Grid Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
ColumnSpacing="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Border Grid.Column="0"
Padding="8,4,8,4"
Style="{ThemeResource KeyChordBorderStyle}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(FirstKeyChordText)}">
<TextBlock FontSize="14"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind FirstKeyChordText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
</Border>
<Border Grid.Column="1"
Padding="8,4,8,4"
Style="{ThemeResource KeyChordBorderStyle}"
ToolTipService.ToolTip="{x:Bind AdditionalKeyChordTooltipText, Mode=OneWay}"
Visibility="{x:Bind mtu:Converters.StringNotEmptyToVisibility(AdditionalKeyChordCountText)}">
<TextBlock FontSize="14"
Style="{ThemeResource KeyChordTextBlockStyle}"
Text="{x:Bind AdditionalKeyChordCountText, Mode=OneWay}" />
</Border>
</Grid>
</Grid>
</ListViewItem>
<!-- Command Name -->
<TextBlock Grid.Column="0"
Style="{StaticResource ActionRowNameTextStyle}"
Text="{x:Bind DisplayName, Mode=OneWay}" />
<!-- Key Chord -->
<local:KeyChordVisual Grid.Column="1"
HorizontalAlignment="Right"
KeyChord="{x:Bind FirstKeyChord, Mode=OneWay}" />
<!-- Edit button -->
<Button x:Uid="Actions_EditButton"
Grid.Column="2"
AutomationProperties.Name="{x:Bind DisplayName, Mode=OneWay}"
Click="{x:Bind Edit_Click}"
Style="{StaticResource ActionRowSubtleButtonStyle}">
<FontIcon FontSize="14"
Glyph="&#xE70F;" />
</Button>
<!-- "..." button + flyout -->
<Button x:Uid="Actions_ViewAllKeyChordsButton"
Grid.Column="3"
Click="ViewAllKeyChordsButton_Click"
Style="{StaticResource ActionRowSubtleButtonStyle}">
<FontIcon FontSize="14"
Glyph="&#xE712;" />
</Button>
</Grid>
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
@@ -208,7 +141,8 @@
<!-- Add New Button -->
<Button x:Name="AddNewButton"
Margin="0,12,0,0"
Click="{x:Bind ViewModel.AddNewCommand}">
Click="{x:Bind ViewModel.AddNewCommand}"
Style="{StaticResource AccentButtonStyle}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="{StaticResource StandardIconSize}"
@@ -221,11 +155,42 @@
<!-- Commands -->
<ListView x:Name="CommandsListView"
Margin="-8,0,0,0"
IsItemClickEnabled="True"
ItemClick="{x:Bind ViewModel.CmdListItemClicked}"
ItemContainerStyle="{StaticResource ActionRowItemContainerStyle}"
ItemTemplate="{StaticResource CommandTemplate}"
ItemsSource="{x:Bind ViewModel.CommandList, Mode=OneWay}" />
ItemsSource="{x:Bind ViewModel.CommandList, Mode=OneWay}"
SelectionMode="None">
<!--
The framework ListViewItemPresenter reads its per-state backgrounds
from these theme resources (not from ListViewItem.Background), so we
override them here to match the card chrome on ActionRowItemContainerStyle.
-->
<ListView.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="ListViewItemBackground"
ResourceKey="ExpanderHeaderBackground" />
<StaticResource x:Key="ListViewItemBackgroundPointerOver"
ResourceKey="ControlFillColorSecondaryBrush" />
<StaticResource x:Key="ListViewItemBackgroundPressed"
ResourceKey="ControlFillColorTertiaryBrush" />
<StaticResource x:Key="ListViewItemBackgroundSelected"
ResourceKey="ExpanderHeaderBackground" />
<StaticResource x:Key="ListViewItemBackgroundSelectedPointerOver"
ResourceKey="ControlFillColorSecondaryBrush" />
<StaticResource x:Key="ListViewItemBackgroundSelectedPressed"
ResourceKey="ControlFillColorTertiaryBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="ListViewItemBackground"
ResourceKey="SystemColorButtonFaceColorBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</ListView.Resources>
</ListView>
</StackPanel>
</Border>
</Page>

View File

@@ -57,13 +57,22 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return;
}
std::vector<Editor::KeyChordViewModel> keyChordVMs;
int32_t idx = 1;
for (const auto keys : _keyChordList)
{
auto kcVM{ make<KeyChordViewModel>(keys) };
_RegisterKeyChordVMEvents(kcVM);
keyChordVMs.push_back(kcVM);
auto kcVM{ make_self<KeyChordViewModel>(keys) };
kcVM->Index(idx++);
_RegisterKeyChordVMEvents(*kcVM);
keyChordVMs.push_back(*kcVM);
}
_KeyChordList = single_threaded_observable_vector(std::move(keyChordVMs));
_KeyChordList.VectorChanged([weakThis{ get_weak() }](const auto& /*sender*/, const auto& /*args*/) {
if (auto self{ weakThis.get() })
{
self->_ReindexKeyChordList();
self->_NotifyChanges(L"FirstKeyChord", L"FirstKeyChordText", L"AdditionalKeyChordCountText", L"AdditionalKeyChordTooltipText", L"DisplayNameAndKeyChordAutomationPropName");
}
});
std::vector<hstring> shortcutActions;
for (const auto [action, name] : _availableActionsAndNamesMap)
@@ -119,7 +128,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return _cachedDisplayName;
}
winrt::hstring CommandViewModel::Name()
winrt::hstring CommandViewModel::Name() const noexcept
{
return _command.HasName() ? _command.Name() : L"";
}
@@ -145,7 +154,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return result;
}
winrt::hstring CommandViewModel::FirstKeyChordText()
winrt::hstring CommandViewModel::FirstKeyChordText() const
{
if (_KeyChordList.Size() != 0)
{
@@ -154,7 +163,21 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return L"";
}
winrt::hstring CommandViewModel::AdditionalKeyChordCountText()
Control::KeyChord CommandViewModel::FirstKeyChord() const noexcept
{
if (_KeyChordList.Size() != 0)
{
return _KeyChordList.GetAt(0).CurrentKeys();
}
return nullptr;
}
bool CommandViewModel::HasNoKeyChords() const noexcept
{
return _KeyChordList.Size() == 0;
}
winrt::hstring CommandViewModel::AdditionalKeyChordCountText() const
{
const auto size = _KeyChordList.Size();
if (size > 1)
@@ -164,7 +187,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return L"";
}
winrt::hstring CommandViewModel::AdditionalKeyChordTooltipText()
winrt::hstring CommandViewModel::AdditionalKeyChordTooltipText() const
{
const auto size = _KeyChordList.Size();
if (size <= 1)
@@ -183,12 +206,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return winrt::hstring{ result };
}
winrt::hstring CommandViewModel::ID()
winrt::hstring CommandViewModel::ID() const noexcept
{
return _command.ID();
}
bool CommandViewModel::IsUserAction()
bool CommandViewModel::IsUserAction() const noexcept
{
return _command.Origin() == OriginTag::User;
}
@@ -206,23 +229,40 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void CommandViewModel::AddKeybinding_Click()
{
auto kbdVM{ make_self<KeyChordViewModel>(nullptr) };
kbdVM->Index(gsl::narrow_cast<int32_t>(_KeyChordList.Size()) + 1);
kbdVM->IsInEditMode(true);
_RegisterKeyChordVMEvents(*kbdVM);
KeyChordList().Append(*kbdVM);
FocusContainer.raise(*this, *kbdVM);
}
winrt::hstring CommandViewModel::ActionNameTextBoxAutomationPropName()
// Reassigns 1-based Index values for every KeyChordViewModel in the list. Called
// whenever the list changes shape so the per-row "Key Binding #N" label stays in sync.
void CommandViewModel::_ReindexKeyChordList()
{
const auto size = _KeyChordList.Size();
for (uint32_t i = 0; i < size; ++i)
{
auto kcVM{ _KeyChordList.GetAt(i) };
const auto newIdx = gsl::narrow_cast<int32_t>(i) + 1;
if (kcVM.Index() != newIdx)
{
kcVM.Index(newIdx);
}
}
}
winrt::hstring CommandViewModel::ActionNameTextBoxAutomationPropName() const
{
return RS_(L"Actions_Name/Text");
}
winrt::hstring CommandViewModel::ShortcutActionComboBoxAutomationPropName()
winrt::hstring CommandViewModel::ShortcutActionComboBoxAutomationPropName() const
{
return RS_(L"Actions_ShortcutAction/Text");
}
winrt::hstring CommandViewModel::AdditionalArgumentsControlAutomationPropName()
winrt::hstring CommandViewModel::AdditionalArgumentsControlAutomationPropName() const
{
return RS_(L"Actions_Arguments/Text");
}
@@ -273,6 +313,19 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
self->FocusContainer.raise(*self, senderVM);
}
}
else if (propertyName == L"KeyChordText")
{
// The first chord of the list is what the row visual on the Actions page binds to,
// so propagate the change up so the row updates.
if (self->_KeyChordList.Size() > 0 && self->_KeyChordList.GetAt(0) == senderVM)
{
self->_NotifyChanges(L"FirstKeyChord", L"FirstKeyChordText", L"DisplayNameAndKeyChordAutomationPropName");
}
else
{
self->_NotifyChanges(L"AdditionalKeyChordTooltipText");
}
}
}
});
}
@@ -1065,12 +1118,21 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
KeyChordViewModel::KeyChordViewModel(Control::KeyChord currentKeys)
{
CurrentKeys(currentKeys);
// DisplayLabel is derived from Index, so re-fire the change for it whenever Index changes.
PropertyChanged([this](const auto& /*sender*/, const Windows::UI::Xaml::Data::PropertyChangedEventArgs& args) {
if (args.PropertyName() == L"Index")
{
_NotifyChanges(L"DisplayLabel");
}
});
}
void KeyChordViewModel::CurrentKeys(const Control::KeyChord& newKeys)
{
_currentKeys = newKeys;
KeyChordText(Model::KeyChordSerialization::ToString(_currentKeys));
_NotifyChanges(L"CurrentKeys");
}
Control::KeyChord KeyChordViewModel::CurrentKeys() const noexcept
@@ -1126,6 +1188,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
hstring KeyChordViewModel::CancelButtonName() const noexcept { return RS_(L"Actions_CancelButton/[using:Windows.UI.Xaml.Controls]ToolTipService/ToolTip"); }
hstring KeyChordViewModel::AcceptButtonName() const noexcept { return RS_(L"Actions_AcceptButton/[using:Windows.UI.Xaml.Controls]ToolTipService/ToolTip"); }
hstring KeyChordViewModel::DeleteButtonName() const noexcept { return RS_(L"Actions_DeleteButton/[using:Windows.UI.Xaml.Controls]ToolTipService/ToolTip"); }
hstring KeyChordViewModel::EditButtonName() const noexcept { return RS_(L"Actions_EditButton/[using:Windows.UI.Xaml.Controls]ToolTipService/ToolTip"); }
winrt::hstring KeyChordViewModel::DisplayLabel() const
{
return hstring{ RS_fmt(L"EditAction_KeyBindingNumberFormat", _Index) };
}
ActionsViewModel::ActionsViewModel(Model::CascadiaSettings settings) :
_Settings{ settings }

View File

@@ -69,16 +69,18 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Initialize();
winrt::hstring DisplayName();
winrt::hstring Name();
winrt::hstring Name() const noexcept;
void Name(const winrt::hstring& newName);
winrt::hstring DisplayNameAndKeyChordAutomationPropName();
winrt::hstring FirstKeyChordText();
winrt::hstring AdditionalKeyChordCountText();
winrt::hstring AdditionalKeyChordTooltipText();
winrt::hstring FirstKeyChordText() const;
Control::KeyChord FirstKeyChord() const noexcept;
bool HasNoKeyChords() const noexcept;
winrt::hstring AdditionalKeyChordCountText() const;
winrt::hstring AdditionalKeyChordTooltipText() const;
winrt::hstring ID();
bool IsUserAction();
winrt::hstring ID() const noexcept;
bool IsUserAction() const noexcept;
void Edit_Click();
til::typed_event<Editor::CommandViewModel, IInspectable> EditRequested;
@@ -89,9 +91,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void AddKeybinding_Click();
// UIA text
winrt::hstring ActionNameTextBoxAutomationPropName();
winrt::hstring ShortcutActionComboBoxAutomationPropName();
winrt::hstring AdditionalArgumentsControlAutomationPropName();
winrt::hstring ActionNameTextBoxAutomationPropName() const;
winrt::hstring ShortcutActionComboBoxAutomationPropName() const;
winrt::hstring AdditionalArgumentsControlAutomationPropName() const;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeNamesRequested;
@@ -115,6 +117,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void _RegisterActionArgsVMEvents(Editor::ActionArgsViewModel actionArgsVM);
void _ReplaceCommandWithUserCopy(bool reinitialize);
void _CreateAndInitializeActionArgsVMHelper();
void _ReindexKeyChordList();
};
struct ArgWrapper : ArgWrapperT<ArgWrapper>, ViewModelHelper<ArgWrapper>
@@ -230,15 +233,19 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void CancelChanges();
void DeleteKeyChord();
winrt::hstring DisplayLabel() const;
// UIA Text
hstring CancelButtonName() const noexcept;
hstring AcceptButtonName() const noexcept;
hstring DeleteButtonName() const noexcept;
hstring EditButtonName() const noexcept;
VIEW_MODEL_OBSERVABLE_PROPERTY(bool, IsInEditMode, false);
VIEW_MODEL_OBSERVABLE_PROPERTY(Control::KeyChord, ProposedKeys);
VIEW_MODEL_OBSERVABLE_PROPERTY(winrt::hstring, KeyChordText);
VIEW_MODEL_OBSERVABLE_PROPERTY(Windows::UI::Xaml::Controls::Flyout, AcceptChangesFlyout, nullptr);
VIEW_MODEL_OBSERVABLE_PROPERTY(int32_t, Index, 0);
public:
til::typed_event<Editor::KeyChordViewModel, Terminal::Control::KeyChord> AddKeyChordRequested;

View File

@@ -55,6 +55,8 @@ namespace Microsoft.Terminal.Settings.Editor
// View-model specific
String DisplayName { get; };
String FirstKeyChordText { get; };
Microsoft.Terminal.Control.KeyChord FirstKeyChord { get; };
Boolean HasNoKeyChords { get; };
String AdditionalKeyChordCountText { get; };
String AdditionalKeyChordTooltipText { get; };
String DisplayNameAndKeyChordAutomationPropName { get; };
@@ -138,9 +140,12 @@ namespace Microsoft.Terminal.Settings.Editor
String KeyChordText { get; };
// UI side
Microsoft.Terminal.Control.KeyChord CurrentKeys { get; };
Microsoft.Terminal.Control.KeyChord ProposedKeys;
Windows.UI.Xaml.Controls.Flyout AcceptChangesFlyout;
Boolean IsInEditMode { get; };
Int32 Index;
String DisplayLabel { get; };
void ToggleEditMode();
void AcceptChanges();
void CancelChanges();
@@ -148,6 +153,7 @@ namespace Microsoft.Terminal.Settings.Editor
String CancelButtonName { get; };
String AcceptButtonName { get; };
String DeleteButtonName { get; };
String EditButtonName { get; };
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, Microsoft.Terminal.Control.KeyChord> AddKeyChordRequested;
event Windows.Foundation.TypedEventHandler<KeyChordViewModel, ModifyKeyChordEventArgs> ModifyKeyChordRequested;

File diff suppressed because it is too large Load Diff

View File

@@ -64,6 +64,7 @@
<local:ColorToBrushConverter x:Key="ColorToBrushConverter" />
<local:ColorToStringConverter x:Key="ColorToStringConverter" />
<mtu:StringNotEmptyToVisibilityConverter x:Key="StringNotEmptyToVisibilityConverter" />
<Color x:Key="DeleteButtonColor">Firebrick</Color>
@@ -1228,13 +1229,19 @@
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<ContentPresenter x:Name="ContentPresenter"
Grid.Column="0"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}" />
<StackPanel Grid.Column="0"
Padding="0,12,0,12"
VerticalAlignment="Center">
<ContentPresenter x:Name="ContentPresenter"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
ContentTransitions="{TemplateBinding ContentTransitions}" />
<TextBlock Style="{StaticResource SettingsPageItemDescriptionStyle}"
Text="{Binding Tag, RelativeSource={RelativeSource Mode=TemplatedParent}}"
Visibility="{Binding Tag, RelativeSource={RelativeSource Mode=TemplatedParent}, Converter={StaticResource StringNotEmptyToVisibilityConverter}}" />
</StackPanel>
<FontIcon Grid.Column="1"
Margin="20,0,8,0"
HorizontalAlignment="Right"

View File

@@ -17,6 +17,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
INITIALIZE_BINDABLE_ENUM_SETTING(TextMeasurement, TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, L"Globals_TextMeasurement_", L"Text");
INITIALIZE_BINDABLE_ENUM_SETTING(AmbiguousWidth, AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth, L"Globals_AmbiguousWidth_", L"Text");
INITIALIZE_BINDABLE_ENUM_SETTING(GraphicsAPI, GraphicsAPI, winrt::Microsoft::Terminal::Control::GraphicsAPI, L"Globals_GraphicsAPI_", L"Text");
}
bool CompatibilityViewModel::DebugFeaturesAvailable() const noexcept

View File

@@ -28,6 +28,10 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
GETSET_BINDABLE_ENUM_SETTING(TextMeasurement, winrt::Microsoft::Terminal::Control::TextMeasurement, _settings.GlobalSettings().TextMeasurement);
GETSET_BINDABLE_ENUM_SETTING(AmbiguousWidth, winrt::Microsoft::Terminal::Control::AmbiguousWidth, _settings.GlobalSettings().AmbiguousWidth);
GETSET_BINDABLE_ENUM_SETTING(GraphicsAPI, winrt::Microsoft::Terminal::Control::GraphicsAPI, _settings.GlobalSettings().GraphicsAPI);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), DisablePartialInvalidation);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_settings.GlobalSettings(), SoftwareRendering);
private:
Model::CascadiaSettings _settings;
};

View File

@@ -23,6 +23,11 @@ namespace Microsoft.Terminal.Settings.Editor
IInspectable CurrentAmbiguousWidth;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> AmbiguousWidthList { get; };
IInspectable CurrentGraphicsAPI;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> GraphicsAPIList { get; };
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DisablePartialInvalidation);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, SoftwareRendering);
}
[default_interface] runtimeclass Compatibility : Windows.UI.Xaml.Controls.Page

View File

@@ -25,83 +25,119 @@
</Page.Resources>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Allow Headless -->
<local:SettingContainer x:Name="AllowHeadless"
x:Uid="Globals_AllowHeadless">
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Section: Compatibility -->
<local:SettingContainer x:Uid="Compatibility_Section_Compatibility"
StartExpanded="True"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Allow Headless -->
<local:SettingContainer x:Name="AllowHeadless"
x:Uid="Globals_AllowHeadless">
<ToggleSwitch IsOn="{x:Bind ViewModel.AllowHeadless, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Text Measurement -->
<local:SettingContainer x:Name="TextMeasurement"
x:Uid="Globals_TextMeasurement">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TextMeasurementList}"
SelectedItem="{x:Bind ViewModel.CurrentTextMeasurement, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Ambiguous Width -->
<local:SettingContainer x:Name="AmbiguousWidth"
x:Uid="Globals_AmbiguousWidth">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.AmbiguousWidthList}"
SelectedItem="{x:Bind ViewModel.CurrentAmbiguousWidth, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Debug Features -->
<local:SettingContainer x:Name="DebugFeaturesEnabled"
x:Uid="Globals_DebugFeaturesEnabled"
Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}">
<ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Reset Application State -->
<local:SettingContainer x:Name="ResetApplicationState"
x:Uid="Settings_ResetApplicationState">
<Button x:Uid="Settings_ResetApplicationStateButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>
<Flyout x:Name="ResetCacheFlyout"
FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
<StackPanel>
<TextBlock x:Uid="Settings_ResetApplicationStateConfirmationMessageHeader"
Style="{StaticResource CustomFlyoutTextStyle}" />
<TextBlock x:Uid="Settings_ResetApplicationStateConfirmationMessageBody"
FontWeight="Normal"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Settings_ResetApplicationStateConfirmationButton"
Click="ResetApplicationStateButton_Click" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingContainer>
<!-- Reset to Default Settings -->
<local:SettingContainer x:Name="ResetToDefaultSettings"
x:Uid="Settings_ResetToDefaultSettings">
<Button x:Uid="Settings_ResetToDefaultSettingsButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>
<Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
<StackPanel>
<TextBlock x:Uid="Settings_ResetToDefaultSettingsConfirmationMessageHeader"
Style="{StaticResource CustomFlyoutTextStyle}" />
<TextBlock x:Uid="Settings_ResetToDefaultSettingsConfirmationMessageBody"
FontWeight="Normal"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Settings_ResetToDefaultSettingsConfirmationButton"
Click="{x:Bind ViewModel.ResetToDefaultSettings}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Text Measurement -->
<local:SettingContainer x:Name="TextMeasurement"
x:Uid="Globals_TextMeasurement">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TextMeasurementList}"
SelectedItem="{x:Bind ViewModel.CurrentTextMeasurement, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Section: Rendering -->
<local:SettingContainer x:Uid="Compatibility_Section_Rendering"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Graphics API -->
<local:SettingContainer x:Name="GraphicsAPI"
x:Uid="Globals_GraphicsAPI">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.GraphicsAPIList}"
SelectedItem="{x:Bind ViewModel.CurrentGraphicsAPI, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Ambiguous Width -->
<local:SettingContainer x:Name="AmbiguousWidth"
x:Uid="Globals_AmbiguousWidth">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.AmbiguousWidthList}"
SelectedItem="{x:Bind ViewModel.CurrentAmbiguousWidth, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Disable Partial Invalidation -->
<local:SettingContainer x:Name="DisablePartialInvalidation"
x:Uid="Globals_DisablePartialInvalidation">
<ToggleSwitch IsOn="{x:Bind ViewModel.DisablePartialInvalidation, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Debug Features -->
<local:SettingContainer x:Name="DebugFeaturesEnabled"
x:Uid="Globals_DebugFeaturesEnabled"
Visibility="{x:Bind ViewModel.DebugFeaturesAvailable}">
<ToggleSwitch IsOn="{x:Bind ViewModel.DebugFeaturesEnabled, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Software Rendering -->
<local:SettingContainer x:Name="SoftwareRendering"
x:Uid="Globals_SoftwareRendering">
<ToggleSwitch IsOn="{x:Bind ViewModel.SoftwareRendering, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Reset Application State -->
<local:SettingContainer x:Name="ResetApplicationState"
x:Uid="Settings_ResetApplicationState">
<Button x:Uid="Settings_ResetApplicationStateButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>
<Flyout x:Name="ResetCacheFlyout"
FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
<StackPanel>
<TextBlock x:Uid="Settings_ResetApplicationStateConfirmationMessageHeader"
Style="{StaticResource CustomFlyoutTextStyle}" />
<TextBlock x:Uid="Settings_ResetApplicationStateConfirmationMessageBody"
FontWeight="Normal"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Settings_ResetApplicationStateConfirmationButton"
Click="ResetApplicationStateButton_Click" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingContainer>
<!-- Reset to Default Settings -->
<local:SettingContainer x:Name="ResetToDefaultSettings"
x:Uid="Settings_ResetToDefaultSettings">
<Button x:Uid="Settings_ResetToDefaultSettingsButton"
Style="{StaticResource DeleteButtonStyle}">
<Button.Flyout>
<Flyout FlyoutPresenterStyle="{StaticResource CustomFlyoutPresenterStyle}">
<StackPanel>
<TextBlock x:Uid="Settings_ResetToDefaultSettingsConfirmationMessageHeader"
Style="{StaticResource CustomFlyoutTextStyle}" />
<TextBlock x:Uid="Settings_ResetToDefaultSettingsConfirmationMessageBody"
FontWeight="Normal"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Settings_ResetToDefaultSettingsConfirmationButton"
Click="{x:Bind ViewModel.ResetToDefaultSettings}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingContainer>
</StackPanel>
</Page>

View File

@@ -17,130 +17,11 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="CommonResources.xaml" />
</ResourceDictionary.MergedDictionaries>
<!-- Theme Dictionary -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Button">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<!-- Override visual states -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- Define the appearance of the button -->
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource SystemControlHighlightAccentRevealBackgroundBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed" />
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="Light">
<!-- KeyChordText styles -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Button">
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="1" />
<Setter Property="Background" Value="{ThemeResource SystemAltMediumLowColor}" />
<Setter Property="BorderBrush" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
<!-- Override visual states -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<!-- Define the appearance of the button -->
<Border x:Name="border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}">
<ContentPresenter HorizontalAlignment="Center"
VerticalAlignment="Center" />
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="border"
Storyboard.TargetProperty="Background">
<DiscreteObjectKeyFrame KeyTime="0"
Value="{ThemeResource SystemControlHighlightAccentRevealBackgroundBrush}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed" />
<VisualState x:Name="Disabled" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock">
<Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseMediumBrush}" />
</Style>
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<!-- KeyChordText styles (use XAML defaults for High Contrast theme) -->
<Style x:Key="KeyChordBorderStyle"
TargetType="Button" />
<Style x:Key="KeyChordTextBlockStyle"
TargetType="TextBlock" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<GridLength x:Key="ArgumentNameWidth">148</GridLength>
<!-- Styles -->
<Style x:Key="KeyBindingContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="Padding" Value="4" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="XYFocusKeyboardNavigation" Value="Enabled" />
</Style>
<Style x:Key="KeyChordEditorStyle"
TargetType="local:KeyChordListener">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
<x:Int32 x:Key="EditButtonSize">32</x:Int32>
<x:Double x:Key="EditButtonIconSize">14</x:Double>
<Style x:Key="EditButtonStyle"
BasedOn="{StaticResource DefaultButtonStyle}"
TargetType="Button">
@@ -149,6 +30,7 @@
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<Style x:Key="AccentEditButtonStyle"
BasedOn="{StaticResource AccentButtonStyle}"
TargetType="Button">
@@ -157,42 +39,63 @@
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<Style x:Key="TextBlockGroupingStyle"
BasedOn="{StaticResource BodyStrongTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="MaxWidth" Value="{StaticResource StandardControlMaxWidth}" />
<Setter Property="Margin" Value="0,0,0,4" />
<Setter Property="FontSize" Value="16" />
<Style x:Key="KeyChordEditorStyle"
TargetType="local:KeyChordListener">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="MinWidth" Value="160" />
</Style>
<!-- Templates -->
<!--
Item container for the per-chord ListView. We're hosting a SettingContainer
inside each item, so strip the default ListViewItem visuals (padding, border,
hover/selection background) so they don't double up.
-->
<Style x:Key="KeyChordListViewItemStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="Padding" Value="0" />
<Setter Property="Margin" Value="0" />
<Setter Property="MinHeight" Value="0" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderThickness" Value="0" />
</Style>
<!-- "Key Binding #N" template -->
<DataTemplate x:Key="KeyChordTemplate"
x:DataType="local:KeyChordViewModel">
<ListViewItem IsTabStop="False"
Style="{StaticResource KeyBindingContainerStyle}">
<Grid Padding="-4,0,0,0"
VerticalAlignment="Center">
<local:SettingContainer Header="{x:Bind DisplayLabel, Mode=OneWay}">
<Grid VerticalAlignment="Center"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<!-- Key visual / key chord listener -->
<ColumnDefinition Width="Auto" />
<!-- Cancel button (visible only in edit mode) -->
<ColumnDefinition Width="Auto" />
<!-- Accept button (visible only in edit mode) -->
<ColumnDefinition Width="Auto" />
<!-- Edit (pencil) button (visible only NOT in edit mode) -->
<ColumnDefinition Width="Auto" />
<!-- Delete button -->
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0"
Background="{ThemeResource AppBarItemBackgroundThemeBrush}"
Click="{x:Bind ToggleEditMode}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}">
<TextBlock FontSize="14"
Text="{x:Bind KeyChordText, Mode=OneWay}"
TextWrapping="WrapWholeWords" />
</Button>
<!-- Read-only key chord visual -->
<local:KeyChordVisual Grid.Column="0"
KeyChord="{x:Bind CurrentKeys, Mode=OneWay}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}" />
<!-- Editable key chord listener -->
<local:KeyChordListener Grid.Column="0"
Keys="{x:Bind ProposedKeys, Mode=TwoWay}"
Style="{StaticResource KeyChordEditorStyle}"
Visibility="{x:Bind IsInEditMode, Mode=OneWay}" />
<!-- Cancel changes (edit mode only) -->
<Button x:Uid="Actions_CancelButton"
Grid.Column="1"
Margin="8,0,0,0"
AutomationProperties.Name="{x:Bind CancelButtonName}"
Click="{x:Bind CancelChanges}"
Style="{StaticResource EditButtonStyle}"
@@ -201,9 +104,9 @@
Glyph="&#xE711;" />
</Button>
<!-- Accept changes (edit mode only) -->
<Button x:Uid="Actions_AcceptButton"
Grid.Column="2"
Margin="8,0,8,0"
AutomationProperties.Name="{x:Bind AcceptButtonName}"
Click="{x:Bind AcceptChanges}"
Flyout="{x:Bind AcceptChangesFlyout, Mode=OneWay}"
@@ -213,8 +116,19 @@
Glyph="&#xE8FB;" />
</Button>
<Button Grid.Column="3"
HorizontalAlignment="Left"
<!-- Edit button -->
<Button x:Uid="Actions_EditButton"
Grid.Column="3"
AutomationProperties.Name="{x:Bind EditButtonName}"
Click="{x:Bind ToggleEditMode}"
Style="{StaticResource EditButtonStyle}"
Visibility="{x:Bind mtu:Converters.InvertedBooleanToVisibility(IsInEditMode), Mode=OneWay}">
<FontIcon FontSize="{StaticResource EditButtonIconSize}"
Glyph="&#xE70F;" />
</Button>
<!-- Delete button -->
<Button Grid.Column="4"
AutomationProperties.Name="{x:Bind DeleteButtonName}"
Style="{StaticResource DeleteSmallButtonStyle}">
<Button.Content>
@@ -233,25 +147,23 @@
</Button.Flyout>
</Button>
</Grid>
</ListViewItem>
</local:SettingContainer>
</DataTemplate>
<!--
BODGY: Each ArgWrapper DataTemplate below wraps its editor control
in a <local:SettingContainer Header="{x:Bind Name}"> rather than sharing a
single outer template. This is because a bug in WinUI 2 prevents a
ContentPresenter + ContentTemplateSelector pattern from working correctly,
resulting in "Microsoft.Terminal.Settings.Editor.ArgWrapper" being shown.
-->
<!-- Example shortcut action to test this template: Adjust Opacity -->
<!-- Currently that is the only Int32 arg, so just clamp the min/max values according to that -->
<DataTemplate x:Key="Int32Template"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="100"
@@ -259,24 +171,14 @@
SmallChange="10"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxInt32(Value), Mode=TwoWay, BindBack=Int32BindBack}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Switch To Tab -->
<DataTemplate x:Key="UInt32Template"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -284,24 +186,14 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxUInt32(Value), Mode=TwoWay, BindBack=UInt32BindBack}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Close Other Tabs -->
<DataTemplate x:Key="UInt32OptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -309,24 +201,14 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxUInt32Optional(Value), Mode=TwoWay, BindBack=UInt32OptionalBindBack}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="Int32OptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -334,24 +216,14 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxInt32Optional(Value), Mode=TwoWay, BindBack=Int32OptionalBindBack}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Adjust Font Size -->
<DataTemplate x:Key="FloatTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -359,24 +231,14 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="SplitSizeTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<muxc:NumberBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="0.2"
Maximum="1"
@@ -384,144 +246,95 @@
SmallChange="0.1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Send Input -->
<DataTemplate x:Key="StringTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*"
MinWidth="196" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<TextBox Grid.Column="1"
<local:SettingContainer Header="{x:Bind Name}">
<TextBox MinWidth="248"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Color Scheme -->
<DataTemplate x:Key="ColorSchemeTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ComboBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<ComboBox MinWidth="248"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind EnumList, Mode=OneWay}"
SelectedItem="{x:Bind EnumValue, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Export Buffer -->
<DataTemplate x:Key="FilePickerTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*"
MinWidth="196" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<TextBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
<Button x:Uid="Actions_Browse"
Grid.Column="2"
Click="{x:Bind BrowseForFile_Click}"
Style="{StaticResource BrowseButtonStyle}" />
</Grid>
<local:SettingContainer Header="{x:Bind Name}">
<Grid ColumnSpacing="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"
MinWidth="196" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
<Button x:Uid="Actions_Browse"
Grid.Column="1"
Click="{x:Bind BrowseForFile_Click}"
Style="{StaticResource BrowseButtonStyle}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: New Tab -->
<DataTemplate x:Key="FolderPickerTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*"
MinWidth="196" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<TextBox Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
<Button x:Uid="Actions_Browse"
Grid.Column="2"
Click="{x:Bind BrowseForFolder_Click}"
Style="{StaticResource BrowseButtonStyle}" />
</Grid>
<local:SettingContainer Header="{x:Bind Name}">
<Grid ColumnSpacing="4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"
MinWidth="196" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
<Button x:Uid="Actions_Browse"
Grid.Column="1"
Click="{x:Bind BrowseForFolder_Click}"
Style="{StaticResource BrowseButtonStyle}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Focus Mode -->
<DataTemplate x:Key="BoolTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ToggleSwitch Grid.Column="1"
HorizontalAlignment="Left"
AutomationProperties.Name="{x:Bind Name}"
IsOn="{x:Bind UnboxBool(Value), Mode=TwoWay, BindBack=BoolOptionalBindBack}" />
</Grid>
<local:SettingContainer Header="{x:Bind Name}">
<ToggleSwitch AutomationProperties.Name="{x:Bind Name}"
IsOn="{x:Bind UnboxBool(Value), Mode=TwoWay, BindBack=BoolOptionalBindBack}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="BoolOptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<CheckBox Grid.Column="1"
HorizontalAlignment="Left"
AutomationProperties.Name="{x:Bind Name}"
<local:SettingContainer Header="{x:Bind Name}">
<CheckBox AutomationProperties.Name="{x:Bind Name}"
IsChecked="{x:Bind UnboxBoolOptional(Value), Mode=TwoWay, BindBack=BoolOptionalBindBack}"
IsThreeState="True" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Resize Pane -->
@@ -532,24 +345,14 @@
<DataTemplate x:Key="EnumTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ComboBox Grid.Column="1"
HorizontalAlignment="Stretch"
<local:SettingContainer Header="{x:Bind Name}">
<ComboBox MinWidth="248"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind EnumList, Mode=OneWay}"
SelectedItem="{x:Bind EnumValue, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Copy Text -->
@@ -572,66 +375,35 @@
<DataTemplate x:Key="FlagTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<ItemsControl Grid.Column="1"
Margin="0"
HorizontalAlignment="Left"
AutomationProperties.Name="{x:Bind Name}"
<local:SettingContainer Header="{x:Bind Name}">
<ItemsControl AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource FlagItemTemplate}"
ItemsSource="{x:Bind FlagList, Mode=OneWay}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Add Mark -->
<DataTemplate x:Key="TerminalCoreColorOptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<local:SettingContainer Header="{x:Bind Name}">
<local:NullableColorPicker x:Uid="Actions_NullableColorPicker"
Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
ColorSchemeVM="{x:Bind DefaultColorScheme, Mode=OneWay}"
CurrentColor="{x:Bind UnboxTerminalCoreColorOptional(Value), Mode=TwoWay, BindBack=TerminalCoreColorBindBack}"
NullColorPreview="{x:Bind DefaultColorScheme.ForegroundColor.Color, Mode=OneWay}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Tab Color -->
<DataTemplate x:Key="WindowsUIColorOptionalTemplate"
x:DataType="local:ArgWrapper">
<Grid Margin="0,4,0,4"
ColumnSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
VerticalAlignment="Center"
Text="{x:Bind Name}"
TextWrapping="WrapWholeWords" />
<local:SettingContainer Header="{x:Bind Name}">
<local:NullableColorPicker x:Uid="Actions_NullableColorPicker"
Grid.Column="1"
AutomationProperties.Name="{x:Bind Name}"
ColorSchemeVM="{x:Bind DefaultColorScheme, Mode=OneWay}"
CurrentColor="{x:Bind UnboxWindowsUIColorOptional(Value), Mode=TwoWay, BindBack=WindowsUIColorBindBack}"
NullColorPreview="{x:Bind DefaultColorScheme.ForegroundColor.Color, Mode=OneWay}" />
</Grid>
</local:SettingContainer>
</DataTemplate>
<local:ArgsTemplateSelectors x:Key="ArgsTemplateSelector"
@@ -655,122 +427,106 @@
</ResourceDictionary>
</Page.Resources>
<Border MaxWidth="{StaticResource StandardControlMaxWidth}"
Margin="{StaticResource SettingStackMargin}">
<Grid Margin="{StaticResource SettingStackMargin}"
HorizontalAlignment="Stretch">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock x:Uid="Actions_CommandDetails"
Grid.Row="0"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,12"
VerticalAlignment="Center"
Style="{StaticResource TextBlockGroupingStyle}" />
<TextBlock x:Uid="Actions_Name"
Grid.Row="1"
Grid.Column="0"
Margin="0,0,0,8"
VerticalAlignment="Center" />
<TextBox x:Name="CommandNameTextBox"
Grid.Row="1"
Grid.Column="1"
Margin="0,0,0,8"
HorizontalAlignment="Stretch"
AutomationProperties.Name="{x:Bind ViewModel.ActionNameTextBoxAutomationPropName}"
PlaceholderText="{x:Bind ViewModel.DisplayName, Mode=OneWay}"
Text="{x:Bind ViewModel.Name, Mode=TwoWay}" />
<TextBlock x:Uid="Actions_ShortcutAction"
Grid.Row="2"
Grid.Column="0"
Margin="0,0,0,12"
VerticalAlignment="Center" />
<AutoSuggestBox x:Name="ShortcutActionBox"
Grid.Row="2"
Grid.Column="1"
Margin="0,0,0,12"
VerticalAlignment="Center"
AutomationProperties.Name="{x:Bind ViewModel.ShortcutActionComboBoxAutomationPropName}"
GotFocus="ShortcutActionBox_GotFocus"
LostFocus="ShortcutActionBox_LostFocus"
QuerySubmitted="ShortcutActionBox_QuerySubmitted"
TextChanged="ShortcutActionBox_TextChanged" />
<TextBlock x:Uid="Actions_Keybindings"
Grid.Row="3"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,12"
VerticalAlignment="Center"
Style="{StaticResource TextBlockGroupingStyle}" />
<ListView x:Name="KeyChordListView"
x:Uid="Actions_KeyBindingsListView"
Grid.Row="4"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,12"
ItemTemplate="{StaticResource KeyChordTemplate}"
ItemsSource="{x:Bind ViewModel.KeyChordList, Mode=OneWay}"
SelectionMode="None">
<ListView.Footer>
<Button Margin="0,4,0,0"
Click="{x:Bind ViewModel.AddKeybinding_Click}">
<TextBlock x:Uid="Actions_AddKeyChord" />
</Button>
</ListView.Footer>
</ListView>
<TextBlock x:Uid="Actions_Arguments"
Grid.Row="5"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,12"
VerticalAlignment="Center"
Style="{StaticResource TextBlockGroupingStyle}"
Visibility="{x:Bind ViewModel.ActionArgsVM.HasArgs, Mode=OneWay}" />
<ItemsControl Grid.Row="6"
Grid.Column="0"
Grid.ColumnSpan="2"
Margin="0,0,0,12"
HorizontalAlignment="Stretch"
AutomationProperties.Name="{x:Bind ViewModel.AdditionalArgumentsControlAutomationPropName}"
IsTabStop="False"
ItemTemplateSelector="{StaticResource ArgsTemplateSelector}"
ItemsSource="{x:Bind ViewModel.ActionArgsVM.ArgValues, Mode=OneWay}" />
<Button Grid.Row="7"
Grid.Column="0"
IsEnabled="{x:Bind ViewModel.IsUserAction, Mode=OneWay}"
Style="{StaticResource DeleteButtonStyle}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE74D;" />
<TextBlock x:Uid="Actions_DeleteButton2"
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Actions_CommandDeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Actions_CommandDeleteConfirmationButton"
Click="{x:Bind ViewModel.Delete_Click}" />
<Border MaxWidth="{StaticResource StandardControlMaxWidth}">
<StackPanel HorizontalAlignment="Stretch"
Style="{StaticResource SettingsStackStyle}">
<!-- Action type (top-most setting on the page) -->
<local:SettingContainer x:Name="ActionType"
x:Uid="EditAction_ActionType">
<AutoSuggestBox x:Name="ShortcutActionBox"
MinWidth="248"
AutomationProperties.Name="{x:Bind ViewModel.ShortcutActionComboBoxAutomationPropName}"
GotFocus="ShortcutActionBox_GotFocus"
LostFocus="ShortcutActionBox_LostFocus"
QuerySubmitted="ShortcutActionBox_QuerySubmitted"
TextChanged="ShortcutActionBox_TextChanged" />
</local:SettingContainer>
<!-- Key bindings expander -->
<local:SettingContainer x:Name="KeyBindingsContainer"
x:Uid="EditAction_KeyBindings"
StartExpanded="{x:Bind mtu:Converters.InvertBoolean(ViewModel.HasNoKeyChords), Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<StackPanel>
<!-- "New key binding" button -->
<local:SettingContainer x:Name="NewKeyBinding"
x:Uid="EditAction_NewKeyBinding">
<Button x:Uid="EditAction_AddKeyBinding"
Click="{x:Bind ViewModel.AddKeybinding_Click}"
Style="{StaticResource AccentButtonStyle}" />
</local:SettingContainer>
<!-- Existing key bindings, one container per chord -->
<ListView x:Name="KeyChordListView"
x:Uid="Actions_KeyBindingsListView"
HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
IsItemClickEnabled="False"
ItemContainerStyle="{StaticResource KeyChordListViewItemStyle}"
ItemTemplate="{StaticResource KeyChordTemplate}"
ItemsSource="{x:Bind ViewModel.KeyChordList, Mode=OneWay}"
SelectionMode="None" />
</StackPanel>
</local:SettingContainer>
<!-- Additional customizations expander -->
<local:SettingContainer x:Name="AdditionalCustomizations"
x:Uid="EditAction_AdditionalCustomizations"
Style="{StaticResource ExpanderSettingContainerStyle}">
<StackPanel>
<!-- Action name -->
<local:SettingContainer x:Name="ActionName"
x:Uid="EditAction_ActionName">
<TextBox x:Name="CommandNameTextBox"
MinWidth="248"
AutomationProperties.Name="{x:Bind ViewModel.ActionNameTextBoxAutomationPropName}"
PlaceholderText="{x:Bind ViewModel.DisplayName, Mode=OneWay}"
Text="{x:Bind ViewModel.Name, Mode=TwoWay}" />
</local:SettingContainer>
<!-- Action argument controls -->
<ItemsControl HorizontalAlignment="Stretch"
HorizontalContentAlignment="Stretch"
AutomationProperties.Name="{x:Bind ViewModel.AdditionalArgumentsControlAutomationPropName}"
IsTabStop="False"
ItemTemplateSelector="{StaticResource ArgsTemplateSelector}"
ItemsSource="{x:Bind ViewModel.ActionArgsVM.ArgValues, Mode=OneWay}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel HorizontalAlignment="Stretch" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
</ItemsControl>
</StackPanel>
</local:SettingContainer>
<!-- Delete command button -->
<local:SettingContainer x:Name="DeleteCommand"
x:Uid="EditAction_DeleteCommand">
<Button IsEnabled="{x:Bind ViewModel.IsUserAction, Mode=OneWay}"
Style="{StaticResource DeleteButtonStyle}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="{StaticResource StandardIconSize}"
Glyph="&#xE74D;" />
<TextBlock x:Uid="Actions_DeleteButton2"
Style="{StaticResource IconButtonTextBlockStyle}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</Button.Content>
<Button.Flyout>
<Flyout>
<StackPanel>
<TextBlock x:Uid="Actions_CommandDeleteConfirmationMessage"
Style="{StaticResource CustomFlyoutTextStyle}" />
<Button x:Uid="Actions_CommandDeleteConfirmationButton"
Click="{x:Bind ViewModel.Delete_Click}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingContainer>
</StackPanel>
</Border>
</Page>

View File

@@ -27,126 +27,164 @@
</Page.Resources>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Theme -->
<local:SettingContainer x:Name="Theme"
x:Uid="Globals_Theme">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemsSource="{x:Bind ViewModel.ThemeList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentTheme, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="model:Theme">
<TextBlock Text="{x:Bind local:GlobalAppearanceViewModel.ThemeNameConverter((model:Theme)), Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<!-- Section: Visual style -->
<local:SettingContainer x:Uid="Globals_Section_VisualStyle"
StartExpanded="True"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Theme -->
<local:SettingContainer x:Name="Theme"
x:Uid="Globals_Theme">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemsSource="{x:Bind ViewModel.ThemeList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentTheme, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}">
<ComboBox.ItemTemplate>
<DataTemplate x:DataType="model:Theme">
<TextBlock Text="{x:Bind local:GlobalAppearanceViewModel.ThemeNameConverter((model:Theme)), Mode=OneWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</local:SettingContainer>
<!-- Show Acrylic in Tab Row -->
<local:SettingContainer x:Name="AcrylicTabRow"
x:Uid="Globals_AcrylicTabRow">
<ToggleSwitch IsOn="{x:Bind ViewModel.UseAcrylicInTabRow, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Unfocused Acrylic -->
<local:SettingContainer x:Name="EnableUnfocusedAcrylic"
x:Uid="Globals_EnableUnfocusedAcrylic">
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableUnfocusedAcrylic, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Disable Animations -->
<!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. -->
<local:SettingContainer x:Name="DisableAnimations"
x:Uid="Globals_DisableAnimationsReversed">
<ToggleSwitch IsOn="{x:Bind ViewModel.InvertedDisableAnimations, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show pane headers -->
<local:SettingContainer x:Name="ShowPaneHeaders"
x:Uid="Globals_ShowPaneHeaders">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowPaneHeaders, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Position of new tab -->
<local:SettingContainer x:Name="NewTabPosition"
x:Uid="Globals_NewTabPosition">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.NewTabPositionList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentNewTabPosition, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
<!-- Section: Tabs and layout -->
<local:SettingContainer x:Uid="Globals_Section_TabsLayout"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Position of new tab -->
<local:SettingContainer x:Name="NewTabPosition"
x:Uid="Globals_NewTabPosition">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.NewTabPositionList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentNewTabPosition, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Always show tabs -->
<local:SettingContainer x:Name="AlwaysShowTabs"
x:Uid="Globals_AlwaysShowTabs">
<ToggleSwitch IsEnabled="{x:Bind mtu:Converters.InvertBoolean(ViewModel.ShowTabsInTitlebar), Mode=OneWay}"
IsOn="{x:Bind ViewModel.AlwaysShowTabs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show tabs in full screen -->
<local:SettingContainer x:Name="ShowTabsFullscreen"
x:Uid="Globals_ShowTabsFullscreen">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTabsFullscreen, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Tab Width Mode -->
<local:SettingContainer x:Name="TabWidthMode"
x:Uid="Globals_TabWidthMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TabWidthModeList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentTabWidthMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Show Titlebar -->
<local:SettingContainer x:Name="ShowTitlebar"
x:Uid="Globals_ShowTitlebar">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTabsInTitlebar, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}"
Toggled="{x:Bind ViewModel.ShowTitlebarToggled}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Show Titlebar -->
<local:SettingContainer x:Name="ShowTitlebar"
x:Uid="Globals_ShowTitlebar">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTabsInTitlebar, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}"
Toggled="{x:Bind ViewModel.ShowTitlebarToggled}" />
<!-- Section: Window behavior -->
<local:SettingContainer x:Uid="Globals_Section_WindowBehavior"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Always on Top -->
<local:SettingContainer x:Name="AlwaysOnTop"
x:Uid="Globals_AlwaysOnTop">
<ToggleSwitch IsOn="{x:Bind ViewModel.AlwaysOnTop, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Automatically hide window -->
<local:SettingContainer x:Name="AutoHideWindow"
x:Uid="Globals_AutoHideWindow">
<ToggleSwitch IsOn="{x:Bind ViewModel.AutoHideWindow, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Always show tabs -->
<local:SettingContainer x:Name="AlwaysShowTabs"
x:Uid="Globals_AlwaysShowTabs">
<ToggleSwitch IsEnabled="{x:Bind mtu:Converters.InvertBoolean(ViewModel.ShowTabsInTitlebar), Mode=OneWay}"
IsOn="{x:Bind ViewModel.AlwaysShowTabs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Section: Title bar & identity -->
<local:SettingContainer x:Uid="Globals_Section_TitleBarIdentity"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Show Title in Titlebar (use active terminal title as application title) -->
<local:SettingContainer x:Name="ShowTitleInTitlebar"
x:Uid="Globals_ShowTitleInTitlebar">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTitleInTitlebar, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Admin Shield -->
<local:SettingContainer x:Name="ShowAdminShield"
x:Uid="Globals_ShowAdminShield">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowAdminShield, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Show tabs in full screen -->
<local:SettingContainer x:Name="ShowTabsFullscreen"
x:Uid="Globals_ShowTabsFullscreen">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTabsFullscreen, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Section: System integration & notifications -->
<local:SettingContainer x:Uid="Globals_Section_SystemIntegration"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Always Show Notification Icon -->
<local:SettingContainer x:Name="AlwaysShowNotificationIcon"
x:Uid="Globals_AlwaysShowNotificationIcon">
<ToggleSwitch IsOn="{x:Bind ViewModel.AlwaysShowNotificationIcon, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Acrylic in Tab Row -->
<local:SettingContainer x:Name="AcrylicTabRow"
x:Uid="Globals_AcrylicTabRow">
<ToggleSwitch IsOn="{x:Bind ViewModel.UseAcrylicInTabRow, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Title in Titlebar -->
<local:SettingContainer x:Name="ShowTitleInTitlebar"
x:Uid="Globals_ShowTitleInTitlebar">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowTitleInTitlebar, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Always on Top -->
<local:SettingContainer x:Name="AlwaysOnTop"
x:Uid="Globals_AlwaysOnTop">
<ToggleSwitch IsOn="{x:Bind ViewModel.AlwaysOnTop, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Tab Width Mode -->
<local:SettingContainer x:Name="TabWidthMode"
x:Uid="Globals_TabWidthMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TabWidthModeList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentTabWidthMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Disable Animations -->
<!-- NOTE: the UID is "DisablePaneAnimationsReversed" not "DisablePaneAnimations". See GH#9124 for more details. -->
<local:SettingContainer x:Name="DisableAnimations"
x:Uid="Globals_DisableAnimationsReversed">
<ToggleSwitch IsOn="{x:Bind ViewModel.InvertedDisableAnimations, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Always Show Notification Icon -->
<local:SettingContainer x:Name="AlwaysShowNotificationIcon"
x:Uid="Globals_AlwaysShowNotificationIcon">
<ToggleSwitch IsOn="{x:Bind ViewModel.AlwaysShowNotificationIcon, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Minimize To Notification Area -->
<local:SettingContainer x:Name="MinimizeToNotificationArea"
x:Uid="Globals_MinimizeToNotificationArea">
<ToggleSwitch IsOn="{x:Bind ViewModel.MinimizeToNotificationArea, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Automatically hide window -->
<local:SettingContainer x:Name="AutoHideWindow"
x:Uid="Globals_AutoHideWindow">
<ToggleSwitch IsOn="{x:Bind ViewModel.AutoHideWindow, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Show Admin Shield -->
<local:SettingContainer x:Name="ShowAdminShield"
x:Uid="Globals_ShowAdminShield">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowAdminShield, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Unfocused Acrylic -->
<local:SettingContainer x:Name="EnableUnfocusedAcrylic"
x:Uid="Globals_EnableUnfocusedAcrylic">
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableUnfocusedAcrylic, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Minimize To Notification Area -->
<local:SettingContainer x:Name="MinimizeToNotificationArea"
x:Uid="Globals_MinimizeToNotificationArea">
<ToggleSwitch IsOn="{x:Bind ViewModel.MinimizeToNotificationArea, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
</StackPanel>
</Page>

View File

@@ -33,6 +33,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, AlwaysShowTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsFullscreen);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowPaneHeaders);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTabsInTitlebar);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, UseAcrylicInTabRow);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ShowTitleInTitlebar);

View File

@@ -27,6 +27,7 @@ namespace Microsoft.Terminal.Settings.Editor
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, AlwaysShowTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ShowTabsFullscreen);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ShowPaneHeaders);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ShowTabsInTitlebar);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, UseAcrylicInTabRow);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ShowTitleInTitlebar);

View File

@@ -26,146 +26,179 @@
<StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Copy On Select -->
<local:SettingContainer x:Name="CopyOnSelect"
x:Uid="Globals_CopyOnSelect">
<ToggleSwitch IsOn="{x:Bind ViewModel.CopyOnSelect, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Section: Clipboard and paste behavior -->
<local:SettingContainer x:Uid="Interaction_Section_Clipboard"
StartExpanded="True"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Copy On Select -->
<local:SettingContainer x:Name="CopyOnSelect"
x:Uid="Globals_CopyOnSelect">
<ToggleSwitch IsOn="{x:Bind ViewModel.CopyOnSelect, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Trim Paste -->
<local:SettingContainer x:Name="TrimPaste"
x:Uid="Globals_TrimPaste">
<ToggleSwitch IsOn="{x:Bind ViewModel.TrimPaste, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Trim Block Selection -->
<local:SettingContainer x:Name="TrimBlockSelection"
x:Uid="Globals_TrimBlockSelection">
<ToggleSwitch IsOn="{x:Bind ViewModel.TrimBlockSelection, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Copy Format -->
<local:SettingContainer x:Name="CopyFormat"
x:Uid="Globals_CopyFormat">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentCopyFormat, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Copy Format -->
<local:SettingContainer x:Name="CopyFormat"
x:Uid="Globals_CopyFormat">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.CopyFormatList, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.CurrentCopyFormat, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
<!-- Section: Text selection & editing -->
<local:SettingContainer x:Uid="Interaction_Section_TextSelection"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Word Delimiters -->
<local:SettingContainer x:Name="WordDelimiters"
x:Uid="Globals_WordDelimiters"
CurrentValue="{x:Bind ViewModel.WordDelimiters, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<TextBox IsSpellCheckEnabled="False"
Style="{StaticResource TextBoxSettingStyle}"
Text="{x:Bind ViewModel.WordDelimiters, Mode=TwoWay}" />
</local:SettingContainer>
<!-- Enable Color Selection -->
<local:SettingContainer x:Name="EnableColorSelection"
x:Uid="Globals_EnableColorSelection">
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableColorSelection, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Trim Block Selection -->
<local:SettingContainer x:Name="TrimBlockSelection"
x:Uid="Globals_TrimBlockSelection">
<ToggleSwitch IsOn="{x:Bind ViewModel.TrimBlockSelection, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Section: Window and layout behavior -->
<local:SettingContainer x:Uid="Interaction_Section_WindowLayout"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Snap On Resize -->
<local:SettingContainer x:Name="SnapToGridOnResize"
x:Uid="Globals_SnapToGridOnResize">
<ToggleSwitch IsOn="{x:Bind ViewModel.SnapToGridOnResize, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Focus Follow Mouse Mode -->
<local:SettingContainer x:Name="FocusFollowMouse"
x:Uid="Globals_FocusFollowMouse">
<ToggleSwitch IsOn="{x:Bind ViewModel.FocusFollowMouse, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Tab Switcher Mode -->
<local:SettingContainer x:Name="TabSwitcherMode"
x:Uid="Globals_TabSwitcherMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TabSwitcherModeList}"
SelectedItem="{x:Bind ViewModel.CurrentTabSwitcherMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Trim Paste -->
<local:SettingContainer x:Name="TrimPaste"
x:Uid="Globals_TrimPaste">
<ToggleSwitch IsOn="{x:Bind ViewModel.TrimPaste, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Section: Mouse & scrolling -->
<local:SettingContainer x:Uid="Interaction_Section_MouseScrolling"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Enable Font Size Changes with Scrolling -->
<local:SettingContainer x:Name="ScrollToZoom"
x:Uid="Globals_ScrollToZoom">
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToZoom, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Window Opacity Changes with Scrolling -->
<local:SettingContainer x:Name="ScrollToChangeOpacity"
x:Uid="Globals_ScrollToChangeOpacity">
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToChangeOpacity, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Word Delimiters -->
<local:SettingContainer x:Name="WordDelimiters"
x:Uid="Globals_WordDelimiters"
CurrentValue="{x:Bind ViewModel.WordDelimiters, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<TextBox IsSpellCheckEnabled="False"
Style="{StaticResource TextBoxSettingStyle}"
Text="{x:Bind ViewModel.WordDelimiters, Mode=TwoWay}" />
<!-- Section: URLs & external actions -->
<local:SettingContainer x:Uid="Interaction_Section_UrlsExternal"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Detect URLs -->
<local:SettingContainer x:Name="DetectURLs"
x:Uid="Globals_DetectURLs">
<ToggleSwitch IsOn="{x:Bind ViewModel.DetectURLs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Search Web Default Query URL -->
<local:SettingContainer x:Name="SearchWebDefaultQueryUrl"
x:Uid="Globals_SearchWebDefaultQueryUrl"
CurrentValue="{x:Bind ViewModel.SearchWebDefaultQueryUrl, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<TextBox IsSpellCheckEnabled="False"
Style="{StaticResource TextBoxSettingStyle}"
Text="{x:Bind ViewModel.SearchWebDefaultQueryUrl, Mode=TwoWay}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Snap On Resize -->
<local:SettingContainer x:Name="SnapToGridOnResize"
x:Uid="Globals_SnapToGridOnResize">
<ToggleSwitch IsOn="{x:Bind ViewModel.SnapToGridOnResize, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
<!-- Section: Warnings -->
<local:SettingContainer x:Uid="Interaction_Section_Warnings"
Style="{StaticResource SectionExpanderStyle}">
<StackPanel>
<!-- Confirm Close On -->
<local:SettingContainer x:Name="ConfirmOnClose"
x:Uid="Globals_ConfirmOnClose">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.ConfirmOnCloseList}"
SelectedItem="{x:Bind ViewModel.CurrentConfirmOnClose, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Input Service Warning -->
<local:SettingContainer x:Name="InputServiceWarning"
x:Uid="Globals_InputServiceWarning">
<ToggleSwitch IsOn="{x:Bind ViewModel.InputServiceWarning, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Large Paste Warning -->
<local:SettingContainer x:Name="WarnAboutLargePaste"
x:Uid="Globals_WarnAboutLargePaste">
<ToggleSwitch IsOn="{x:Bind ViewModel.WarnAboutLargePaste, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Multi Line Paste Warning -->
<local:SettingContainer x:Name="WarnAboutMultiLinePaste"
x:Uid="Globals_WarnAboutMultiLinePaste">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind WarnAboutMultiLinePasteList}"
SelectedItem="{x:Bind CurrentWarnAboutMultiLinePaste, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</StackPanel>
</local:SettingContainer>
<!-- Tab Switcher Mode -->
<local:SettingContainer x:Name="TabSwitcherMode"
x:Uid="Globals_TabSwitcherMode">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind ViewModel.TabSwitcherModeList}"
SelectedItem="{x:Bind ViewModel.CurrentTabSwitcherMode, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
<!-- Focus Follow Mouse Mode -->
<local:SettingContainer x:Name="FocusFollowMouse"
x:Uid="Globals_FocusFollowMouse">
<ToggleSwitch IsOn="{x:Bind ViewModel.FocusFollowMouse, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Font Size Changes with Scrolling -->
<local:SettingContainer x:Name="ScrollToZoom"
x:Uid="Globals_ScrollToZoom">
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToZoom, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Enable Window Opacity Changes with Scrolling -->
<local:SettingContainer x:Name="ScrollToChangeOpacity"
x:Uid="Globals_ScrollToChangeOpacity">
<ToggleSwitch IsOn="{x:Bind ViewModel.ScrollToChangeOpacity, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Detect URLs -->
<local:SettingContainer x:Name="DetectURLs"
x:Uid="Globals_DetectURLs">
<ToggleSwitch IsOn="{x:Bind ViewModel.DetectURLs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Search Web Default Query URL -->
<local:SettingContainer x:Name="SearchWebDefaultQueryUrl"
x:Uid="Globals_SearchWebDefaultQueryUrl"
CurrentValue="{x:Bind ViewModel.SearchWebDefaultQueryUrl, Mode=OneWay}"
Style="{StaticResource ExpanderSettingContainerStyle}">
<TextBox IsSpellCheckEnabled="False"
Style="{StaticResource TextBoxSettingStyle}"
Text="{x:Bind ViewModel.SearchWebDefaultQueryUrl, Mode=TwoWay}" />
</local:SettingContainer>
<!-- Enable Color Selection -->
<local:SettingContainer x:Name="EnableColorSelection"
x:Uid="Globals_EnableColorSelection">
<ToggleSwitch IsOn="{x:Bind ViewModel.EnableColorSelection, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
</StackPanel>
<StackPanel Style="{StaticResource SettingsStackStyle}">
<!-- Grouping: Warnings -->
<TextBlock x:Uid="Globals_WarningsHeader"
Style="{StaticResource TextBlockSubHeaderStyle}" />
<!-- Close All Tabs Warning -->
<local:SettingContainer x:Name="ConfirmCloseAllTabs"
x:Uid="Globals_ConfirmCloseAllTabs">
<ToggleSwitch IsOn="{x:Bind ViewModel.ConfirmCloseAllTabs, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Input Service Warning -->
<local:SettingContainer x:Name="InputServiceWarning"
x:Uid="Globals_InputServiceWarning">
<ToggleSwitch IsOn="{x:Bind ViewModel.InputServiceWarning, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Large Paste Warning -->
<local:SettingContainer x:Name="WarnAboutLargePaste"
x:Uid="Globals_WarnAboutLargePaste">
<ToggleSwitch IsOn="{x:Bind ViewModel.WarnAboutLargePaste, Mode=TwoWay}"
Style="{StaticResource ToggleSwitchInExpanderStyle}" />
</local:SettingContainer>
<!-- Multi Line Paste Warning -->
<local:SettingContainer x:Name="WarnAboutMultiLinePaste"
x:Uid="Globals_WarnAboutMultiLinePaste">
<ComboBox AutomationProperties.AccessibilityView="Content"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind WarnAboutMultiLinePasteList}"
SelectedItem="{x:Bind CurrentWarnAboutMultiLinePaste, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</StackPanel>
</StackPanel>
</Page>

View File

@@ -17,5 +17,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
INITIALIZE_BINDABLE_ENUM_SETTING(TabSwitcherMode, TabSwitcherMode, TabSwitcherMode, L"Globals_TabSwitcherMode", L"Content");
INITIALIZE_BINDABLE_ENUM_SETTING(CopyFormat, CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, L"Globals_CopyFormat", L"Content");
INITIALIZE_BINDABLE_ENUM_SETTING(ConfirmOnClose, ConfirmOnClose, Model::ConfirmOnClose, L"Globals_ConfirmOnClose", L"Content");
}
}

View File

@@ -19,6 +19,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
GETSET_BINDABLE_ENUM_SETTING(TabSwitcherMode, Model::TabSwitcherMode, _GlobalSettings.TabSwitcherMode);
GETSET_BINDABLE_ENUM_SETTING(CopyFormat, winrt::Microsoft::Terminal::Control::CopyFormat, _GlobalSettings.CopyFormatting);
GETSET_BINDABLE_ENUM_SETTING(ConfirmOnClose, Model::ConfirmOnClose, _GlobalSettings.ConfirmOnClose);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, CopyOnSelect);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, TrimBlockSelection);
@@ -30,7 +31,6 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, DetectURLs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, SearchWebDefaultQueryUrl);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WordDelimiters);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, ConfirmCloseAllTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, InputServiceWarning);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutLargePaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(_GlobalSettings, WarnAboutMultiLinePaste);

View File

@@ -12,10 +12,13 @@ namespace Microsoft.Terminal.Settings.Editor
InteractionViewModel(Microsoft.Terminal.Settings.Model.GlobalAppSettings globalSettings);
IInspectable CurrentTabSwitcherMode;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> TabSwitcherModeList { get; };
Windows.Foundation.Collections.IObservableVector<EnumEntry> TabSwitcherModeList { get; };
IInspectable CurrentCopyFormat;
Windows.Foundation.Collections.IObservableVector<Microsoft.Terminal.Settings.Editor.EnumEntry> CopyFormatList { get; };
Windows.Foundation.Collections.IObservableVector<EnumEntry> CopyFormatList { get; };
IInspectable CurrentConfirmOnClose;
Windows.Foundation.Collections.IObservableVector<EnumEntry> ConfirmOnCloseList { get; };
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, CopyOnSelect);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, TrimBlockSelection);
@@ -27,7 +30,6 @@ namespace Microsoft.Terminal.Settings.Editor
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, DetectURLs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, SearchWebDefaultQueryUrl);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(String, WordDelimiters);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, ConfirmCloseAllTabs);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, InputServiceWarning);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Boolean, WarnAboutLargePaste);
PERMANENT_OBSERVABLE_PROJECTED_SETTING(Microsoft.Terminal.Control.WarnAboutMultiLinePaste, WarnAboutMultiLinePaste);

View File

@@ -0,0 +1,131 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#include "pch.h"
#include "KeyChordVisual.h"
#include "KeyChordVisual.g.cpp"
using namespace winrt::Windows::UI::Xaml;
using namespace winrt::Windows::UI::Xaml::Controls;
using namespace winrt::Windows::Foundation;
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
DependencyProperty KeyChordVisual::_KeyChordProperty{ nullptr };
KeyChordVisual::KeyChordVisual()
{
InitializeComponent();
_InitializeProperties();
}
void KeyChordVisual::_InitializeProperties()
{
if (!_KeyChordProperty)
{
_KeyChordProperty =
DependencyProperty::Register(
L"KeyChord",
xaml_typename<Control::KeyChord>(),
xaml_typename<Editor::KeyChordVisual>(),
PropertyMetadata{ nullptr, PropertyChangedCallback{ &KeyChordVisual::_OnKeyChordChanged } });
}
}
void KeyChordVisual::_OnKeyChordChanged(const DependencyObject& d, const DependencyPropertyChangedEventArgs& /*e*/)
{
if (const auto control{ d.try_as<Editor::KeyChordVisual>() })
{
const auto controlImpl{ get_self<KeyChordVisual>(control) };
controlImpl->_UpdateKeyVisuals();
}
}
// Capitalizes the first character of the provided string.
// Examples: "enter" -> "Enter", "f1" -> "F1", "v" -> "V"
static winrt::hstring _formatMainKeyName(std::wstring_view part)
{
if (part.empty())
{
return {};
}
std::wstring buffer{ part };
buffer[0] = til::toupper_ascii(buffer[0]);
return winrt::hstring{ buffer };
}
void KeyChordVisual::_UpdateKeyVisuals()
{
auto panel{ KeysPanel() };
if (!panel)
{
return;
}
panel.Children().Clear();
const auto kc{ KeyChord() };
if (!kc)
{
return;
}
// Reuse the canonical serialization so the key naming stays in sync with the
// rest of the app. Then split on '+' (no key name in the table contains a literal
// '+'; VK_OEM_PLUS serializes as "plus") and render each part as its own visual.
const auto serialized{ Model::KeyChordSerialization::ToString(kc) };
if (serialized.empty())
{
return;
}
const std::wstring_view full{ serialized };
for (const auto part : til::split_iterator{ full, L'+' })
{
if (til::equals_insensitive_ascii(part, L"win"))
{
_AddGlyphKey();
}
else if (til::equals_insensitive_ascii(part, L"ctrl"))
{
_AddTextKey(L"Ctrl");
}
else if (til::equals_insensitive_ascii(part, L"alt"))
{
_AddTextKey(L"Alt");
}
else if (til::equals_insensitive_ascii(part, L"shift"))
{
_AddTextKey(L"Shift");
}
else
{
_AddTextKey(_formatMainKeyName(part));
}
}
}
void KeyChordVisual::_AddTextKey(const winrt::hstring& text)
{
const auto tmpl{ Resources().Lookup(box_value(L"KeyChordVisualTextKeyTemplate")).as<DataTemplate>() };
const auto border{ tmpl.LoadContent().as<Border>() };
if (const auto tb{ border.Child().try_as<TextBlock>() })
{
tb.Text(text);
}
KeysPanel().Children().Append(border);
}
void KeyChordVisual::_AddGlyphKey()
{
const auto tmpl{ Resources().Lookup(box_value(L"KeyChordVisualWindowsKeyTemplate")).as<DataTemplate>() };
const auto border{ tmpl.LoadContent().as<Border>() };
// Provide an accessible name for the glyph since it has no text fallback.
if (const auto path{ border.Child() })
{
Automation::AutomationProperties::SetName(path, L"Win");
}
KeysPanel().Children().Append(border);
}
}

View File

@@ -0,0 +1,31 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
#pragma once
#include "KeyChordVisual.g.h"
#include "Utils.h"
namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
struct KeyChordVisual : KeyChordVisualT<KeyChordVisual>
{
public:
KeyChordVisual();
DEPENDENCY_PROPERTY(Control::KeyChord, KeyChord);
private:
static void _InitializeProperties();
static void _OnKeyChordChanged(const Windows::UI::Xaml::DependencyObject& d, const Windows::UI::Xaml::DependencyPropertyChangedEventArgs& e);
void _UpdateKeyVisuals();
void _AddTextKey(const winrt::hstring& text);
void _AddGlyphKey();
};
}
namespace winrt::Microsoft::Terminal::Settings::Editor::factory_implementation
{
BASIC_FACTORY(KeyChordVisual);
}

View File

@@ -0,0 +1,13 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
namespace Microsoft.Terminal.Settings.Editor
{
[default_interface] runtimeclass KeyChordVisual : Windows.UI.Xaml.Controls.UserControl
{
KeyChordVisual();
Microsoft.Terminal.Control.KeyChord KeyChord;
static Windows.UI.Xaml.DependencyProperty KeyChordProperty { get; };
}
}

View File

@@ -0,0 +1,82 @@
<!--
Copyright (c) Microsoft Corporation. All rights reserved. Licensed under
the MIT License. See LICENSE in the project root for license information.
-->
<UserControl x:Class="Microsoft.Terminal.Settings.Editor.KeyChordVisual"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
HorizontalAlignment="Right"
VerticalAlignment="Center"
IsTabStop="False"
mc:Ignorable="d">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="KeyChordVisualKeyBackground"
ResourceKey="AccentFillColorDefaultBrush" />
<StaticResource x:Key="KeyChordVisualKeyForeground"
ResourceKey="TextOnAccentFillColorPrimaryBrush" />
<StaticResource x:Key="KeyChordVisualKeyBorderBrush"
ResourceKey="AccentControlElevationBorderBrush" />
</ResourceDictionary>
<ResourceDictionary x:Key="HighContrast">
<StaticResource x:Key="KeyChordVisualKeyBackground"
ResourceKey="SystemColorButtonFaceColorBrush" />
<StaticResource x:Key="KeyChordVisualKeyForeground"
ResourceKey="SystemColorButtonTextColorBrush" />
<StaticResource x:Key="KeyChordVisualKeyBorderBrush"
ResourceKey="SystemColorButtonTextColorBrush" />
</ResourceDictionary>
</ResourceDictionary.ThemeDictionaries>
<Style x:Key="KeyChordVisualKeyBorderStyle"
TargetType="Border">
<Setter Property="MinWidth" Value="32" />
<Setter Property="MinHeight" Value="28" />
<Setter Property="Padding" Value="8,2,8,2" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="{ThemeResource KeyChordVisualKeyBackground}" />
<Setter Property="BorderBrush" Value="{ThemeResource KeyChordVisualKeyBorderBrush}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
</Style>
<Style x:Key="KeyChordVisualKeyTextStyle"
TargetType="TextBlock">
<Setter Property="FontSize" Value="13" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="TextAlignment" Value="Center" />
<Setter Property="Foreground" Value="{ThemeResource KeyChordVisualKeyForeground}" />
</Style>
<DataTemplate x:Key="KeyChordVisualTextKeyTemplate">
<Border Style="{StaticResource KeyChordVisualKeyBorderStyle}">
<TextBlock Style="{StaticResource KeyChordVisualKeyTextStyle}" />
</Border>
</DataTemplate>
<DataTemplate x:Key="KeyChordVisualWindowsKeyTemplate">
<Border Style="{StaticResource KeyChordVisualKeyBorderStyle}">
<Path Width="11"
Height="11"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Data="M9 20H0V11H9V20ZM20 20H11V11H20V20ZM9 9H0V0H9V9ZM20 9H11V0H20V9Z"
Fill="{ThemeResource KeyChordVisualKeyForeground}"
Stretch="Uniform" />
</Border>
</DataTemplate>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel x:Name="KeysPanel"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal"
Spacing="2" />
</UserControl>

Some files were not shown because too many files have changed in this diff Show More