[settings] Show uneditable shortcut in CmdPal page (#38060)

* [settings] Show CmdPal shortcut
* show in dashboard as well


![image](https://github.com/user-attachments/assets/395d112d-162c-412c-99c2-2625b23cc451)

![image](https://github.com/user-attachments/assets/a0362e2b-e647-4a19-b4ff-fdb501e236d7)

As noted in #37908
This commit is contained in:
Stefan Markovic
2025-03-20 16:20:19 +01:00
committed by GitHub
parent dadd306555
commit 665e957cde
7 changed files with 149 additions and 3 deletions

View File

@@ -53,6 +53,27 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
return sendCustomAction.ToJsonString();
}
public static IFileSystemWatcher GetFileWatcher(string path, Action onChangedCallback, IFileSystem fileSystem = null)
{
fileSystem ??= FileSystem;
var dirPath = Path.GetDirectoryName(path);
if (!fileSystem.Directory.Exists(dirPath))
{
return null;
}
var watcher = fileSystem.FileSystemWatcher.New();
watcher.Path = dirPath;
watcher.Filter = Path.GetFileName(path);
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.EnableRaisingEvents = true;
watcher.Changed += (o, e) => onChangedCallback();
return watcher;
}
public static IFileSystemWatcher GetFileWatcher(string moduleName, string fileName, Action onChangedCallback, IFileSystem fileSystem = null)
{
fileSystem ??= FileSystem;