diff --git a/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx b/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx index a6fe6f2d62a7..49098653f5a5 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx +++ b/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx @@ -161,7 +161,7 @@ To send: - To send: + To: Target app: @@ -297,10 +297,10 @@ Key on a keyboard - Text + Send Text - Key/Shortcut + Send Key/Shortcut Key on a keyboard diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp index 1604bab3dde6..4a33a9604471 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/ShortcutControl.cpp @@ -169,6 +169,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vectorshortcutDropDownVariableSizedWrapGrid.as(); auto gridMargin = Windows::UI::Xaml::Thickness(); @@ -530,15 +532,14 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector MapKeys(string stringOfKeys) { + if (stringOfKeys == null) + { + return new List(); + } + return stringOfKeys .Split(';') .Select(uint.Parse) @@ -40,9 +52,49 @@ public List GetMappedOriginalKeys() public List GetMappedNewRemapKeys() { + if (IsRunProgram) + { + // we're going to just pretend this is a "key" if we have a RunProgramFilePath + if (string.IsNullOrEmpty(RunProgramFilePath)) + { + return new List(); + } + else + { + return new List { FormatFakeKeyForDisplay() }; + } + } + return string.IsNullOrEmpty(NewRemapString) ? MapKeys(NewRemapKeys) : new List { NewRemapString }; } + private string FormatFakeKeyForDisplay() + { + // was going to use this: + // var fakeKey = Path.GetFileName(RunProgramFilePath); + // but I like this better: + var fakeKey = RunProgramFilePath; + + if (fakeKey.Length > 15) + { + fakeKey = $"...{fakeKey.Substring(fakeKey.Length - 12)}"; + } + + if (!string.IsNullOrEmpty(RunProgramArgs)) + { + if (RunProgramArgs.Length > 10) + { + fakeKey = $"{fakeKey} {RunProgramArgs.Substring(0, 7)}..."; + } + else + { + fakeKey = $"{fakeKey} {RunProgramArgs}"; + } + } + + return fakeKey; + } + public string ToJsonString() { return JsonSerializer.Serialize(this); diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml index 6e9c34d61399..4e92e4a2ec70 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/DashboardPage.xaml @@ -216,11 +216,19 @@ + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml index f4ef3b5ece3e..0def811ae2d1 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml @@ -14,6 +14,10 @@ + @@ -150,12 +154,22 @@ + + + + + CornerRadius="12" + Visibility="{x:Bind Path=IsRunProgram, Mode=OneWay, Converter={StaticResource BoolToInvertedVisibilityConverter}}"> diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index a1a1f7fc6955..df2273196467 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -2354,7 +2354,11 @@ From there, simply click on one of the supported files in the File Explorer and to as in: from x to y - + + starts + as in: doing x start y + + Learn more about Awake Awake is a product name, do not loc diff --git a/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs index a67a7ec668e0..d59f406b4a4a 100644 --- a/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs @@ -194,7 +194,7 @@ public static List CombineShortcutLists(List new AppSpecificKeysDataModel { OriginalKeys = x.OriginalKeys, NewRemapKeys = x.NewRemapKeys, NewRemapString = x.NewRemapString, TargetApp = allAppsDescription }).Concat(appSpecificShortcutList).ToList(); + return globalShortcutList.ConvertAll(x => new AppSpecificKeysDataModel { OriginalKeys = x.OriginalKeys, NewRemapKeys = x.NewRemapKeys, NewRemapString = x.NewRemapString, RunProgramFilePath = x.RunProgramFilePath, IsRunProgram = x.IsRunProgram, RunProgramArgs = x.RunProgramArgs, TargetApp = allAppsDescription }).Concat(appSpecificShortcutList).ToList(); } }