Compare commits

..

7 Commits

Author SHA1 Message Date
Gordon Lam (SH)
31aba26780 ci(wtr): fix cargo build PowerShell script and add x86 triple mapping
Two fixes:
1. Replace splat-array invocation with explicit if/else branches.
   The splat was passing a malformed argument (cargo's clap reported
   'unexpected argument "-"').
2. Add 'x86' -> 'i686-pc-windows-msvc' case in the switch and include
   that target in RustInstaller's additionalTargets. The pipeline matrix
   builds x86 too, not just x64/arm64.

Also added a LASTEXITCODE check so cargo build failures surface
properly even with ErrorActionPreference set.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 11:22:47 +08:00
Gordon Lam (SH)
754fff6915 ci(wtr): drop cratesIoFeedOverride; let config.toml + CargoAuthenticate own the registry
Investigation of the failing build showed that RustInstaller's
cratesIoFeedOverride parameter injects an env-var registry named
'ms_crates_io' that CargoAuthenticate cannot discover (it scans config
files only), so the override registry stays unauthenticated and Azure
Artifacts returns 404 on its sparse-index endpoint:

  note: name of alternative registry [...sudo_public_cargo...] set to ms_crates_io
  error: failed to query replaced source registry 'crates-io'
  Caused by: config.json not found in registry

Fix: remove cratesIoFeedOverride. The registry + source replacement
already live in src/tools/wtr/.cargo/config.toml, which CargoAuthenticate
reads and tokens. Cargo's normal config-file resolution then picks up
the authenticated registry.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 10:55:30 +08:00
Gordon Lam (SH)
2bbdaf2e29 ci(wtr): add CargoAuthenticate@0 to issue Bearer token for Cargo feed
Mirrors microsoft/edit's 1ES Rust workflow. Without explicit auth,
Azure Artifacts returns 404 on the sparse index endpoint and cargo
reports 'config.json not found in registry'.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-11 07:49:57 +08:00
Gordon Lam (SH)
9905c7ba49 ci(wtr): move Rust step early, harden VC tools workaround for empty-folder case (DD-1541167)
- Move Rust install/build before vcpkg/nuget/Set-LatestVCToolsVersion so
  Rust pipeline validation is independent of C++ build env setup.
- Patch Set-LatestVCToolsVersion.ps1 to also detect empty/partial VC
  tools folders (package metadata advertises a version but the folder
  has no bin/). Falls back to scanning siblings for a directory whose
  bin subdir actually contains files. Hard-fail if none found.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-09 10:41:20 +08:00
Yeelam Gordon
c1453406f3 ci(wtr): default-enable Rust build for ADO smoke test
Flips enableRustBuild parameter default from false to true so the gated Rust steps run on this branch when no top-level pipeline forwards the parameter (none currently do).

Revert before merging to main.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-05-08 12:31:15 +08:00
Gordon Lam (SH)
2eb4b9036d Forgot to add the empty one 2026-05-07 17:57:51 +08:00
Gordon Lam (SH)
edcf2fabe7 Add testing on Cargo.toml 2026-05-07 17:56:58 +08:00
26 changed files with 3079 additions and 969 deletions

View File

@@ -21,6 +21,10 @@ parameters:
displayName: "Build Everything (Overrides all other build options)"
type: boolean
default: false
- name: enableRustBuild
displayName: "Build src/tools/wtr (requires RustInstaller extension + microsoft/Dart Azure Artifact feeds)"
type: boolean
default: true
- name: pgoBuildMode
type: string
default: None
@@ -166,6 +170,80 @@ jobs:
.\build\scripts\Generate-ThirdPartyNotices.ps1 -MarkdownNoticePath .\NOTICE.md -OutputPath .\src\cascadia\CascadiaPackage\NOTICE.html
displayName: Generate NOTICE.html from NOTICE.md
- ${{ if eq(parameters.enableRustBuild, true) }}:
# ────────────────────────────────────────────────────────────────────────
# Rust toolchain for src/tools/wtr (1ES-compliant pattern).
# Placed early — before vcpkg/nuget/VC-tools setup — so that Rust pipeline
# validation is independent of any C++ build environment problems.
#
# Pipeline lives at: https://microsoft.visualstudio.com/Dart/
# Reference for this pattern: microsoft/sudo (.pipelines/OneBranch.Common.yml)
#
# Compliance notes (per 1ES Rust workflow guidance):
# 1. Toolchain comes from the org-level `RustTools` Azure Artifact NuGet
# feed (already exists on `microsoft` ADO org; same feed used by
# microsoft/sudo, microsoft/vscode, microsoft/edit, microsoft/qdk).
# 2. Crates resolve through a project-level Azure Artifact Cargo feed
# named `Cargo` in microsoft/Dart (with crates.io upstream).
# 3. The Rust version uses the `ms-prod-X.YY` channel, pinned in
# `src/tools/wtr/rust-toolchain.toml`.
# 4. Component Governance scanning of Cargo.lock is auto-injected by
# 1ES PT (no extra task needed here).
#
# Prerequisites — until in place, leave `enableRustBuild` parameter false:
# - Azure Artifact Cargo feed `Cargo` exists in microsoft/Dart with
# `crates.io` upstream. (Project-scope, terminal team can create it.)
# - The CI account ("Project Collection Build Service (microsoft)") has
# at least Collaborator permission on the `RustTools` feed.
# ────────────────────────────────────────────────────────────────────────
- task: RustInstaller@1
displayName: Install Rust toolchain (MSRustup)
inputs:
rustVersion: ms-prod-1.93
toolchainFeed: https://pkgs.dev.azure.com/microsoft/_packaging/RustTools/nuget/v3/index.json
# NOTE: we deliberately do NOT set `cratesIoFeedOverride` here. That
# parameter injects an env-var registry override named `ms_crates_io`
# which CargoAuthenticate cannot see (it scans config files, not env
# vars), so the override registry ends up unauthenticated and Azure
# Artifacts returns 404 on its sparse-index endpoint.
# Instead, the registry + source replacement lives in
# src/tools/wtr/.cargo/config.toml — CargoAuthenticate@0 (next step)
# tokens it, and cargo's normal config-file resolution picks it up.
additionalTargets: 'x86_64-pc-windows-msvc i686-pc-windows-msvc aarch64-pc-windows-msvc'
# CargoAuthenticate issues a Bearer token (using System.AccessToken) for
# every Azure Artifacts Cargo feed referenced in the config file.
# Required: without it, Azure Artifacts returns 404 on the sparse index
# endpoint and cargo reports "config.json not found in registry".
# This is the canonical 1ES Rust auth pattern (mirrors microsoft/edit).
- task: CargoAuthenticate@0
displayName: Authenticate Cargo feeds
inputs:
configFile: src/tools/wtr/.cargo/config.toml
# Separate fetch step: some 1ES pools disable network during the build
# phase. Fetching upfront keeps `cargo build --frozen` fully offline.
- script: cargo fetch --manifest-path src/tools/wtr/Cargo.toml --locked
displayName: Fetch crates (offline-friendly)
- pwsh: |-
$ErrorActionPreference = 'Stop'
$triple = switch ('$(BuildPlatform)') {
'x64' { 'x86_64-pc-windows-msvc' }
'x86' { 'i686-pc-windows-msvc' }
'arm64' { 'aarch64-pc-windows-msvc' }
default { 'x86_64-pc-windows-msvc' }
}
$config = '$(BuildConfiguration)'
Write-Host "Building wtr for $triple ($config)"
if ($config -eq 'Release') {
cargo build --manifest-path src/tools/wtr/Cargo.toml --target $triple --frozen --release
} else {
cargo build --manifest-path src/tools/wtr/Cargo.toml --target $triple --frozen
}
if ($LASTEXITCODE -ne 0) { throw "cargo build failed with exit code $LASTEXITCODE" }
displayName: Build src/tools/wtr (Cargo)
- template: .\steps-install-vcpkg.yml
- template: .\steps-restore-nuget.yml

View File

@@ -10,13 +10,30 @@ $VCToolsRoot = Join-Path $VSRoot "VC\Tools\MSVC"
# differs from the version on the files themselves. We might as well check
# whether the version we just found _actually exists_ before we use it.
# We'll use whichever highest version exists.
#
# Some pool images report a package version (e.g. 14.44.35208) but ship only
# package metadata, not the actual toolchain — the version folder either
# doesn't exist or is empty. Detect both cases by also requiring a non-empty
# `bin` subdirectory (where cl.exe / link.exe live).
$PackageVCToolPath = Join-Path $VCToolsRoot $LatestVCToolsVersion
If ($Null -Eq (Get-Item $PackageVCToolPath -ErrorAction:Ignore)) {
$VCToolsVersions = Get-ChildItem $VCToolsRoot | ForEach-Object {
$PackageVCBinPath = Join-Path $PackageVCToolPath "bin"
$PackageIsValid = ($Null -Ne (Get-Item $PackageVCToolPath -ErrorAction:Ignore)) -And `
($Null -Ne (Get-Item $PackageVCBinPath -ErrorAction:Ignore))
If (-Not $PackageIsValid) {
$VCToolsVersions = Get-ChildItem $VCToolsRoot -Directory -ErrorAction:Ignore | Where-Object {
# Only consider directories that actually contain a populated `bin`.
$binDir = Join-Path $_.FullName "bin"
(Test-Path $binDir) -And ((Get-ChildItem $binDir -Recurse -File -ErrorAction:Ignore | Select-Object -First 1) -Ne $Null)
} | ForEach-Object {
[Version]$_.Name
} | Sort -Descending
$LatestActualVCToolsVersion = $VCToolsVersions | Select -First 1
If ($Null -Eq $LatestActualVCToolsVersion) {
Write-Error "No usable VC Tools installation found under $VCToolsRoot. Package version was $LatestVCToolsVersion. This typically indicates a partial/broken pool image (DD-1541167)."
Exit 1
}
If ([Version]$LatestVCToolsVersion -Ne $LatestActualVCToolsVersion) {
Write-Output "VC Tools Mismatch: Directory = $LatestActualVCToolsVersion, Package = $LatestVCToolsVersion"
$LatestVCToolsVersion = $LatestActualVCToolsVersion.ToString(3)

View File

@@ -24,6 +24,21 @@
<EntryPointProjectUniqueName>..\WindowsTerminal\WindowsTerminal.vcxproj</EntryPointProjectUniqueName>
<DebuggerType>NativeOnly</DebuggerType>
</PropertyGroup>
<!-- Map MSBuild Platform to Rust target triple for wtr.exe inclusion. -->
<PropertyGroup>
<WtrRustTarget Condition="'$(Platform)'=='x64'">x86_64-pc-windows-msvc</WtrRustTarget>
<WtrRustTarget Condition="'$(Platform)'=='ARM64'">aarch64-pc-windows-msvc</WtrRustTarget>
<WtrRustProfile Condition="'$(Configuration)'=='Debug'">debug</WtrRustProfile>
<WtrRustProfile Condition="'$(Configuration)'!='Debug'">release</WtrRustProfile>
</PropertyGroup>
<ItemGroup>
<Content Include="$(SolutionDir)src\tools\wtr\target\$(WtrRustTarget)\$(WtrRustProfile)\wtr.exe"
Condition="Exists('$(SolutionDir)src\tools\wtr\target\$(WtrRustTarget)\$(WtrRustProfile)\wtr.exe')">
<Link>wtr.exe</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<PropertyGroup Condition="!Exists('CascadiaPackage_TemporaryKey.pfx')">
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<AppxBundle>Never</AppxBundle>

View File

@@ -496,48 +496,12 @@
<value>第三方通知</value>
<comment>A hyperlink name for the Terminal's third-party notices</comment>
</data>
<data name="ConfirmCloseDialog_Cancel" xml:space="preserve">
<value>取消</value>
</data>
<data name="ConfirmCloseDialog_CloseAllTitle" xml:space="preserve">
<value>是否要关闭所有窗口?</value>
</data>
<data name="ConfirmCloseDialog_CloseAllPrimary" xml:space="preserve">
<value>全部关闭</value>
</data>
<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>

View File

@@ -7,9 +7,7 @@
#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
@@ -44,65 +42,4 @@ 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,8 +17,6 @@ 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,6 +8,7 @@
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>
@@ -16,116 +17,182 @@
<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="ActionRowItemContainerStyle"
<Style x:Key="KeyBindingContainerStyle"
BasedOn="{StaticResource DefaultListViewItemStyle}"
TargetType="ListViewItem">
<Setter Property="Padding" Value="{StaticResource SettingsCardPadding}" />
<Setter Property="MinHeight" Value="{StaticResource SettingsCardMinHeight}" />
<Setter Property="Margin" Value="{StaticResource SettingsCardItemMargin}" />
<Setter Property="Padding" Value="12,4,4,4" />
<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="ActionRowNameTextStyle"
<Style x:Key="KeyBindingNameTextBlockStyle"
BasedOn="{StaticResource BaseTextBlockStyle}"
TargetType="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="TextWrapping" Value="WrapWholeWords" />
</Style>
<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" />
<Style x:Key="KeyChordEditorStyle"
TargetType="local:KeyChordListener">
<Setter Property="HorizontalAlignment" Value="Right" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="Transparent" />
</Style>
<!--
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>
<!-- Converters & Misc. -->
<SolidColorBrush x:Key="ActionContainerBackgroundEditing"
Color="{ThemeResource SystemListMediumColor}" />
<SolidColorBrush x:Key="ActionContainerBackground"
Color="Transparent" />
<!-- 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">
<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>
<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>
<!-- 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>
<!-- 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>
</DataTemplate>
</ResourceDictionary>
</Page.Resources>
@@ -141,8 +208,7 @@
<!-- Add New Button -->
<Button x:Name="AddNewButton"
Margin="0,12,0,0"
Click="{x:Bind ViewModel.AddNewCommand}"
Style="{StaticResource AccentButtonStyle}">
Click="{x:Bind ViewModel.AddNewCommand}">
<Button.Content>
<StackPanel Orientation="Horizontal">
<FontIcon FontSize="{StaticResource StandardIconSize}"
@@ -155,42 +221,11 @@
<!-- 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}"
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>
ItemsSource="{x:Bind ViewModel.CommandList, Mode=OneWay}" />
</StackPanel>
</Border>
</Page>

View File

@@ -57,22 +57,13 @@ 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_self<KeyChordViewModel>(keys) };
kcVM->Index(idx++);
_RegisterKeyChordVMEvents(*kcVM);
keyChordVMs.push_back(*kcVM);
auto kcVM{ make<KeyChordViewModel>(keys) };
_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)
@@ -128,7 +119,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return _cachedDisplayName;
}
winrt::hstring CommandViewModel::Name() const noexcept
winrt::hstring CommandViewModel::Name()
{
return _command.HasName() ? _command.Name() : L"";
}
@@ -154,7 +145,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return result;
}
winrt::hstring CommandViewModel::FirstKeyChordText() const
winrt::hstring CommandViewModel::FirstKeyChordText()
{
if (_KeyChordList.Size() != 0)
{
@@ -163,21 +154,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return L"";
}
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
winrt::hstring CommandViewModel::AdditionalKeyChordCountText()
{
const auto size = _KeyChordList.Size();
if (size > 1)
@@ -187,7 +164,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return L"";
}
winrt::hstring CommandViewModel::AdditionalKeyChordTooltipText() const
winrt::hstring CommandViewModel::AdditionalKeyChordTooltipText()
{
const auto size = _KeyChordList.Size();
if (size <= 1)
@@ -206,12 +183,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
return winrt::hstring{ result };
}
winrt::hstring CommandViewModel::ID() const noexcept
winrt::hstring CommandViewModel::ID()
{
return _command.ID();
}
bool CommandViewModel::IsUserAction() const noexcept
bool CommandViewModel::IsUserAction()
{
return _command.Origin() == OriginTag::User;
}
@@ -229,40 +206,23 @@ 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);
}
// 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
winrt::hstring CommandViewModel::ActionNameTextBoxAutomationPropName()
{
return RS_(L"Actions_Name/Text");
}
winrt::hstring CommandViewModel::ShortcutActionComboBoxAutomationPropName() const
winrt::hstring CommandViewModel::ShortcutActionComboBoxAutomationPropName()
{
return RS_(L"Actions_ShortcutAction/Text");
}
winrt::hstring CommandViewModel::AdditionalArgumentsControlAutomationPropName() const
winrt::hstring CommandViewModel::AdditionalArgumentsControlAutomationPropName()
{
return RS_(L"Actions_Arguments/Text");
}
@@ -313,19 +273,6 @@ 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");
}
}
}
});
}
@@ -1118,21 +1065,12 @@ 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
@@ -1188,12 +1126,6 @@ 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,18 +69,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void Initialize();
winrt::hstring DisplayName();
winrt::hstring Name() const noexcept;
winrt::hstring Name();
void Name(const winrt::hstring& newName);
winrt::hstring DisplayNameAndKeyChordAutomationPropName();
winrt::hstring FirstKeyChordText() const;
Control::KeyChord FirstKeyChord() const noexcept;
bool HasNoKeyChords() const noexcept;
winrt::hstring AdditionalKeyChordCountText() const;
winrt::hstring AdditionalKeyChordTooltipText() const;
winrt::hstring FirstKeyChordText();
winrt::hstring AdditionalKeyChordCountText();
winrt::hstring AdditionalKeyChordTooltipText();
winrt::hstring ID() const noexcept;
bool IsUserAction() const noexcept;
winrt::hstring ID();
bool IsUserAction();
void Edit_Click();
til::typed_event<Editor::CommandViewModel, IInspectable> EditRequested;
@@ -91,9 +89,9 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
void AddKeybinding_Click();
// UIA text
winrt::hstring ActionNameTextBoxAutomationPropName() const;
winrt::hstring ShortcutActionComboBoxAutomationPropName() const;
winrt::hstring AdditionalArgumentsControlAutomationPropName() const;
winrt::hstring ActionNameTextBoxAutomationPropName();
winrt::hstring ShortcutActionComboBoxAutomationPropName();
winrt::hstring AdditionalArgumentsControlAutomationPropName();
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeRequested;
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateColorSchemeNamesRequested;
@@ -117,7 +115,6 @@ 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>
@@ -233,19 +230,15 @@ 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,8 +55,6 @@ 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; };
@@ -140,12 +138,9 @@ 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();
@@ -153,7 +148,6 @@ 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;

View File

@@ -17,11 +17,130 @@
<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">
@@ -30,7 +149,6 @@
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<Style x:Key="AccentEditButtonStyle"
BasedOn="{StaticResource AccentButtonStyle}"
TargetType="Button">
@@ -39,63 +157,42 @@
<Setter Property="Height" Value="{StaticResource EditButtonSize}" />
<Setter Property="Width" Value="{StaticResource EditButtonSize}" />
</Style>
<Style x:Key="KeyChordEditorStyle"
TargetType="local:KeyChordListener">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="MinWidth" Value="160" />
<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>
<!--
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 -->
<!-- Templates -->
<DataTemplate x:Key="KeyChordTemplate"
x:DataType="local:KeyChordViewModel">
<local:SettingContainer Header="{x:Bind DisplayLabel, Mode=OneWay}">
<Grid VerticalAlignment="Center"
ColumnSpacing="8">
<ListViewItem IsTabStop="False"
Style="{StaticResource KeyBindingContainerStyle}">
<Grid Padding="-4,0,0,0"
VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<!-- Key visual / key chord listener -->
<ColumnDefinition Width="{StaticResource ArgumentNameWidth}" />
<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>
<!-- 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 -->
<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>
<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}"
@@ -104,9 +201,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}"
@@ -116,19 +213,8 @@
Glyph="&#xE8FB;" />
</Button>
<!-- 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"
<Button Grid.Column="3"
HorizontalAlignment="Left"
AutomationProperties.Name="{x:Bind DeleteButtonName}"
Style="{StaticResource DeleteSmallButtonStyle}">
<Button.Content>
@@ -147,23 +233,25 @@
</Button.Flyout>
</Button>
</Grid>
</local:SettingContainer>
</ListViewItem>
</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">
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
<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"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="100"
@@ -171,14 +259,24 @@
SmallChange="10"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxInt32(Value), Mode=TwoWay, BindBack=Int32BindBack}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Switch To Tab -->
<DataTemplate x:Key="UInt32Template"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
<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"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -186,14 +284,24 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxUInt32(Value), Mode=TwoWay, BindBack=UInt32BindBack}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Close Other Tabs -->
<DataTemplate x:Key="UInt32OptionalTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
<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"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -201,14 +309,24 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxUInt32Optional(Value), Mode=TwoWay, BindBack=UInt32OptionalBindBack}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="Int32OptionalTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
<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"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -216,14 +334,24 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxInt32Optional(Value), Mode=TwoWay, BindBack=Int32OptionalBindBack}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Adjust Font Size -->
<DataTemplate x:Key="FloatTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
<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"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="1"
Maximum="999"
@@ -231,14 +359,24 @@
SmallChange="1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="SplitSizeTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<muxc:NumberBox MinWidth="160"
<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"
AutomationProperties.Name="{x:Bind Name}"
LargeChange="0.2"
Maximum="1"
@@ -246,95 +384,144 @@
SmallChange="0.1"
Style="{StaticResource NumberBoxSettingStyle}"
Value="{x:Bind UnboxFloat(Value), Mode=TwoWay, BindBack=FloatBindBack}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Send Input -->
<DataTemplate x:Key="StringTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<TextBox MinWidth="248"
<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"
AutomationProperties.Name="{x:Bind Name}"
Text="{x:Bind UnboxString(Value), Mode=TwoWay, BindBack=StringBindBack}"
TextWrapping="Wrap" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Color Scheme -->
<DataTemplate x:Key="ColorSchemeTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<ComboBox MinWidth="248"
<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"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind EnumList, Mode=OneWay}"
SelectedItem="{x:Bind EnumValue, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Export Buffer -->
<DataTemplate x:Key="FilePickerTemplate"
x:DataType="local:ArgWrapper">
<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>
<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>
</DataTemplate>
<!-- Example shortcut action to test this template: New Tab -->
<DataTemplate x:Key="FolderPickerTemplate"
x:DataType="local:ArgWrapper">
<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>
<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>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Focus Mode -->
<DataTemplate x:Key="BoolTemplate"
x:DataType="local:ArgWrapper">
<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>
<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>
</DataTemplate>
<!-- Example shortcut action to test this template: Split Pane -->
<DataTemplate x:Key="BoolOptionalTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<CheckBox AutomationProperties.Name="{x:Bind Name}"
<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}"
IsChecked="{x:Bind UnboxBoolOptional(Value), Mode=TwoWay, BindBack=BoolOptionalBindBack}"
IsThreeState="True" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Resize Pane -->
@@ -345,14 +532,24 @@
<DataTemplate x:Key="EnumTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<ComboBox MinWidth="248"
<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"
AutomationProperties.Name="{x:Bind Name}"
ItemTemplate="{StaticResource EnumComboBoxTemplate}"
ItemsSource="{x:Bind EnumList, Mode=OneWay}"
SelectedItem="{x:Bind EnumValue, Mode=TwoWay}"
Style="{StaticResource ComboBoxSettingStyle}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Copy Text -->
@@ -375,35 +572,66 @@
<DataTemplate x:Key="FlagTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<ItemsControl AutomationProperties.Name="{x:Bind Name}"
<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}"
ItemTemplate="{StaticResource FlagItemTemplate}"
ItemsSource="{x:Bind FlagList, Mode=OneWay}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Add Mark -->
<DataTemplate x:Key="TerminalCoreColorOptionalTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<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: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}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<!-- Example shortcut action to test this template: Set Tab Color -->
<DataTemplate x:Key="WindowsUIColorOptionalTemplate"
x:DataType="local:ArgWrapper">
<local:SettingContainer Header="{x:Bind Name}">
<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: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}" />
</local:SettingContainer>
</Grid>
</DataTemplate>
<local:ArgsTemplateSelectors x:Key="ArgsTemplateSelector"
@@ -427,106 +655,122 @@
</ResourceDictionary>
</Page.Resources>
<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}" />
<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}" />
</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}" />
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</local:SettingContainer>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</Border>
</Page>

View File

@@ -1,131 +0,0 @@
// 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

@@ -1,31 +0,0 @@
// 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

@@ -1,13 +0,0 @@
// 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

@@ -1,82 +0,0 @@
<!--
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>

View File

@@ -86,9 +86,6 @@
<ClInclude Include="KeyChordListener.h">
<DependentUpon>KeyChordListener.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="KeyChordVisual.h">
<DependentUpon>KeyChordVisual.xaml</DependentUpon>
</ClInclude>
<ClInclude Include="Launch.h">
<DependentUpon>Launch.xaml</DependentUpon>
</ClInclude>
@@ -219,9 +216,6 @@
<Page Include="KeyChordListener.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="KeyChordVisual.xaml">
<SubType>Designer</SubType>
</Page>
<Page Include="Launch.xaml">
<SubType>Designer</SubType>
</Page>
@@ -303,9 +297,6 @@
<ClCompile Include="KeyChordListener.cpp">
<DependentUpon>KeyChordListener.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="KeyChordVisual.cpp">
<DependentUpon>KeyChordVisual.xaml</DependentUpon>
</ClCompile>
<ClCompile Include="Launch.cpp">
<DependentUpon>Launch.xaml</DependentUpon>
</ClCompile>
@@ -436,10 +427,6 @@
<DependentUpon>KeyChordListener.xaml</DependentUpon>
<SubType>Code</SubType>
</Midl>
<Midl Include="KeyChordVisual.idl">
<DependentUpon>KeyChordVisual.xaml</DependentUpon>
<SubType>Code</SubType>
</Midl>
<Midl Include="Launch.idl">
<DependentUpon>Launch.xaml</DependentUpon>
<SubType>Code</SubType>

View File

@@ -54,7 +54,6 @@
<Page Include="SettingContainerStyle.xaml" />
<Page Include="AddProfile.xaml" />
<Page Include="KeyChordListener.xaml" />
<Page Include="KeyChordVisual.xaml" />
<Page Include="NullableColorPicker.xaml" />
<Page Include="IconPicker.xaml" />
<Page Include="NewTabMenu.xaml" />

View File

@@ -289,8 +289,8 @@
<comment>Header for a control to toggle whether the terminal should automatically detect URLs and make them clickable, or not.</comment>
</data>
<data name="Globals_SearchWebDefaultQueryUrl.Header" xml:space="preserve">
<value>Default URL to use for the "Search web" shortcut</value>
<comment>Header for a control to set the query URL when using the "search web" shortcut.</comment>
<value>Default URL to use for the "Search web" action</value>
<comment>Header for a control to set the query URL when using the "search web" action.</comment>
</data>
<data name="Globals_SearchWebDefaultQueryUrl.HelpText" xml:space="preserve">
<value>The placeholder "%s" will be replaced with the search query.</value>
@@ -590,7 +590,7 @@
<comment>Additional description for what the "force vt input" setting does. Presented near "Globals_ForceVTInput.Header".</comment>
</data>
<data name="Globals_AllowHeadless.HelpText" xml:space="preserve">
<value>This allows shortcuts such as Global Summon and Quake Mode shortcuts to work even when no windows are open.</value>
<value>This allows actions such as Global Summon and Quake Mode actions to work even when no windows are open.</value>
<comment>Additional description for what the "allow headless" setting does. Presented near "Globals_AllowHeadless.Header".</comment>
</data>
<data name="Globals_TabWidthMode.Header" xml:space="preserve">
@@ -682,12 +682,12 @@
<comment>Header for the "rendering" menu item. This navigates to a page that lets you see and modify settings related to the app's rendering of text in the terminal.</comment>
</data>
<data name="Nav_Actions.Content" xml:space="preserve">
<value>Shortcuts</value>
<comment>Header for the "shortcuts" menu item. This navigates to a page that lets you see the available keyboard shortcuts in the app. (Resource key kept as "Nav_Actions" for stability.)</comment>
<value>Actions</value>
<comment>Header for the "actions" menu item. This navigates to a page that lets you see the available commands in the app.</comment>
</data>
<data name="Nav_EditAction.Content" xml:space="preserve">
<value>Edit Shortcut...</value>
<comment>Header for the "edit shortcut" page. This is the page that lets you modify a specific command and its key bindings. (Resource key kept as "Nav_EditAction" for stability.)</comment>
<value>Edit Action...</value>
<comment>Header for the "edit action" page. This is the page that lets you modify a specific command and its key bindings.</comment>
</data>
<data name="Nav_Extensions.Content" xml:space="preserve">
<value>Extensions</value>
@@ -1766,28 +1766,28 @@
<comment>A description for what the delete unfocused appearance button does.</comment>
</data>
<data name="Actions_Disclaimer.Content" xml:space="preserve">
<value>Learn more about shortcuts</value>
<comment>Disclaimer presented at the top of the shortcuts page to redirect the user to documentation regarding keyboard shortcuts.</comment>
<value>Learn more about actions</value>
<comment>Disclaimer presented at the top of the actions page to redirect the user to documentation regarding actions.</comment>
</data>
<data name="Actions_DeleteButton2.Text" xml:space="preserve">
<value>Delete shortcut</value>
<comment>Button label that deletes the selected shortcut.</comment>
<value>Delete action</value>
<comment>Button label that deletes the selected action.</comment>
</data>
<data name="Actions_Name.Text" xml:space="preserve">
<value>Shortcut name</value>
<comment>Label for the text box that edits the shortcut name.</comment>
<value>Action name</value>
<comment>Label for the text box that edits the action name.</comment>
</data>
<data name="Actions_NameEntryBox.PlaceholderText" xml:space="preserve">
<value>Shortcut name</value>
<comment>Placeholder text for the text box where the user can edit the shortcut name.</comment>
<value>Action name</value>
<comment>Placeholder text for the text box where the user can edit the action name.</comment>
</data>
<data name="Actions_ShortcutAction.Text" xml:space="preserve">
<value>Shortcut type</value>
<comment>Label for the combo box that edits the shortcut type (which action runs when this shortcut is invoked).</comment>
<value>Action type</value>
<comment>Label for the combo box that edits the action type.</comment>
</data>
<data name="Actions_KeyBindingsListView.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Shortcuts</value>
<comment>Name for a control which contains the list of keyboard shortcuts for the current command.</comment>
<value>Keybindings</value>
<comment>Name for a control which contains the list of keybindings for the current command.</comment>
</data>
<data name="Actions_CommandDetails.Text" xml:space="preserve">
<value>Command details</value>
@@ -1798,44 +1798,44 @@
<comment>Label for the list of editable arguments for the currently selected action.</comment>
</data>
<data name="Actions_Keybindings.Text" xml:space="preserve">
<value>Shortcuts</value>
<comment>Label for the list of editable keyboard shortcuts for the current command.</comment>
<value>Keybindings</value>
<comment>Label for the list of editable keybindings for the current command.</comment>
</data>
<data name="Actions_AddKeyChord.Text" xml:space="preserve">
<value>Add shortcut</value>
<comment>Button label that adds a keyboard shortcut to the current action.</comment>
<value>Add keybinding</value>
<comment>Button label that adds a keybinding to the current action.</comment>
</data>
<data name="Actions_AdditionalKeyChords" xml:space="preserve">
<value>and {} more</value>
<comment>Text that will be read out by a screen reader indicating that additional keybindings exist for this command. {} will be replaced by the number of additional keybindings.</comment>
</data>
<data name="Actions_DeleteConfirmationButton.Content" xml:space="preserve">
<value>Yes, delete shortcut</value>
<comment>Button label that confirms deletion of a keyboard shortcut entry.</comment>
<value>Yes, delete key binding</value>
<comment>Button label that confirms deletion of a key binding entry.</comment>
</data>
<data name="Actions_DeleteConfirmationMessage.Text" xml:space="preserve">
<value>Are you sure you want to delete this shortcut?</value>
<comment>Confirmation message displayed when the user attempts to delete a keyboard shortcut entry.</comment>
<value>Are you sure you want to delete this key binding?</value>
<comment>Confirmation message displayed when the user attempts to delete a key binding entry.</comment>
</data>
<data name="Actions_CommandDeleteConfirmationButton.Content" xml:space="preserve">
<value>Yes, delete shortcut</value>
<comment>Button label that confirms deletion of a shortcut entry.</comment>
<value>Yes, delete action</value>
<comment>Button label that confirms deletion of an action.</comment>
</data>
<data name="Actions_CommandDeleteConfirmationMessage.Text" xml:space="preserve">
<value>Are you sure you want to delete this shortcut?</value>
<comment>Confirmation message displayed when the user attempts to delete a shortcut entry.</comment>
<value>Are you sure you want to delete this action?</value>
<comment>Confirmation message displayed when the user attempts to delete an action.</comment>
</data>
<data name="Actions_InvalidKeyChordMessage" xml:space="preserve">
<value>Invalid shortcut. Please enter a valid keyboard shortcut.</value>
<comment>Error message displayed when an invalid keyboard shortcut is input by the user.</comment>
<value>Invalid key chord. Please enter a valid key chord.</value>
<comment>Error message displayed when an invalid key chord is input by the user.</comment>
</data>
<data name="Actions_RenameConflictConfirmationAcceptButton" xml:space="preserve">
<value>Yes</value>
<comment>Button label that confirms the deletion of a conflicting key binding to allow the current key binding to be registered.</comment>
</data>
<data name="Actions_RenameConflictConfirmationMessage" xml:space="preserve">
<value>The provided shortcut is already being used by the following action:</value>
<comment>Error message displayed when a keyboard shortcut that is already in use is input by the user. The name of the conflicting shortcut is displayed after this message.</comment>
<value>The provided key chord is already being used by the following action:</value>
<comment>Error message displayed when a key chord that is already in use is input by the user. The name of the conflicting key chord is displayed after this message.</comment>
</data>
<data name="Actions_RenameConflictConfirmationQuestion" xml:space="preserve">
<value>Would you like to overwrite it?</value>
@@ -1862,60 +1862,12 @@
<comment>Text label for a button that can be used to begin making changes to a key binding entry.</comment>
</data>
<data name="Actions_AddNewTextBlock.Text" xml:space="preserve">
<value>Add new shortcut</value>
<comment>Button label that creates a new keyboard shortcut on the shortcuts page.</comment>
<value>Add new</value>
<comment>Button label that creates a new action on the actions page.</comment>
</data>
<data name="Actions_ViewAllKeyChordsButton.[using:Windows.UI.Xaml.Controls]ToolTipService.ToolTip" xml:space="preserve">
<value>View all shortcuts</value>
<comment>Tooltip for a button on each row of the Shortcuts page that opens a flyout listing every keyboard shortcut registered for that action.</comment>
</data>
<data name="Actions_NoKeyBindings.Text" xml:space="preserve">
<value>No shortcuts</value>
<comment>Empty-state message shown inside the "view all shortcuts" flyout (opened from each row's "..." button on the Shortcuts page) when the action has no keyboard shortcuts registered.</comment>
</data>
<data name="EditAction_ActionType.Header" xml:space="preserve">
<value>Shortcut type</value>
<comment>Header for the shortcut-type setting on the Edit Shortcut page (lets the user pick which action runs when this shortcut is invoked).</comment>
</data>
<data name="EditAction_ActionName.Header" xml:space="preserve">
<value>Shortcut name</value>
<comment>Header for the shortcut-name setting on the Edit Shortcut page (lets the user provide a friendly name for this shortcut).</comment>
</data>
<data name="EditAction_KeyBindings.Header" xml:space="preserve">
<value>Shortcuts</value>
<comment>Header for the shortcuts expander on the Edit Shortcut page.</comment>
</data>
<data name="EditAction_KeyBindings.HelpText" xml:space="preserve">
<value>Customize keyboard shortcuts to speed up common actions and workflows.</value>
<comment>Help text shown under the "Shortcuts" header on the Edit Shortcut page.</comment>
</data>
<data name="EditAction_NewKeyBinding.Header" xml:space="preserve">
<value>New shortcut</value>
<comment>Header for the "add a new shortcut" row on the Edit Shortcut page.</comment>
</data>
<data name="EditAction_AddKeyBinding.Content" xml:space="preserve">
<value>Add shortcut</value>
<comment>Label for the accent button that appends a new keyboard shortcut to the current action.</comment>
</data>
<data name="EditAction_AdditionalCustomizations.Header" xml:space="preserve">
<value>Additional customizations</value>
<comment>Header for the additional customizations expander on the Edit Action page (contains action name and per-action argument settings).</comment>
</data>
<data name="EditAction_AdditionalCustomizations.HelpText" xml:space="preserve">
<value>Fine tune how shortcuts behave.</value>
<comment>Help text shown under the "Additional customizations" header on the Edit Shortcut page.</comment>
</data>
<data name="EditAction_KeyBindingNumberFormat" xml:space="preserve">
<value>Shortcut #{}</value>
<comment>{Locked="#{}"} Header label for an individual keyboard shortcut inside the "Shortcuts" expander on the Edit Shortcut page. {} is replaced with the 1-based index of the shortcut (e.g. "Shortcut #1").</comment>
</data>
<data name="EditAction_DeleteCommand.Header" xml:space="preserve">
<value>Delete this shortcut</value>
<comment>Header for the setting container that holds the "Delete shortcut" button at the bottom of the Edit Shortcut page.</comment>
</data>
<data name="EditAction_DeleteCommand.HelpText" xml:space="preserve">
<value>This shortcut will be removed and any shortcuts associated with it will no longer work.</value>
<comment>Help text shown under the "Delete this shortcut" setting container on the Edit Shortcut page.</comment>
<data name="Actions_ActionComboBox.[using:Windows.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Action</value>
<comment>Label for a control that sets the action of a key binding.</comment>
</data>
<data name="Actions_NullEnumValue" xml:space="preserve">
<value>Use global setting</value>

View File

@@ -2201,26 +2201,10 @@
<value>关闭多个选项卡时发出警告</value>
<comment>Header for a control to toggle whether to show a confirm dialog box when closing the application with multiple tabs open.</comment>
</data>
<data name="Globals_ConfirmOnClose.Header" xml:space="preserve">
<value>关闭时发出警告</value>
<comment>Header for a dropdown controlling when to show a confirmation dialog before closing.</comment>
</data>
<data name="Globals_ConfirmOnClose.HelpText" xml:space="preserve">
<value>控制在关闭选项卡或窗口之前何时显示确认对话框。“始终”在关闭任何窗格时显示对话框。</value>
<comment>Help text associated with Globals_ConfirmOnClose. "Always" refers to Globals_ConfirmOnCloseAlways.Content.</comment>
</data>
<data name="Globals_ConfirmOnCloseNever.Content" xml:space="preserve">
<value>从不</value>
<comment>Option associated with Globals_ConfirmOnClose. "Never" means that the system will never display a warning when closing.</comment>
</data>
<data name="Globals_ConfirmOnCloseAlways.Content" xml:space="preserve">
<value>始终</value>
<comment>Option associated with Globals_ConfirmOnClose. "Always" means that the system will always display a warning when closing.</comment>
</data>
<data name="Globals_ConfirmOnCloseAutomatic.Content" xml:space="preserve">
<value>多个选项卡或窗格</value>
<comment>Option associated with Globals_ConfirmOnClose. The system will display a warning when multiple tabs or panes are present.</comment>
</data>
<data name="Globals_InputServiceWarning.Header" xml:space="preserve">
<value>禁用“触摸键盘和手写面板服务”时发出警告</value>
</data>

View File

@@ -121,11 +121,6 @@
<Thickness x:Key="SettingContainerIconMargin">0,4,8,4</Thickness>
<x:Double x:Key="SettingContainerIconFontSize">16</x:Double>
<!-- Shared sizing for SettingContainer-style "card" rows (used by SettingsCardStyle and Actions page rows). -->
<Thickness x:Key="SettingsCardPadding">16,8,8,8</Thickness>
<x:Double x:Key="SettingsCardMinHeight">64</x:Double>
<Thickness x:Key="SettingsCardItemMargin">0,4,0,0</Thickness>
<Style x:Key="StackPanelInExpanderStyle"
TargetType="StackPanel">
<Setter Property="VerticalAlignment" Value="Center" />
@@ -162,21 +157,6 @@
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
</Style>
<!--
Similar to a local:SettingContainer without actually being one.
Used by data-templated rows (i.e. Actions page).
-->
<Style x:Key="SettingsCardStyle"
TargetType="Grid">
<Setter Property="MinHeight" Value="{StaticResource SettingsCardMinHeight}" />
<Setter Property="Padding" Value="{StaticResource SettingsCardPadding}" />
<Setter Property="Background" Value="{ThemeResource ExpanderHeaderBackground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ExpanderHeaderBorderBrush}" />
<Setter Property="BorderThickness" Value="{ThemeResource ExpanderHeaderBorderThickness}" />
<Setter Property="CornerRadius" Value="{ThemeResource ControlCornerRadius}" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
</Style>
<Style x:Key="SettingsPageItemHeaderStyle"
BasedOn="{StaticResource BodyTextBlockStyle}"
TargetType="TextBlock">

View File

@@ -0,0 +1,12 @@
# Cargo source replacement: route crates-io fetches through an Azure Artifact
# Cargo feed (1ES compliance — disallow direct public crates.io access).
#
# Reusing the sudo team's `sudo_public_cargo` feed in microsoft/Dart for now.
# TODO(wtr): replace with our own `microsoft/Dart` Cargo feed once provisioned.
[registries]
WindowsTerminalCargo = { index = "sparse+https://pkgs.dev.azure.com/microsoft/Dart/_packaging/sudo_public_cargo/Cargo/index/" }
[source.crates-io]
replace-with = "WindowsTerminalCargo"

1
src/tools/wtr/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/target/

2208
src/tools/wtr/Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

32
src/tools/wtr/Cargo.toml Normal file
View File

@@ -0,0 +1,32 @@
[package]
name = "wtr"
version = "0.1.0"
edition = "2021"
[[bin]]
name = "wtr"
path = "src/main.rs"
[dependencies]
tokio = { version = "1", features = ["full"] }
tokio-util = { version = "0.7", features = ["compat"] }
async-trait = "0.1"
anyhow = "1"
serde_json = "1"
clap = { version = "4", features = ["derive"] }
ratatui = "0.30"
crossterm = { version = "0.29", features = ["event-stream"] }
futures = "0.3"
unicode-width = "0.2"
textwrap = "0.16"
base64 = "0.22"
serde = { version = "1", features = ["derive"] }
windows-sys = { version = "0.61", features = [
"Win32_Foundation",
"Win32_System_Environment",
"Win32_System_Registry",
"Win32_System_Threading",
] }
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "fmt"] }
tracing-appender = "0.2"

View File

@@ -0,0 +1,4 @@
# Pin the Rust toolchain channel for both local dev and 1ES CI.
# Use the MSRustup `ms-prod-X.YY` channel for compliance.
[toolchain]
channel = "ms-prod-1.93"

View File

@@ -0,0 +1 @@
fn main() {}