Address review comments: remove unused image, add program display for urls/programs, add tooltip for program shorcut advanced args, localize strings

This commit is contained in:
Zach Teutsch
2026-02-22 21:53:27 -05:00
parent 869c516114
commit 9514ca5394
7 changed files with 227 additions and 64 deletions

View File

@@ -204,6 +204,7 @@ comdlg
comexp
cominterop
commandpalette
commoncontrols
compmgmt
COMPOSITIONFULL
CONFIGW
@@ -673,6 +674,7 @@ jpnime
Jsons
jsonval
jxr
kbmcontrols
keybd
KEYBDDATA
KEYBDINPUT

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static KeyboardManagerEditorUI.Interop.ShortcutKeyMapping;
namespace KeyboardManagerEditorUI.Helpers
{
@@ -21,5 +22,17 @@ namespace KeyboardManagerEditorUI.Helpers
public bool IsActive { get; set; } = true;
public string Id { get; set; } = string.Empty;
public bool IsAllApps { get; set; } = true;
public string AppName { get; set; } = string.Empty;
public string StartInDirectory { get; set; } = string.Empty;
public string Elevation { get; set; } = string.Empty;
public string IfRunningAction { get; set; } = string.Empty;
public string Visibility { get; set; } = string.Empty;
}
}

View File

@@ -19,5 +19,9 @@ namespace KeyboardManagerEditorUI.Helpers
public bool IsActive { get; set; } = true;
public string Id { get; set; } = string.Empty;
public bool IsAllApps { get; set; } = true;
public string AppName { get; set; } = string.Empty;
}
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<Page
x:Class="KeyboardManagerEditorUI.Pages.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
@@ -82,7 +82,7 @@
Click="NewRemappingBtn_Click">
<StackPanel Orientation="Horizontal" Spacing="8">
<FontIcon FontSize="14" Glyph="&#xE710;" />
<TextBlock VerticalAlignment="Center" Text="Add new remapping" />
<TextBlock x:Uid="NewRemappingBtn_Text" VerticalAlignment="Center" />
</StackPanel>
</Button>
</Grid>
@@ -108,17 +108,17 @@
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Glyph="&#xEDA7;" />
<TextBlock
x:Uid="EmptyStateTitle"
VerticalAlignment="Center"
CharacterSpacing="12"
Text="Nothing mapped yet"
TextAlignment="Center"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
<TextBlock
x:Uid="EmptyStateDescription"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Style="{StaticResource CaptionTextBlockStyle}"
Text="Create a key or shortcut remapping to customize how your keyboard works."
TextAlignment="Center"
TextTrimming="CharacterEllipsis"
TextWrapping="NoWrap" />
@@ -131,9 +131,9 @@
<!-- Remappings Section -->
<StackPanel Orientation="Vertical" Visibility="{x:Bind RemappingList.Count, Mode=OneWay, Converter={StaticResource CountToVisibilityConverter}}">
<TextBlock
x:Uid="RemappingsHeader"
Margin="16,16,0,8"
Style="{StaticResource BodyStrongTextBlockStyle}"
Text="Keys and shortcuts" />
Style="{StaticResource BodyStrongTextBlockStyle}" />
<Rectangle
Height="1"
HorizontalAlignment="Stretch"
@@ -166,9 +166,9 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock
x:Uid="MapsToText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="maps to" />
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<ItemsControl VerticalAlignment="Center" ItemsSource="{x:Bind RemappedKeys}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -186,9 +186,9 @@
Spacing="8"
Visibility="{x:Bind AppName, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock
x:Uid="InText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="in" />
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl ActionType="Program" Label="{x:Bind AppName}" />
</StackPanel>
</StackPanel>
@@ -208,11 +208,11 @@
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem
x:Uid="DeleteMenuItem"
Click="DeleteMapping_Click"
Icon="{ui:FontIcon Glyph=&#xE74D;,
FontSize=14}"
Tag="{x:Bind}"
Text="Delete" />
Tag="{x:Bind}" />
</MenuFlyout>
</Button.Flyout>
</Button>
@@ -226,9 +226,9 @@
<!-- Text Section -->
<StackPanel Orientation="Vertical" Visibility="{x:Bind TextMappings.Count, Mode=OneWay, Converter={StaticResource CountToVisibilityConverter}}">
<TextBlock
x:Uid="TextMappingsHeader"
Margin="16,16,0,8"
Style="{StaticResource BodyStrongTextBlockStyle}"
Text="Text" />
Style="{StaticResource BodyStrongTextBlockStyle}" />
<Rectangle
Height="1"
HorizontalAlignment="Stretch"
@@ -262,9 +262,9 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock
x:Uid="InsertsText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="inserts" />
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl
ActionType="Text"
Label="{x:Bind Text}"
@@ -274,9 +274,9 @@
Spacing="8"
Visibility="{x:Bind AppName, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock
x:Uid="InText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="in" />
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl ActionType="Program" Label="{x:Bind AppName}" />
</StackPanel>
</StackPanel>
@@ -296,11 +296,11 @@
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem
x:Uid="DeleteMenuItem"
Click="DeleteMapping_Click"
Icon="{ui:FontIcon Glyph=&#xE74D;,
FontSize=14}"
Tag="{x:Bind}"
Text="Delete" />
Tag="{x:Bind}" />
</MenuFlyout>
</Button.Flyout>
</Button>
@@ -314,9 +314,9 @@
<!-- Programs Section -->
<StackPanel Orientation="Vertical" Visibility="{x:Bind ProgramShortcuts.Count, Mode=OneWay, Converter={StaticResource CountToVisibilityConverter}}">
<TextBlock
x:Uid="ProgramsHeader"
Margin="16,16,0,8"
Style="{StaticResource BodyStrongTextBlockStyle}"
Text="Programs" />
Style="{StaticResource BodyStrongTextBlockStyle}" />
<Rectangle
Height="1"
HorizontalAlignment="Stretch"
@@ -337,6 +337,35 @@
</Grid.ColumnDefinitions>
<Rectangle Style="{StaticResource ItemDividerStyle}" />
<StackPanel Orientation="Horizontal" Spacing="8">
<ToolTipService.ToolTip>
<ToolTip>
<StackPanel Spacing="4">
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock x:Uid="TooltipArguments" FontWeight="SemiBold" />
<TextBlock Text="{x:Bind Args}" />
</StackPanel>
<StackPanel
Orientation="Horizontal"
Spacing="8"
Visibility="{x:Bind StartInDirectory, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock x:Uid="TooltipStartIn" FontWeight="SemiBold" />
<TextBlock Text="{x:Bind StartInDirectory}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock x:Uid="TooltipElevation" FontWeight="SemiBold" />
<TextBlock Text="{x:Bind Elevation}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock x:Uid="TooltipIfRunning" FontWeight="SemiBold" />
<TextBlock Text="{x:Bind IfRunningAction}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Spacing="8">
<TextBlock x:Uid="TooltipWindow" FontWeight="SemiBold" />
<TextBlock Text="{x:Bind Visibility}" />
</StackPanel>
</StackPanel>
</ToolTip>
</ToolTipService.ToolTip>
<ItemsControl VerticalAlignment="Center" ItemsSource="{x:Bind Shortcut}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -350,25 +379,23 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock
x:Uid="OpensText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="opens" />
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl
ActionType="Program"
Label="{x:Bind AppToRun}"
Style="{StaticResource RemappedIconLabelControlStyle}" />
<!-- TO DO: Add a ToolTip or Flyout with some of the important advanced info like args -->
<!-- {x:Bind Args} -->
<!--<StackPanel
Orientation="Horizontal"
Spacing="8"
Visibility="{x:Bind AppName, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="in" />
<kbmcontrols:IconLabelControl ActionType="Program" Label="{x:Bind AppName}" />
</StackPanel>-->
<StackPanel
Orientation="Horizontal"
Spacing="8"
Visibility="{x:Bind AppName, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock
x:Uid="InText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl ActionType="Program" Label="{x:Bind AppName}" />
</StackPanel>
</StackPanel>
<StackPanel
Grid.Column="1"
@@ -387,11 +414,11 @@
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem
x:Uid="DeleteMenuItem"
Click="DeleteMapping_Click"
Icon="{ui:FontIcon Glyph=&#xE74D;,
FontSize=14}"
Tag="{x:Bind}"
Text="Delete" />
Tag="{x:Bind}" />
</MenuFlyout>
</Button.Flyout>
</Button>
@@ -405,9 +432,9 @@
<!-- URLs Section -->
<StackPanel Orientation="Vertical" Visibility="{x:Bind UrlShortcuts.Count, Mode=OneWay, Converter={StaticResource CountToVisibilityConverter}}">
<TextBlock
x:Uid="UrlsHeader"
Margin="16,16,0,8"
Style="{StaticResource BodyStrongTextBlockStyle}"
Text="Urls" />
Style="{StaticResource BodyStrongTextBlockStyle}" />
<Rectangle
Height="1"
HorizontalAlignment="Stretch"
@@ -441,23 +468,23 @@
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock
x:Uid="OpensText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="opens" />
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl
ActionType="Url"
Label="{x:Bind URL}"
Style="{StaticResource RemappedIconLabelControlStyle}" />
<!--<StackPanel
Orientation="Horizontal"
Spacing="8"
Visibility="{x:Bind AppName, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="in" />
<controls:IconLabelControl ActionType="Program" Label="{x:Bind AppName}" />
</StackPanel>-->
<StackPanel
Orientation="Horizontal"
Spacing="8"
Visibility="{x:Bind AppName, Converter={StaticResource StringVisibilityConverter}}">
<TextBlock
x:Uid="InText"
VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}" />
<controls:IconLabelControl ActionType="Program" Label="{x:Bind AppName}" />
</StackPanel>
</StackPanel>
<StackPanel
Grid.Column="1"
@@ -475,11 +502,11 @@
<Button.Flyout>
<MenuFlyout>
<MenuFlyoutItem
x:Uid="DeleteMenuItem"
Click="DeleteMapping_Click"
Icon="{ui:FontIcon Glyph=&#xE74D;,
FontSize=14}"
Tag="{x:Bind}"
Text="Delete" />
Tag="{x:Bind}" />
</MenuFlyout>
</Button.Flyout>
</Button>
@@ -499,27 +526,23 @@
<!-- Content Dialog for new remapping -->
<ContentDialog
x:Name="RemappingDialog"
Title="Add new remapping"
x:Uid="RemappingDialog"
Width="760"
MinWidth="800"
MinHeight="500"
MaxWidth="900"
CloseButtonText="Cancel"
DefaultButton="Primary"
IsPrimaryButtonEnabled="False"
PrimaryButtonStyle="{StaticResource AccentButtonStyle}"
PrimaryButtonText="Save">
PrimaryButtonStyle="{StaticResource AccentButtonStyle}">
<controls:UnifiedMappingControl x:Name="UnifiedMappingControl" Margin="0,16,0,0" />
</ContentDialog>
<!-- Confirmation Dialog for delete -->
<ContentDialog
x:Name="DeleteConfirmationDialog"
Title="Are you sure?"
CloseButtonText="Cancel"
DefaultButton="Primary"
PrimaryButtonText="Delete">
<TextBlock Text="You are about to delete this remapping." TextWrapping="Wrap" />
x:Uid="DeleteConfirmationDialog"
DefaultButton="Primary">
<TextBlock x:Uid="DeleteConfirmationDialogContent" TextWrapping="Wrap" />
</ContentDialog>
</Grid>
</Page>

View File

@@ -936,6 +936,12 @@ namespace KeyboardManagerEditorUI.Pages
Args = mapping.ProgramArgs,
IsActive = shortcutSettings.IsActive,
Id = shortcutSettings.Id,
IsAllApps = string.IsNullOrEmpty(mapping.TargetApp),
AppName = string.IsNullOrEmpty(mapping.TargetApp) ? string.Empty : mapping.TargetApp,
StartInDirectory = mapping.StartInDirectory,
Elevation = mapping.Elevation.ToString(),
IfRunningAction = mapping.IfRunningAction.ToString(),
Visibility = mapping.Visibility.ToString(),
});
}
}
@@ -951,6 +957,7 @@ namespace KeyboardManagerEditorUI.Pages
foreach (var shortcutSettings in SettingsManager.GetShortcutSettingsByOperationType(ShortcutOperationType.OpenUri))
{
ShortcutKeyMapping mapping = shortcutSettings.Shortcut;
string[] originalKeyCodes = shortcutSettings.Shortcut.OriginalKeys.Split(';');
var originalKeyNames = new List<string>();
foreach (var keyCode in originalKeyCodes)
@@ -964,9 +971,11 @@ namespace KeyboardManagerEditorUI.Pages
UrlShortcuts.Add(new URLShortcut
{
Shortcut = originalKeyNames,
URL = shortcutSettings.Shortcut.UriToOpen,
URL = mapping.UriToOpen,
Id = shortcutSettings.Id,
IsActive = shortcutSettings.IsActive,
IsAllApps = string.IsNullOrEmpty(mapping.TargetApp),
AppName = string.IsNullOrEmpty(mapping.TargetApp) ? string.Empty : mapping.TargetApp,
});
}
}

View File

@@ -117,4 +117,116 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<!-- Button Texts -->
<data name="NewRemappingBtn_Text.Text" xml:space="preserve">
<value>Add new remapping</value>
<comment>Button text to create a new keyboard remapping</comment>
</data>
<!-- Empty State -->
<data name="EmptyStateTitle.Text" xml:space="preserve">
<value>Nothing mapped yet</value>
<comment>Title shown when no mappings exist</comment>
</data>
<data name="EmptyStateDescription.Text" xml:space="preserve">
<value>Create a key or shortcut remapping to customize how your keyboard works.</value>
<comment>Description shown when no mappings exist</comment>
</data>
<!-- Section Headers -->
<data name="RemappingsHeader.Text" xml:space="preserve">
<value>Keys and shortcuts</value>
<comment>Header for the keys and shortcuts remapping section</comment>
</data>
<data name="TextMappingsHeader.Text" xml:space="preserve">
<value>Text</value>
<comment>Header for the text mapping section</comment>
</data>
<data name="ProgramsHeader.Text" xml:space="preserve">
<value>Programs</value>
<comment>Header for the programs section</comment>
</data>
<data name="UrlsHeader.Text" xml:space="preserve">
<value>Urls</value>
<comment>Header for the URLs section</comment>
</data>
<!-- List Item Actions -->
<data name="MapsToText.Text" xml:space="preserve">
<value>maps to</value>
<comment>Text showing key mapping relationship</comment>
</data>
<data name="InsertsText.Text" xml:space="preserve">
<value>inserts</value>
<comment>Text showing text insertion action</comment>
</data>
<data name="OpensText.Text" xml:space="preserve">
<value>opens</value>
<comment>Text showing opening action for programs and URLs</comment>
</data>
<data name="InText.Text" xml:space="preserve">
<value>in</value>
<comment>Text showing app-specific context</comment>
</data>
<!-- Context Menu -->
<data name="DeleteMenuItem.Text" xml:space="preserve">
<value>Delete</value>
<comment>Menu item to delete a mapping</comment>
</data>
<!-- Tooltip Labels -->
<data name="TooltipArguments.Text" xml:space="preserve">
<value>Arguments:</value>
<comment>Label for program arguments in tooltip</comment>
</data>
<data name="TooltipStartIn.Text" xml:space="preserve">
<value>Start in:</value>
<comment>Label for start directory in tooltip</comment>
</data>
<data name="TooltipElevation.Text" xml:space="preserve">
<value>Elevation:</value>
<comment>Label for elevation level in tooltip</comment>
</data>
<data name="TooltipIfRunning.Text" xml:space="preserve">
<value>If running:</value>
<comment>Label for if running action in tooltip</comment>
</data>
<data name="TooltipWindow.Text" xml:space="preserve">
<value>Window:</value>
<comment>Label for window visibility in tooltip</comment>
</data>
<!-- RemappingDialog -->
<data name="RemappingDialog.Title" xml:space="preserve">
<value>Add new remapping</value>
<comment>Default title for remapping dialog (changed dynamically to "Edit remapping" in code)</comment>
</data>
<data name="RemappingDialog.PrimaryButtonText" xml:space="preserve">
<value>Save</value>
<comment>Primary button text for remapping dialog</comment>
</data>
<data name="RemappingDialog.CloseButtonText" xml:space="preserve">
<value>Cancel</value>
<comment>Close button text for remapping dialog</comment>
</data>
<!-- Delete Confirmation Dialog -->
<data name="DeleteConfirmationDialog.Title" xml:space="preserve">
<value>Are you sure?</value>
<comment>Title for delete confirmation dialog</comment>
</data>
<data name="DeleteConfirmationDialogContent.Text" xml:space="preserve">
<value>You are about to delete this remapping.</value>
<comment>Content for delete confirmation dialog</comment>
</data>
<data name="DeleteConfirmationDialog.PrimaryButtonText" xml:space="preserve">
<value>Delete</value>
<comment>Primary button text for delete confirmation dialog</comment>
</data>
<data name="DeleteConfirmationDialog.CloseButtonText" xml:space="preserve">
<value>Cancel</value>
<comment>Close button text for delete confirmation dialog</comment>
</data>
</root>