From 39e82318317c9120614b231054aae645392094fc Mon Sep 17 00:00:00 2001 From: Stefan Markovic <57057282+stefansjfw@users.noreply.github.com> Date: Wed, 26 Mar 2025 08:55:40 +0100 Subject: [PATCH] [CmdPal] Windows Services restart kb shortcuts (#38150) * [CmdPal] Windows Services open/restart kb shortcuts * Given both restart and stop has its shortcut, only do for open with the shortcut "ctr+o" --- .../Helpers/ServiceHelper.cs | 6 +++++- .../Properties/Resources.resx | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs index 2a0147d20b..6f036372fa 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Helpers/ServiceHelper.cs @@ -13,6 +13,7 @@ using Microsoft.CmdPal.Ext.WindowsServices.Properties; using Microsoft.CommandPalette.Extensions; using Microsoft.CommandPalette.Extensions.Toolkit; using Microsoft.Win32; +using Windows.System; namespace Microsoft.CmdPal.Ext.WindowsServices.Helpers; @@ -53,7 +54,10 @@ public static class ServiceHelper serviceCommand = new ServiceCommand(serviceResult, Action.Stop); moreCommands = [ new CommandContextItem(new RestartServiceCommand(serviceResult)), - new CommandContextItem(new OpenServicesCommand(serviceResult)), + new CommandContextItem(new OpenServicesCommand(serviceResult)) + { + RequestedShortcut = KeyChordHelpers.FromModifiers(true, false, false, false, (int)VirtualKey.O, 0), + }, ]; } else diff --git a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Properties/Resources.resx b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Properties/Resources.resx index 80cd60db44..dd757f4330 100644 --- a/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Properties/Resources.resx +++ b/src/modules/cmdpal/Exts/Microsoft.CmdPal.Ext.WindowsServices/Properties/Resources.resx @@ -127,7 +127,7 @@ Name - Open services (Ctrl+O) + Open services Paused @@ -142,7 +142,7 @@ Service - Restart (Ctrl+R) + Restart The service has been restarted