diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index add9fcce1812..8948b9a9072d 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -1391,6 +1391,7 @@ popups POPUPWINDOW portfile POSITIONITEM +Postbot POWERBROADCAST powerdisplay POWERDISPLAYMODULEINTERFACE diff --git a/PowerToys.slnx b/PowerToys.slnx index a456003add84..b2ca718650ed 100644 --- a/PowerToys.slnx +++ b/PowerToys.slnx @@ -1004,6 +1004,10 @@ + + + + diff --git a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Google.Chrome.en-US.yml b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Google.Chrome.en-US.yml index 4496a2c64108..741e0c857d89 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Google.Chrome.en-US.yml +++ b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Google.Chrome.en-US.yml @@ -63,7 +63,7 @@ Shortcuts: Shift: false Alt: false Keys: - - 1 + - '1 - 8' - Name: Jump to rightmost tab Shortcut: - Win: false diff --git a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Microsoft.Edge.en-US.yml b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Microsoft.Edge.en-US.yml index d8e3124c81ab..69b992e31998 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Microsoft.Edge.en-US.yml +++ b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Microsoft.Edge.en-US.yml @@ -45,7 +45,7 @@ Shortcuts: Shift: false Alt: false Keys: - - 1 + - '1 - 8' - Name: Switch to the last tab Shortcut: - Win: false diff --git a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Mozilla.Firefox.en-US.yml b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Mozilla.Firefox.en-US.yml index 6742ab476695..ea9c7cf94c5c 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Mozilla.Firefox.en-US.yml +++ b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Mozilla.Firefox.en-US.yml @@ -485,7 +485,7 @@ Shortcuts: Shift: false Alt: false Keys: - - 1 + - '1 - 8' - Name: Go to last tab Shortcut: - Win: false diff --git a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Postman.Postman.en-US.yml b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Postman.Postman.en-US.yml new file mode 100644 index 000000000000..3d85a2634243 --- /dev/null +++ b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Assets/ShortcutGuide/Manifests/Postman.Postman.en-US.yml @@ -0,0 +1,463 @@ +PackageName: Postman.Postman +Name: Postman +WindowFilter: "Postman.exe" +BackgroundProcess: false +Shortcuts: + - SectionName: Tabs + Properties: + - Name: Close tab + Recommended: true + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - W + - Name: Force close tab + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - W + - Name: Switch to next tab + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - Tab + - Name: Switch to previous tab + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - Tab + - Name: Switch to tab at position (1–8) + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - '1 - 8' + - Name: Switch to last tab + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - 9 + - Name: Reopen last closed tab + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - T + - Name: New runner tab + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - R + - Name: Search tabs + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - A + - SectionName: Sidebar + Properties: + - Name: Search sidebar + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - F + - Name: Next item + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: false + Keys: + - "" + - Name: Previous item + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: false + Keys: + - "" + - Name: Expand item + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: false + Keys: + - "" + - Name: Expand all + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: true + Keys: + - "" + - Name: Collapse item + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: false + Keys: + - "" + - Name: Collapse all + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: true + Keys: + - "" + - Name: Select item + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: false + Keys: + - "" + - Name: Rename item + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - E + - Name: Cut item + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - X + - Name: Copy item + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - C + - Name: Paste item + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - V + - Name: Duplicate item + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - D + - Name: Delete item + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: false + Keys: + - "" + - SectionName: Request + Properties: + - Name: Request URL + Recommended: true + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - L + - Name: Save request + Recommended: true + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - S + - Name: Save request as + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - S + - Name: Send request + Recommended: true + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - "" + - Name: Send and download request + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - "" + - SectionName: Interface + Properties: + - Name: Zoom in + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - Plus + - Name: Zoom out + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - Minus + - Name: Reset zoom + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - 0 + - Name: Toggle two-pane view + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - V + - Name: Toggle left sidebar + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - "\\" + - Name: Toggle right sidebar + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - "\\" + - Name: Toggle workbench + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - M + - Name: Swap sidebars + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - S + - Name: Reset layout + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - R + - Name: Environment selector + Shortcut: + - Win: false + Ctrl: false + Shift: false + Alt: true + Keys: + - E + - SectionName: Window and modals + Properties: + - Name: New… + Recommended: true + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - N + - Name: New Postman window + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - N + - Name: New console window + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - C + - Name: Find + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - F + - Name: Import + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - O + - Name: Settings + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - "," + - Name: Open shortcut help + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - "/" + - Name: Search + Recommended: true + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - K + - Name: Search in current workspace + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - K + - Name: Open Postbot + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: true + Keys: + - P + - Name: Open Vault + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - V + - Name: Open browser tab + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - B + - Name: Cancel conversation + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - C + - Name: Accept all + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - Y + - Name: Reject all + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - "" + - SectionName: Console + Properties: + - Name: Clear console + Shortcut: + - Win: false + Ctrl: true + Shift: true + Alt: false + Keys: + - K + - Name: Show/hide console + Shortcut: + - Win: false + Ctrl: true + Shift: false + Alt: false + Keys: + - "`" diff --git a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Converters/ShortcutDescriptionToKeysConverter.cs b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Converters/ShortcutDescriptionToKeysConverter.cs index bf73911c6c35..83697af63341 100644 --- a/src/modules/ShortcutGuide/ShortcutGuide.Ui/Converters/ShortcutDescriptionToKeysConverter.cs +++ b/src/modules/ShortcutGuide/ShortcutGuide.Ui/Converters/ShortcutDescriptionToKeysConverter.cs @@ -68,6 +68,12 @@ public List GetKeysList(ShortcutDescription description) case 39: // The Right Arrow key or button. shortcutList.Add(keyCode); break; + case >= 0 and <= 9: + // A single digit in a manifest (e.g. "9") is the literal digit key, not a + // virtual-key code. Treating it as a VK code is wrong (VK 9 is Tab, VK 1 is + // the left mouse button, VK 0 is undefined), so render the character as-is. + shortcutList.Add(key); + break; default: shortcutList.Add(Microsoft.PowerToys.Settings.UI.Library.Utilities.Helper.GetKeyName((uint)keyCode)); break; diff --git a/src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ConvertersTests/ShortcutDescriptionToKeysConverterTests.cs b/src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ConvertersTests/ShortcutDescriptionToKeysConverterTests.cs new file mode 100644 index 000000000000..213c91701c48 --- /dev/null +++ b/src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ConvertersTests/ShortcutDescriptionToKeysConverterTests.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using Microsoft.VisualStudio.TestTools.UnitTesting; +using ShortcutGuide.Converters; +using ShortcutGuide.Models; + +namespace ShortcutGuide.UnitTests.ConvertersTests; + +[TestClass] +public sealed class ShortcutDescriptionToKeysConverterTests +{ + private static List Convert(ShortcutDescription description) + => new ShortcutDescriptionToKeysConverter().GetKeysList(description); + + [TestMethod] + public void GetKeysList_SingleDigitKey_RendersLiteralDigit() + { + // Ctrl+9 ("switch to last tab"). Regression test for digits being treated as + // virtual-key codes (VK 9 is Tab, VK 1 is the left mouse button, VK 0 is undefined), + // which made single-digit shortcuts render as blank/incorrect glyphs. + var result = Convert(new ShortcutDescription(ctrl: true, shift: false, alt: false, win: false, keys: ["9"])); + + CollectionAssert.AreEqual(new object[] { "Ctrl", "9" }, result); + } + + [TestMethod] + [DataRow("0")] + [DataRow("1")] + [DataRow("8")] + [DataRow("9")] + public void GetKeysList_EachDigit_RendersTheSameDigitCharacter(string digit) + { + var result = Convert(new ShortcutDescription(ctrl: false, shift: false, alt: false, win: false, keys: [digit])); + + CollectionAssert.AreEqual(new object[] { digit }, result); + } + + [TestMethod] + public void GetKeysList_Modifiers_AreEmittedBeforeKeysInWinCtrlAltShiftOrder() + { + // Win -> 92, Ctrl -> "Ctrl", Alt -> "Alt", Shift -> 16, then the keys. + var result = Convert(new ShortcutDescription(ctrl: true, shift: true, alt: true, win: true, keys: ["A"])); + + CollectionAssert.AreEqual(new object[] { 92, "Ctrl", "Alt", 16, "A" }, result); + } + + [TestMethod] + public void GetKeysList_NonNumericKey_IsPassedThroughVerbatim() + { + // Non-numeric key strings (e.g. the "1 - 8" tab-range) render as-is. + var result = Convert(new ShortcutDescription(ctrl: true, shift: false, alt: false, win: false, keys: ["1 - 8"])); + + CollectionAssert.AreEqual(new object[] { "Ctrl", "1 - 8" }, result); + } + + [TestMethod] + public void GetKeysList_ArrowNameKey_MapsToVirtualKeyCode() + { + // Named arrow keys map to their VK codes (Up -> 38), independent of the digit handling. + var result = Convert(new ShortcutDescription(ctrl: false, shift: false, alt: false, win: false, keys: ["Up"])); + + CollectionAssert.AreEqual(new object[] { 38 }, result); + } +} diff --git a/src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ShortcutGuide.UnitTests.csproj b/src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ShortcutGuide.UnitTests.csproj new file mode 100644 index 000000000000..a75e6b94ade8 --- /dev/null +++ b/src/modules/ShortcutGuide/ShortcutGuide.UnitTests/ShortcutGuide.UnitTests.csproj @@ -0,0 +1,24 @@ + + + + + + true + win-x64 + win-arm64 + false + false + false + $(SolutionDir)$(Platform)\$(Configuration)\tests\ShortcutGuide.UnitTests\ + Exe + + + + + + + + + + +