Compare commits

...

30 Commits

Author SHA1 Message Date
Leilei Zhang
81b92b799d test installer 2025-04-03 11:23:22 +08:00
Jaime Bernardo
7a5b25cd3e [Settings]Fix blank icon in the taskbar (#38259) 2025-04-02 17:59:46 -07:00
Clint Rutkas
1eccbc3021 WinGet installer fix (#38422)
Update package.h
2025-04-01 16:21:15 -07:00
Heiko
ce620e427f [PT Run > Time and Date plugin] Custom formats and other improvements (#37743)
* add settings definition

* fix typos and improve settings

* make spell checker happy

* new icon type error

* first code to handle custom formats

* support parsing of new formats

* spelling and typos

* comment fix

* spell check

* start implement custom format results

* last changes

* finish implementation

* spell checker

* settings name

* add missing format

* reorder settings

* dev docs

* change ELF to EAB

* update dev docs

* last changes

* test cases

* fix typos

* fix typo

* port changes

* fixes

* changes

* fixes

* leap year support

* days in month

* tests

* comment

* fix comment
2025-04-01 21:31:35 +08:00
Hao Liu
721c84d3a6 Install .NET 9 for MSStore release (#38361)
fix dotnet 9
2025-04-01 10:08:25 +08:00
Hao Liu
96ba445cfa 0.90 changelog (#38072)
* First draft. Some PRs are still under review.

* update wording

* remove the Svg thumbnail since it has been reverted

* update cmdpal

* add cmdpal

* clear old hashes

* address comments

* Update README.md

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>

* address more comments

* Update README.md

Co-authored-by: Mike Griese <migrie@microsoft.com>

* Add Command Palette gif to README

* upload gif of cmdpal

* Update README.md

Co-authored-by: Mike Griese <migrie@microsoft.com>

* Address comments

Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com>

* Update README.md

Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com>

* Update CmdPal description

Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com>

* Remove extra spacing

Co-authored-by: PesBandi <127593627+PesBandi@users.noreply.github.com>

* update hash

* update gif with new icon

---------

Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
Co-authored-by: Clint Rutkas <clint@rutkas.com>
Co-authored-by: Mike Griese <migrie@microsoft.com>
Co-authored-by: Kayla Cinnamon <cinnamon@microsoft.com>
Co-authored-by: PesBandi <127593627+PesBandi@users.noreply.github.com>
2025-03-31 16:09:26 -07:00
Kai Tao
16157231d4 [CmdPlt] [Bug template] Update issue template for command palette (#38189)
Update issue template for command palette
2025-03-27 15:19:01 +08:00
Niels Laute
a641b46f57 [CmdPal] Updating icon (#38184)
* Replacing dev icons

* Replacing stable icons

* Adding icon to UI

* Replacing release assets

* Adding svg

* Minor margin tweak to app icon in searchbar

* Update icon in Settings

* Remove margin from settingswindow icon
2025-03-26 15:09:31 -07:00
Mike Griese
51e9e9d46a CmdPal: Update the alias tags, before triggering the UI to change (#38172)
Yea, this one hurts. Pretty obviously, we're sending the PropChanged
_before_ the `Tags` are actually updated.

Noticed on 0.0.16+ builds
2025-03-26 14:18:18 -07:00
Mike Griese
5157ffc895 cmdpal: Skip dependency installs for extensions (#38175)
It appears there are two issues in WinGet regarding the installation of dependencies.

https://github.com/microsoft/winget-cli/issues/4661 https://github.com/microsoft/winget-cli/issues/4679

For CmdPal 0.1, we're going to skip installing dependencies to make extension installation more robust. This will mostly work because extensions will depend on the same frameworks as the command palette itself (for now).

We will revert this once these two issues are fixed.
2025-03-26 14:16:34 -07:00
Mike Griese
60bbf070e1 Update Fallback commands async, once (#38157)
The problem: 

> * we need to go update all the Fallback commands. (these are ones that extensions can use to react to the search text - basically, "what the user typed wasn't found immediately, but here's something they can fall back on"
>   * this is wacky, because the way I had it, I update each item, and if it "changes visibility", then we need to update the main list, because we've already removed it from the list. So we need to re-update the list to account for that
>     * you missed it reading that (and i missed it writing it) but that basically means we re-populate the list F={num fallbacks} times, because each one sends the "do it again" message
>     * That results in us basically creating (F+1)*(N=num items+apps) view models, initializing them, and not needing most of them

The crux here being a single thread, to update all the fallback items,
that then only raises _one_ items changed at the very end.

I don't love this, one misbehaving fallback could stop all the others. In theory, we should do a parallel update of all these things, with a like, 1s timeout on each leg. 

But it has gotta be faster till we can do #38140 (or similar)

Closes: (not sure I filed one). But the first typed character _felt_ slow.
2025-03-26 04:36:37 -07:00
Mike Griese
d597bd267d Hide commands with whitespace only names better (#38159)
This is a much tidier solution. Don't default _everything_ to a weight of 1 if the query is whitespace. Instead, do a simple string contains check (because FuzzySearch will beef it on just whitespace)

Closes #38133

I originally based this off of #38157, so I know these two won't collide
2025-03-26 04:36:32 -07:00
Dustin L. Howett
2623eb10f3 CmdPal: add appLicensing for offline install; disable startup (#38152)
- `appLicensing` avoids the issue where installation requires access to the store servers for licensing.
- It was decided that PowerToys would manage CmdPal's startup.
2025-03-26 04:35:53 -07:00
Mike Griese
8e27940b77 Fixes a race in extension startup (#38156)
This only repros on my desktop, so I suppose that means a slower machine is needed

I was mistaken, and assumed we were already operating on a copy here. We weren't. That meant that it was possible for another extension to be detected, change the list, and crash the whole palette.

## Validation Steps Performed

No longer does my desktop crash on startup
2025-03-26 04:35:41 -07:00
moooyo
c6750d3a62 [cmdpal] Fix windows service extension crash issue (#38166)
repro step:
change language to non-english language. stably reproducible.

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
2025-03-26 04:34:59 -07:00
Davide Giacometti
37836c656d [CmdPal] Fix Layout cycle detected. Layout could not complete (#38162)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request

Attempt to fix `Layout cycle detected. Layout could not complete` exception when CmdPal is moved on a screen with different DPI.
I can repro almost 100% and no longer occurs after switching tags `ItemsView` with `ItemsControl`.

Doesn't seem to break visual and don't expect a huge number of tags so use an `ItemsControl` shouldn't be a problem.

<img width="491" alt="image" src="https://github.com/user-attachments/assets/05b698b2-ebe7-4356-bdaa-4de93aea13e6" />

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
   - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries
   - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder
   - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects
   - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-03-26 03:11:43 -07:00
Stefan Markovic
39e8231831 [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"
2025-03-26 15:55:40 +08:00
Mike Griese
2cb63f5fbe CmdPal: Fix opening SUI pages in other languages (#38153)
What we were doing only worked in English. The `.ToString` would get
you the text of the nav item, not the `Tag`

`InvokedItemContainer` gets you the `NavigationViewItem`.
2025-03-26 15:23:59 +08:00
Niels Laute
e931135d50 [CmdPal] Disabling RequestedShortcut in XAML (#38158)
Update CommandBar.xaml
2025-03-26 15:21:56 +08:00
Jaime Bernardo
5b39d1551d [CmdPal]Fix Calc and Command extension fallback command icons (#38146) 2025-03-26 15:21:28 +08:00
Seraphima Zykova
5e88d47f3d [CmdPal] Registry: typing "\" causes the page to throw an exception (#38151)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request

Calling `string.Replace` with an empty string as the first parameter was raising an exception. Added a check to prevent this.

![image](https://github.com/user-attachments/assets/42ee67f2-a648-4543-9994-0e37de50dcdf)

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
   - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries
   - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder
   - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects
   - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-03-25 13:13:07 -07:00
Jaime Bernardo
aeec3a967f [CmdPal]Fix resetting the hotkey in Settings (#38149)
Fix resetting the hotkey in Settings
2025-03-25 18:58:46 +00:00
Niels Laute
be1968aaa5 [CmdPal] Minor tweaks to the General settingspage (#38120)
Minor tweaks to the General settingspage
2025-03-24 21:13:24 +01:00
Heiko
33cc612e40 [CmdPal] Fixes for Exts: All Apps, System Commands, Time And Date (#38103)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request

All apps:
- Fix missing second command for opnening settings page

Time and Date plugin:
- fix for missing settings list in global plugin manager
- fix for wrong page title

system plugin
- fix for missing settings page in global plugin manager
- fix for missing open button on plugin list
- ~fix for wrong icon for firmware boot~
- fix for wrong subtitle for ipv6
- fix for wrong details for mac address
- fix for wrong layout of network details
- layout improvements for network details
- change default value for "hide disconected networks" to $false
- rename empty recycle bin setting to "Hide Empty Recycle Bin command"

![image](https://github.com/user-attachments/assets/fba608ca-3229-408e-9efb-596ead03ac19)

![image](https://github.com/user-attachments/assets/8b3a4ab1-499a-4e3c-8c2e-be19162d971b)

![image](https://github.com/user-attachments/assets/fd5d2a3c-6a9a-4990-a006-70646405d165)



<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end user facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
   - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries
   - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder
   - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects
   - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
2025-03-24 11:39:08 -07:00
Davide Giacometti
a9a41ca1a2 [CmdPal] Settings UI polishing (#38094)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? -->
## Summary of the Pull Request

Settings window UI polishing:
- Make the navigation view toggle button move in the title bar when navigation view mode is compact or minimal
- Center settings card in the window
- Properly set windows icon in order to make it visible in task manager and task view

_main branch_
![image](https://github.com/user-attachments/assets/792f0779-016a-4056-81b0-04244d903909)

![image](https://github.com/user-attachments/assets/81ac2761-2a9c-4fe7-a122-2f69f900e656)

_PR_
![image](https://github.com/user-attachments/assets/029b95a0-9629-4732-9f0c-bf586954e887)

![image](https://github.com/user-attachments/assets/81bb2beb-9a07-42cf-8594-16ba5a9cda1b)

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:**: https://github.com/zadjii-msft/PowerToys/issues/581

---------

Co-authored-by: Niels Laute <niels.laute@live.nl>
2025-03-24 07:32:59 -07:00
Mike Griese
4e7bd34c4d Pass FG rights to extensions when we access them (#38068)
Calling Win32 APIs from C# is usually easy! but mixing C#+WinRT+COM is dark and full of terrors

Closes https://github.com/zadjii-msft/PowerToys/issues/546


Co-authored-by: Manodasan Wignarajah <mawign@microsoft.com>
2025-03-24 04:29:40 -07:00
Mike Griese
43783d2cff Use Shmueli's COM server to fix ARM (#38090)
More than a couple people hit mYsTeRiOuS iSsUeS on ARM. Extensions would load the first time, but never again. Their processes would start, but the objects would fail to load.

Fortunately, @azchohfi discovered that using `Shmuelie.WinRTServer`, rather than the one pilfered from devhome, doesn't have this problem.

I don't have an ARM machine to validate the changes, but @lauren-ciha thankfully did the groundwork to get this validated in their extension, so I think this should work. 

Closes https://github.com/zadjii-msft/PowerToys/issues/97
2025-03-24 03:43:47 -07:00
Niels Laute
79bd825f91 [cmdpal] UX tweaks (#38087)
- Removing the redundant icon + text in the bottom left corner
- Minor styling tweaks
- Adding subtle show/hide animations
- Improved narrator support for Settings button
- Minor design tweaks to the tags for better visibility (still needs more work in the future)

![SubtleAnimations](https://github.com/user-attachments/assets/d2f6bec3-f8d6-48a4-a533-c0f2e0c81f8c)
2025-03-24 03:13:19 -07:00
Niels Laute
69c2e9c568 [CmdPal] Adding colored extension icons (#38085)
* Updating run icon
* Bookmark
* System
* WindowWalker
* Extensions
* CreateExtensions
* Services
* Replacing icon

This PR updates the Segoe Fluent icons with colored Fluent icons.

![image](https://github.com/user-attachments/assets/8c1350a1-963b-4deb-9029-966ba0a3c0fb)
2025-03-24 03:01:33 -07:00
Felipe G
df3e3414d2 Fixing command duplicates when loading commands from provider (#38091)
There is a bug in command palette where the top level commands from extensions gets duplicated after the extension raises items changed, or when it is requested by CmdPal for any reason. This didn't happen when we kill CmdPal and open it again.

When investigating, I noticed that the `UpdateCommandsForProvider` method was not deleting the top level commands for the extension.
This seems to be happening because the comparison `var isTheSame = wrapper == firstCommand;` is not comparing objects of the same type. It was comparing a `TopLevelViewModel` with a `CommandItem`, and it was never set to `true`.

I change it to compare the `TopLevelViewModel` of both commands, and now it seems to be detecting correctly.

Another option of fix could be comparing the `CommandItem`s. 

closes https://github.com/zadjii-msft/PowerToys/issues/511

---

Another bug that I found while testing today is that when a user uninstalled or updated an extension, it was still being listed as an enabled extension. This was generating duplicates in the top level commands in case of updating an extension, and resulting in unpredictable behavior and occasional crashes in CmdPal.

Added a fix for that on `ExtensionService`, removing the uninstalled extensions also from the `_enabledExtensions` list.

---------

Co-authored-by: Mike Griese <migrie@microsoft.com>
2025-03-24 03:00:34 -07:00
272 changed files with 1889 additions and 479 deletions

View File

@@ -53,6 +53,7 @@ body:
- Awake
- ColorPicker
- Command not found
- Command Palette
- Crop and Lock
- Environment Variables
- FancyZones

View File

@@ -154,6 +154,7 @@ Santossio
Schoen
Sekan
Seraphima
Shmuelie
skttl
somil
Soref

View File

@@ -15,6 +15,7 @@ ACTIVATEAPP
activationaction
ACVS
adaptivecards
ADate
ADDSTRING
ADDUNDORECORD
ADifferent
@@ -417,6 +418,7 @@ DWORDLONG
dworigin
dwrite
dxgi
eab
easeofaccess
ecount
Edid
@@ -466,6 +468,7 @@ EXAND
EXCLUDEFROMCAPTURE
executionpolicy
exename
exf
EXITSIZEMOVE
exlist
EXPCMDFLAGS
@@ -898,6 +901,7 @@ MARKDOWNPREVIEWHANDLERCPP
MAXIMIZEBOX
MAXSHORTCUTSIZE
maxversiontested
mber
MBM
MBR
MDICHILD
@@ -1779,6 +1783,8 @@ USRDLL
UType
uuidv
uwp
ums
uxt
uxtheme
vabdq
validmodulename
@@ -1859,6 +1865,7 @@ webbrowsers
webpage
websites
wekyb
wft
wgpocpl
WHEREID
Wholegrain
@@ -1919,6 +1926,7 @@ WNDCLASSEXW
WNDCLASSW
WNDPROC
wnode
wom
WORKSPACESEDITOR
WORKSPACESLAUNCHER
WORKSPACESSNAPSHOTTOOL

View File

@@ -39,6 +39,11 @@ jobs:
echo powerToysInstallerX64Url=$(jq -n "$powerToysSetup" | jq -r '[.[]|select(.name | contains("x64"))][0].browser_download_url') >> $GITHUB_OUTPUT
echo powerToysInstallerArm64Url=$(jq -n "$powerToysSetup" | jq -r '[.[]|select(.name | contains("arm64"))][0].browser_download_url') >> $GITHUB_OUTPUT
- name: Setup .NET 9.0
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- uses: microsoft/setup-msstore-cli@v1
- name: Fetch Store Credential

148
README.md
View File

@@ -11,14 +11,15 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
| | Current utilities: | |
|--------------|--------------------|--------------|
| [Advanced Paste](https://aka.ms/PowerToysOverview_AdvancedPaste) | [Always on Top](https://aka.ms/PowerToysOverview_AoT) | [PowerToys Awake](https://aka.ms/PowerToysOverview_Awake) |
| [Command Not Found](https://aka.ms/PowerToysOverview_CmdNotFound) | [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) | [Crop And Lock](https://aka.ms/PowerToysOverview_CropAndLock) |
| [Environment Variables](https://aka.ms/PowerToysOverview_EnvironmentVariables) | [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) | [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) |
| [File Locksmith](https://aka.ms/PowerToysOverview_FileLocksmith) | [Hosts File Editor](https://aka.ms/PowerToysOverview_HostsFileEditor) | [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) |
| [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) | [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [Mouse Without Borders](https://aka.ms/PowerToysOverview_MouseWithoutBorders) |
| [New+](https://aka.ms/PowerToysOverview_NewPlus) | [Peek](https://aka.ms/PowerToysOverview_Peek) | [Paste as Plain Text](https://aka.ms/PowerToysOverview_PastePlain) |
| [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) | [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) | [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) |
| [Registry Preview](https://aka.ms/PowerToysOverview_RegistryPreview) | [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) | [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) |
| [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) | [Workspaces](https://aka.ms/PowerToysOverview_Workspaces) | [ZoomIt](https://aka.ms/PowerToysOverview_ZoomIt) |
| [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) | [Command Not Found](https://aka.ms/PowerToysOverview_CmdNotFound) | [Command Palette](https://aka.ms/PowerToysOverview_CmdPal) |
| [Crop And Lock](https://aka.ms/PowerToysOverview_CropAndLock) | [Environment Variables](https://aka.ms/PowerToysOverview_EnvironmentVariables) | [FancyZones](https://aka.ms/PowerToysOverview_FancyZones) |
| [File Explorer Add-ons](https://aka.ms/PowerToysOverview_FileExplorerAddOns) | [File Locksmith](https://aka.ms/PowerToysOverview_FileLocksmith) | [Hosts File Editor](https://aka.ms/PowerToysOverview_HostsFileEditor) |
| [Image Resizer](https://aka.ms/PowerToysOverview_ImageResizer) | [Keyboard Manager](https://aka.ms/PowerToysOverview_KeyboardManager) | [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) |
| [Mouse Without Borders](https://aka.ms/PowerToysOverview_MouseWithoutBorders) | [New+](https://aka.ms/PowerToysOverview_NewPlus) | [Paste as Plain Text](https://aka.ms/PowerToysOverview_PastePlain) |
| [Peek](https://aka.ms/PowerToysOverview_Peek) | [PowerRename](https://aka.ms/PowerToysOverview_PowerRename) | [PowerToys Run](https://aka.ms/PowerToysOverview_PowerToysRun) |
| [Quick Accent](https://aka.ms/PowerToysOverview_QuickAccent) | [Registry Preview](https://aka.ms/PowerToysOverview_RegistryPreview) | [Screen Ruler](https://aka.ms/PowerToysOverview_ScreenRuler) |
| [Shortcut Guide](https://aka.ms/PowerToysOverview_ShortcutGuide) | [Text Extractor](https://aka.ms/PowerToysOverview_TextExtractor) | [Workspaces](https://aka.ms/PowerToysOverview_Workspaces) |
| [ZoomIt](https://aka.ms/PowerToysOverview_ZoomIt) |
## Installing and running Microsoft PowerToys
@@ -34,19 +35,19 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
Go to the [Microsoft PowerToys GitHub releases page][github-release-link] and click on `Assets` at the bottom to show the files available in the release. Please use the appropriate PowerToys installer that matches your machine's architecture and install scope. For most, it is `x64` and per-user.
<!-- items that need to be updated release to release -->
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.90%22
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.89%22
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.89.0/PowerToysUserSetup-0.89.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.89.0/PowerToysUserSetup-0.89.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.89.0/PowerToysSetup-0.89.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.89.0/PowerToysSetup-0.89.0-arm64.exe
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.91%22
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.90%22
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.90.0/PowerToysUserSetup-0.90.0-x64.exe
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.90.0/PowerToysUserSetup-0.90.0-arm64.exe
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.90.0/PowerToysSetup-0.90.0-x64.exe
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.90.0/PowerToysSetup-0.90.0-arm64.exe
| Description | Filename | sha256 hash |
|----------------|----------|-------------|
| Per user - x64 | [PowerToysUserSetup-0.89.0-x64.exe][ptUserX64] | B4F130CC96F321024A257499247F6FF6DA56612215ED3882E868AAE26C689E33 |
| Per user - ARM64 | [PowerToysUserSetup-0.89.0-arm64.exe][ptUserArm64] | F69B00F4E520EB09FA0D1D1669E21910C5225FE7A2EEDC0FA7C283B201A5F9C6 |
| Machine wide - x64 | [PowerToysSetup-0.89.0-x64.exe][ptMachineX64] | E18AC8F9023E341CF7DAD35367FB9DDDB6565D83D8155DBCDDB40AE8A24AE731 |
| Machine wide - ARM64 | [PowerToysSetup-0.89.0-arm64.exe][ptMachineArm64] | 17DEADEC601D6061D7AF4F487595CC36D9191813003CC2ECE381017F0EC71FBB |
| Per user - x64 | [PowerToysUserSetup-0.90.0-x64.exe][ptUserX64] | 2A6036F5B2D454084E55816C306E1E57EF1D14C916691CBDA42B469797605CE0 |
| Per user - ARM64 | [PowerToysUserSetup-0.90.0-arm64.exe][ptUserArm64] | AB2E4DC87A9D764BE897C5170E2890E174C89CA912A1916FA3AE1E427536EA4A |
| Machine wide - x64 | [PowerToysSetup-0.90.0-x64.exe][ptMachineX64] | 12801C44F43D0CC61E90DF1EFDC40E4F3C88341E0199D5B20791042D9B173DCF |
| Machine wide - ARM64 | [PowerToysSetup-0.90.0-arm64.exe][ptMachineArm64] | 2998007C8FCD7BD2770767C6502AAA2CC75B85EC30DE62986EC7005EB0014EDB |
This is our preferred method.
@@ -92,102 +93,95 @@ For guidance on developing for PowerToys, please read the [developer docs](/doc/
Our [prioritized roadmap][roadmap] of features and utilities that the core team is focusing on.
### 0.89 - February 2025 Update
### 0.90 - March 2025 Update
In this release, we focused on new features, stability, accessibility and automation.
In this release, we focused on new features, stability, and automation.
**✨Highlights**
- Enhanced Advanced Paste by adding media transcoding support to convert different video and audio file formats! Thanks [@snickler](https://github.com/snickler) for your help!
- Fixed crashes when loading thumbnails after the .NET 9 update and resolved PowerLauncher.exe blocking other MSI installers from creating shortcuts!
- Fixed accessibility issues across FancyZones, Image Resizer, and Settings to improve screen reader support and clarity!
- Enhanced UI automation framework across modules and added new tests to cover manual checks, with more improvements coming!
![Gif for Command Palette](doc/images/overview/CmdPal_Hero.gif)
### General
- New module: Command Palette ("CmdPal") - Created as the evolution of PowerToys Run with extensibility at the forefront, Command Palette is a quick launcher with a richer display and additional capabilities without sacrificing performance, allowing you to start anything with the shortcut **Win+Alt+Space**! Thanks [@zadjii-msft](https://github.com/zadjii-msft), [@niels9001](https://github.com/niels9001), [@joadoumie](https://github.com/joadoumie), [@plante-msft](https://github.com/plante-msft), [@ethanfangg](https://github.com/ethanfangg) and [@krschau](https://github.com/krschau)!
- Enhanced the Color Picker by switching from WPF UI to .NET WPF, resulting in improved themes and visual consistency across different modes. Thanks [@mantaionut](https://github.com/mantaionut)! Thanks [@Jay-o-Way](https://github.com/Jay-o-Way) and [@niels9001](https://github.com/niels9001) for helping with the review!
- Added the ability to delete files directly from Peek, enhancing file management efficiency. Thanks [@daverayment](https://github.com/daverayment) and thanks [@htcfreek](https://github.com/htcfreek) for the review!
- Added support for variables in template filenames, enabling dynamic elements like date components and environment variables for enhanced customization in New+. Thanks [@cgaarden](https://github.com/cgaarden)!
- Fixed an issue where updating PowerToys on Windows 11 did not properly update context menu entries, impacting New+, PowerRename, Image Resizer, and File Locksmith.
- Updated .NET Packages from 9.0.1 to 9.0.2. Thanks [@snickler](https://github.com/snickler) for this.
- Enabled compatibility with VS17.3 and later, for C++23. Thanks [@LNKLEO](https://github.com/LNKLEO) for this.
### Color Picker
### Advanced Paste
- Replaced WPF UI with .NET WPF for the Color Picker, enhancing compatibility and improving theme support. Thanks [@mantaionut](https://github.com/mantaionut)! Thanks [@Jay-o-Way](https://github.com/Jay-o-Way) and [@niels9001](https://github.com/niels9001) for helping with the review!
- Added media transcoding support to convert different video and audio file formats, improved UI layouts, refined clipboard handling, and integrated Semantic Kernel for smarter pasting. Thanks [@snickler](https://github.com/snickler) for your help!
### Command Palette
- Introduced the Windows Command Palette ("CmdPal"), the next iteration of PowerToys Run, designed with extensibility at its core. CmdPal includes features such as searching for installed apps, shell commands, files and WinGet package installation. This module aims to provide a more powerful and flexible launcher experience. Thanks [@zadjii-msft](https://github.com/zadjii-msft), [@niels9001](https://github.com/niels9001), [@joadoumie](https://github.com/joadoumie), [@plante-msft](https://github.com/plante-msft), and the whole team!
### FancyZones
- Fixed accessibility by improving the text for monitors, ensuring clearer naming and help text for screen readers.
- Fixed a bug where deleting a layout resulted in incorrect data being written to the JSON file.
- Fixed a bug where layout hotkeys were displayed incorrectly, ensuring the hotkey list does not include invalid entries.
- Fixed an issue where the "None" option was missing in the editor layout.
### Image Resizer
- Fixed issues with Width and Height fields in Image Resizer's Custom preset, ensuring empty values no longer cause errors, settings save correctly, and auto-scaling behaves as expected. Thanks [@daverayment](https://github.com/daverayment)!
- Fixed accessibility by ensuring screen readers announce selected image dimensions in the combo-box for better navigation.
### Monaco Preview
- Fixed open link in default browser rather than Microsoft Edge. Thanks [@OldUser101](https://github.com/OldUser101)!
### Mouse Highlighter
- Fixed a highlight released on an Administrator window will start fading, instead of staying on the screen indefinitely until the mouse button is pressed again on an unelevated window.
- Fixed warnings in ImageResizer regarding the use of variables "shellItem" and "itemName" without being initialized.
### Mouse Without Borders
- Fixed an issue in service mode where copy-paste and drag-drop file transfers didnt work, ensuring seamless file operations.
- Enabled GPO for enable/disable for Mouse Without Borders in Service Mode. Thanks [@htcfreek](https://github.com/htcfreek) for review and comments!
- Fixed code maintainability by refactoring the oversized 'Common' class in Mouse Without Borders into smaller, focused classes for better structure and clarity. Thanks [@mikeclayton](https://github.com/mikeclayton) and thanks [@htcfreek](https://github.com/htcfreek) for review!
### PowerRename
- Supported negative value as Start value in regular expression, e.g. ${start=-1314}
- Enhanced RegEx help by adding $, ^, quantifiers, and common patterns for better usability. Thanks [@PesBandi](https://github.com/PesBandi) and thanks [@htcfreek](https://github.com/htcfreek) for review.
- Enhanced the logger to properly track the file path for easier debugging.
- Refactored the "Common" class into distinct individual classes to enhance maintainability, and updated all references and unit tests to reflect these changes. Thanks [@mikeclayton](https://github.com/mikeclayton) for this!
### New+
- Added support for variables in template filenames, including date/time components, parent folder name, and environment variables. Thanks [@cgaarden](https://github.com/cgaarden)!
### Peek
- Added the ability to delete the file currently being previewed in Peek, including navigation updates and handling for deleted items. Thanks [@daverayment](https://github.com/daverayment) and thanks [@htcfreek](https://github.com/htcfreek) for your help reviewing this!
### PowerToys Run
- Fixed crashes when loading thumbnails after the .NET 9 update by disabling CETCompat.
- Fixed PowerLauncher.exe blocking other MSI installers creating shortcuts. Thanks [@OneBlue](https://github.com/OneBlue)!
- Fixed Runs dark mode detection to work reliably, preventing issues with incorrect theme detection and ensuring a smoother user experience. Thanks [@daverayment](https://github.com/daverayment)!
- Fixed list separator handling in Calculator, allowing functions with multiple arguments to work correctly across different locales. For example pow(2;3) would be replaced with pow(2,3). Thanks [@PesBandi](https://github.com/PesBandi) and thanks [@htcfreek](https://github.com/htcfreek) for review!
- Fixed angle unit conversions in the PowerToys Run calculator, allowing quick conversions between radians, degrees, and gradians. Thanks [@OldUser101](https://github.com/OldUser101)!
### Quick Accent
- Added ǎ, ǒ and ǔ to the IPA character set. Thanks [@PesBandi](https://github.com/PesBandi)!
- Added ` (backtick) and ~ (tilde) to the VK_OEM_5 character set. Thanks [@xanatos](https://github.com/xanatos)!
- Added ς (final sigma) to the Greek character set. Thanks [@IamSmeagol](https://github.com/IamSmeagol)!
- Fixed an issue where duplicated applications were shown by ensuring the shell link helper opens .ink files non-exclusively and correctly retrieves the "FullPath". Thanks [@htcfreek](https://github.com/htcfreek) and [@davidegiacometti](https://github.com/davidegiacometti) for review!
- Fixed an issue where applying round corners on Windows 11 build 22000 caused crashes.
- Async the OnRename method to unblock the thread. Thanks [@davidegiacometti](https://github.com/davidegiacometti) for review!
- Added support for using `sq` instead of `^2` in the Unit Converter. Thanks [@PesBandi](https://github.com/PesBandi)!
### Settings
- Enabled GPO for the "run at startup" setting. Thanks [@htcfreek](https://github.com/htcfreek) for review and comments!
- Fixed accessibility issue by allowing screen readers to announce the group name for secondary links in Settings pages, instead of reading link descriptions without context.
- Fixed an issue where the Color Picker shortcut was not displaying correctly in the Dashboard.
- Disabled the spell check feature in the text boxes of plugin settings for PowerToys Run. Thanks [@htcfreek](https://github.com/htcfreek)!
- Fixed an issue where InfoBars for release notes errors were not displayed properly, and added a retry button. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
### Workspaces
- Fixed if a window was last placed on a disconnected monitor, it launches minimized and repositions within the main monitor's visible area when restored, instead of remaining off-screen and invisible.
- Fixed on ARM64 to correctly display icons for packaged apps by resolving path mismatches.
### ZoomIt
- Fixed warning C4706 and related error C2220 during build. Thanks [@xanatos](https://github.com/xanatos)!
- Fixed an issue where some minimized packaged apps (e.g., Microsoft ToDo, Settings) were not snapshotted.
### Documentation
- Fixed runner-ipc.md doc on the broken link. Thanks [@daverayment](https://github.com/daverayment)!
- Fixed the new plugin checklist by updating the target framework, removing duplicates, and improving statement organization. Thanks [@hlaueriksson](https://github.com/hlaueriksson)!
- Updated runner documentation to align with the latest code structure.
- Added the FirefoxBookmark plugin to the list of Third-Party plugins for PowerToys Run. Thanks [@8LWXpg](https://github.com/8LWXpg)!
- Added the SVGL third-party plugin to PowerToys Run, enabling users to search, browse, and copy SVG logos. Thanks [@SameerJS6](https://github.com/SameerJS6)!
- Added Monaco usage for the Registry Preview.
### Development
- Stabilized pipeline on ARM64 and forked build.
- Added fuzz testing for HostUILib, added as part of pipeline for OneFuzz.
- Fixed and improved UI-Test automation framework, and added new test cases for the FancyZones and Hosts module.
- Optimized Logger function as AOT compatible, improving performance by 18%.
- Made Common.UI and Setting.UI to be AOT compatible.
- Updated WinGet configuration file location and extension. Thanks [@mdanish-kh](https://github.com/mdanish-kh)!
- Removed the Markdown file bypass to ensure CI runs for commits that only update Markdown files.
- Fixed an issue where the default generated file path exceeded the length limit of 260 characters for EnvironmentVariablesUILib.csproj, causing build failures.
- Upgraded WindowsAppSDK to 1.6.250205002 and CsWinRT to 2.2.0. Thanks [@htcfreek](https://github.com/htcfreek) for review!
- Upgraded XamlStyler to 3.2501.8 and dotnet-consolidate to 4.2.0. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
- Updated .NET Packages from 9.0.2 to 9.0.3.
- Optimized the UI Test Automation Framework and added UI test cases for the Hosts File Editor module.
- Added fuzz testing for RegistryPreview.
- Added new UI tests for the FancyZones editor, including tests for creating, duplicating, editing, and deleting layouts.
- Added telemetry code to measure the module editor open time and evaluate the benefits of applying AOT.
### What is being planned for version 0.90
### What is being planned for version 0.91
For [v0.90][github-next-release-work], we'll work on the items below:
For [v0.91][github-next-release-work], we'll work on the items below:
- New module: PowerToys Run v2
- New module: File Actions Menu
- New UI Automation tests
- Working on installer upgrades
- Upgrading keyboard manager's editor UI
- Upgrading Keyboard Manager's editor UI
- Stability / bug fixes
## PowerToys Community

View File

@@ -16,49 +16,70 @@ The 'Time and Date' plugin shows the date and time in different formats. For the
### Available formats
**Remarks**
- The following formats requires a prefix in the query:
- The following formats requires a prefix in the query when using them as date input:
- Unix Timestamp: `u`
- Unix Timestamp in milliseconds: `ums`
- Windows file time: `ft`
- OLE Automation date: `oa`
- Excel 1900 date value: `exc`
- Excel 1904 date value: `exf`
- On invalid number inputs we show a warning that tells the user which prefixes are allowed/required.
**List of available formats**
The following formats are currently available:
| Format | Example (Based on default settings) | As result | As input |
| Format | Example (Based on default settings) | As result | As input | Result as custom format only
|--------------|-----------|------------|------------|
| Time | 5:10 PM | x | x |
| Date | 3/5/2022 | x | x |
| Now | 3/5/2022 5:10 PM | x | x |
| Time UTC | 4:10 PM | x | x |
| Now UTC | 3/5/2022 4:10 PM | x | x |
| Unix Timestamp | 1646496622 | x | x |
| Unix Timestamp in milliseconds | 1646496622500 | x | x |
| Hour | 10 | x | |
| Minute | 30 | x | |
| Second | 45 | x | |
| Millisecond | 678 | x | |
| Day (Week day) | Saturday | x | |
| Day of the week | 6 | x | |
| Day of the month | 5 | x | |
| Day of the year | 64 | x | |
| Week of the month | 1 | x | |
| Week of the year (Calendar week, Week number) | 10 | x | |
| Month | March | x | |
| Month of the year | 3 | x | |
| Month and day | March 7 | x | x |
| Year | 2022 | x | |
| Era | AD | x | |
| Era abbreviation | A | x | |
| Month and year | March 2022 | x | x |
| Windows file time (Int64 number) | 637820976123938199 | x | x |
| Universal time format: YYYY-MM-DD hh:mm:ss| 2022-03-05 16:20:12Z | x | x |
| ISO 8601 | 2022-03-05T17:23:04 | x | x |
| ISO 8601 UTC | 2022-03-05T16:23:04 | x | x |
| ISO 8601 with time zone | 2022-03-05T17:23:04+01:00 | x | x |
| ISO 8601 UTC with time zone | 2022-03-05T16:23:04Z | x | x |
| RFC1123 | Sat, 05 Mar 2022 16:23:04 GMT | x | x |
| Time | 5:10 PM | x | x | |
| Date | 3/5/2022 | x | x | |
| Now | 3/5/2022 5:10 PM | x | x | |
| Time UTC | 4:10 PM | x | x | |
| Now UTC | 3/5/2022 4:10 PM | x | x | |
| Unix Timestamp | 1646496622 | x | x | |
| Unix Timestamp in milliseconds | 1646496622500 | x | x | |
| Hour | 10 | x | | |
| Minute | 30 | x | | |
| Second | 45 | x | | |
| Millisecond | 678 | x | | |
| Day (Week day) | Saturday | x | | |
| Day of the week | 6 | x | | |
| Day of the month | 5 | x | | |
| Day of the year | 64 | x | | |
| Week of the month | 1 | x | | |
| Week of the year (Calendar week, Week number) | 10 | x | | |
| Month | March | x | | |
| Month of the year | 3 | x | | |
| Month and day | March 7 | x | x | |
| Year | 2022 | x | | |
| Era | AD | x | | |
| Era abbreviation | A | x | | |
| Month and year | March 2022 | x | x | |
| Windows file time (Int64 number) | 637820976123938199 | x | x | |
| Universal time format: YYYY-MM-DD hh:mm:ss| 2022-03-05 16:20:12Z | x | x | |
| ISO 8601 | 2022-03-05T17:23:04 | x | x | |
| ISO 8601 UTC | 2022-03-05T16:23:04 | x | x | |
| ISO 8601 with time zone | 2022-03-05T17:23:04+01:00 | x | x | |
| ISO 8601 UTC with time zone | 2022-03-05T16:23:04Z | x | x | |
| RFC1123 | Sat, 05 Mar 2022 16:23:04 GMT | x | x | |
| OLE Automation date | 45723.44143763889 | | x | x |
| Excel's 1900 date value | 45723.44143763889 | | x | x |
| Excel's 1904 date value | 44261.44143763889 | | x | x |
**Custom format definition**
The user can create its own formats. One per line in the settings text box. The format of each line is `<name>=<syntax pattern>`.
If the syntax pattern starting with `UTC:` then we use the UTC time instead of the local time.
As syntax pattern the pattern from `DateTime.ToString()` and the following custom pattern are available:
- DOW: Number of the day in the week.
- WOM: Number of week in the month.
- WOY: Number of the week in the year.
- EAB: Era abbreviation.
- WFT: Windows file time.
- UXT: Unix time stamp.
- UMS: Unix time stamp in milliseconds.
- OAD: OLE Automation date.
- EXC: Excel's 1900 based date value.
- EXF: Excel's 1904 based date value.
### Add new formats
- To add a new formats you have to add them to the method `GetList()` of the [`AvailableResultsList`](/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Components/AvailableResultsList.cs) class.
@@ -73,13 +94,13 @@ The following formats are currently available:
| Key | Type | Default value | Name | Description |
|--------------|--------------|-----------|------------|------------|
| `CalendarFirstWeekRule` | Combo box | `-1` (Use system settings) | First week of the year | Configure the calendar rule for the first week of the year. |
| `FirstDayOfWeek` | Combo box | `-1` (Use system settings) | First day of the week | |
| `OnlyDateTimeNowGlobal` | Checkbox | `true` | Show only 'Time', 'Date', and 'Now' result for system time on global queries | Regardless of this setting, for global queries the first word of the query has to be a complete match. |
| `TimeWithSeconds` | Checkbox | `false` | Show time with seconds | This setting applies to the 'Time' and 'Now' result. |
| `DateWithWeekday` | Checkbox | `false` | Show date with weekday and name of month | This setting applies to the 'Date' and 'Now' result. |
| `HideNumberMessageOnGlobalQuery` | Checkbox | `false` | Hide 'Invalid number input' error message on global queries | |
| `CalendarFirstWeekRule` | Combo box | `-1` (Use system settings) | First week of the year | Configure the calendar rule for the first week of the year. |
| `FirstDayOfWeek` | Combo box | `-1` (Use system settings) | First day of the week | |
| `CustomFormats` | Multiline text box | `string.Empty` | Custom formats | Use date and time string format syntax and DOW (Day of Week), WOM (Week of Month), WOY (Week of the year), EAB (Era abbreviation), WFT (Windows File Time), UXT (Unix Time), UMS (Unix Time in milliseconds), OAD (OLE Automation date), EXC (Excel's 1900 based date value), EXF (Excel's 1904 based date value). If the format starts with UTC:, then Universal Time (UTC) is used. (Use a backslash to escape format sequences and the backslash character as text.) |
## Classes

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

View File

@@ -40,7 +40,6 @@
<RegistryValue Type="string" Name="Module_CmdPal_Deps" Value="" KeyPath="yes"/>
</RegistryKey>
<File Source="$(var.CmdPalBuildDir)AppPackages\Microsoft.CmdPal.UI_$(var.CmdPalVersion).0_Test\Dependencies\x64\Microsoft.VCLibs.x64.14.00.Desktop.appx" />
<File Source="$(var.CmdPalBuildDir)AppPackages\Microsoft.CmdPal.UI_$(var.CmdPalVersion).0_Test\Dependencies\x64\Microsoft.WindowsAppRuntime.1.6.msix" />
</Component>
</DirectoryRef>
<?else ?>
@@ -50,7 +49,6 @@
<RegistryValue Type="string" Name="Module_CmdPal_Deps" Value="" KeyPath="yes"/>
</RegistryKey>
<File Source="$(var.CmdPalBuildDir)AppPackages\Microsoft.CmdPal.UI_$(var.CmdPalVersion).0_Test\Dependencies\arm64\Microsoft.VCLibs.ARM64.14.00.Desktop.appx" />
<File Source="$(var.CmdPalBuildDir)AppPackages\Microsoft.CmdPal.UI_$(var.CmdPalVersion).0_Test\Dependencies\arm64\Microsoft.WindowsAppRuntime.1.6.msix" />
</Component>
</DirectoryRef>
<?endif ?>

View File

@@ -238,7 +238,7 @@ namespace package {
PackageManager packageManager;
// Declare use of an external location
DeploymentOptions options = DeploymentOptions::ForceApplicationShutdown;
DeploymentOptions options = DeploymentOptions::ForceTargetApplicationShutdown;
Collections::IVector<Uri> uris = winrt::single_threaded_vector<Uri>();
if (!dependencies.empty())
@@ -293,4 +293,4 @@ namespace package {
return true;
}
}
}

View File

@@ -10,6 +10,7 @@
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
<PackageVersion Include="Shmuelie.WinRTServer" Version="2.1.1" />
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
<PackageVersion Include="System.Text.Json" Version="9.0.3" />
</ItemGroup>

View File

@@ -2,28 +2,32 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.CommandPalette.Extensions;
using Shmuelie.WinRTServer;
using Shmuelie.WinRTServer.CsWinRT;
using System;
using System.Threading;
using Microsoft.CommandPalette.Extensions;
using System.Threading.Tasks;
namespace TemplateCmdPalExtension;
public class Program
{
[MTAThread]
public static void Main(string[] args)
public static async Task Main(string[] args)
{
if (args.Length > 0 && args[0] == "-RegisterProcessAsComServer")
{
using ExtensionServer server = new();
var extensionDisposedEvent = new ManualResetEvent(false);
var extensionInstance = new TemplateCmdPalExtension(extensionDisposedEvent);
await using global::Shmuelie.WinRTServer.ComServer server = new();
ManualResetEvent extensionDisposedEvent = new(false);
// We are instantiating an extension instance once above, and returning it every time the callback in RegisterExtension below is called.
// This makes sure that only one instance of SampleExtension is alive, which is returned every time the host asks for the IExtension object.
// If you want to instantiate a new instance each time the host asks, create the new instance inside the delegate.
server.RegisterExtension(() => extensionInstance);
TemplateCmdPalExtension extensionInstance = new(extensionDisposedEvent);
server.RegisterClass<TemplateCmdPalExtension, IExtension>(() => extensionInstance);
server.Start();
// This will make the main thread wait until the event is signalled by the extension class.
// Since we have single instance of the extension object, we exit as soon as it is disposed.
extensionDisposedEvent.WaitOne();

View File

@@ -9,9 +9,7 @@ using Microsoft.CommandPalette.Extensions;
namespace TemplateCmdPalExtension;
[ComVisible(true)]
[Guid("FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF")]
[ComDefaultInterface(typeof(IExtension))]
public sealed partial class TemplateCmdPalExtension : IExtension, IDisposable
{
private readonly ManualResetEvent _extensionDisposedEvent;

View File

@@ -43,6 +43,7 @@
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Web.WebView2" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="Shmuelie.WinRTServer" />
</ItemGroup>
<!--

View File

@@ -22,7 +22,11 @@ public partial class AllAppsCommandProvider : CommandProvider
Icon = IconHelpers.FromRelativePath("Assets\\AllApps.svg");
Settings = AllAppsSettings.Instance.Settings;
_listItem = new(Page) { Subtitle = Resources.search_installed_apps };
_listItem = new(Page)
{
Subtitle = Resources.search_installed_apps,
MoreCommands = [new CommandContextItem(AllAppsSettings.Instance.Settings.SettingsPage)],
};
}
public override ICommandItem[] TopLevelCommands() => [_listItem];

View File

@@ -25,7 +25,7 @@ internal sealed partial class AddBookmarkPage : ContentPage
{
var name = bookmark?.Name ?? string.Empty;
var url = bookmark?.Bookmark ?? string.Empty;
Icon = new IconInfo("\ued0e");
Icon = IconHelpers.FromRelativePath("Assets\\Bookmark.svg");
var isAdd = string.IsNullOrEmpty(name) && string.IsNullOrEmpty(url);
Title = isAdd ? Resources.bookmarks_add_title : Resources.bookmarks_edit_name;
Name = isAdd ? Resources.bookmarks_add_name : Resources.bookmarks_edit_name;

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,20 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.84868 15.8874C3.49425 16.1693 3 15.8893 3 15.4067V3.56616C3 2.14891 4.03946 1 5.3217 1H10.6783C11.9605 1 13 2.14891 13 3.56616V15.4067C13 15.8893 12.5057 16.1693 12.1513 15.8874L7.99999 12.5863L3.84868 15.8874Z" fill="url(#paint0_linear_1900_17905)"/>
<path d="M9.17749 1.02412C9.86491 0.564808 10.6731 0.31963 11.4998 0.319592C12.6082 0.320929 13.6707 0.761812 14.4545 1.54554C15.2382 2.32931 15.6791 3.39196 15.6804 4.50037C15.6803 5.32705 15.4352 6.13515 14.9759 6.82251C14.5165 7.50998 13.8636 8.04578 13.0998 8.36219C12.3359 8.6786 11.4954 8.76138 10.6844 8.60008C9.87352 8.43878 9.12865 8.04063 8.54401 7.45599C7.95937 6.87135 7.56122 6.12647 7.39992 5.31556C7.23862 4.50464 7.3214 3.6641 7.63781 2.90023C7.95421 2.13636 8.49003 1.48347 9.17749 1.02412Z" fill="url(#paint1_linear_1900_17905)" stroke="url(#paint2_linear_1900_17905)" stroke-width="0.639184"/>
<rect x="8" y="4" width="7" height="1" rx="0.5" fill="#0C58A2"/>
<rect x="11" y="8" width="7" height="1" rx="0.5" transform="rotate(-90 11 8)" fill="#0C58A2"/>
<defs>
<linearGradient id="paint0_linear_1900_17905" x1="4.2484" y1="-0.184382" x2="12.4694" y2="16.9798" gradientUnits="userSpaceOnUse">
<stop stop-color="#0A7ACC"/>
<stop offset="1" stop-color="#0E5497"/>
</linearGradient>
<linearGradient id="paint1_linear_1900_17905" x1="13.7504" y1="8.39775" x2="9.24963" y2="0.60225" gradientUnits="userSpaceOnUse">
<stop stop-color="#FCFCFC"/>
<stop offset="1" stop-color="#E7E7E7"/>
</linearGradient>
<linearGradient id="paint2_linear_1900_17905" x1="9.75" y1="5.63474e-08" x2="12.8347" y2="9.07039" gradientUnits="userSpaceOnUse">
<stop stop-color="#173A73" stop-opacity="0.1"/>
<stop offset="1" stop-color="#173A73" stop-opacity="0.25"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -9,6 +9,9 @@
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
<ProjectPriFileName>Microsoft.CmdPal.Ext.Bookmarks.pri</ProjectPriFileName>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Bookmark.svg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
<ProjectReference Include="..\..\Exts\Microsoft.CmdPal.Ext.Indexer\Microsoft.CmdPal.Ext.Indexer.csproj" />
@@ -21,6 +24,15 @@
<AutoGen>True</AutoGen>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\Bookmark.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Bookmark.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -141,6 +141,7 @@ public sealed partial class SaveCommand : InvokableCommand
internal sealed partial class FallbackCalculatorItem : FallbackCommandItem
{
private readonly CopyTextCommand _copyCommand = new(string.Empty);
private static readonly IconInfo _cachedIcon = IconHelpers.FromRelativePath("Assets\\Calculator.svg");
public FallbackCalculatorItem()
: base(new NoOpCommand(), Resources.calculator_title)
@@ -149,7 +150,7 @@ internal sealed partial class FallbackCalculatorItem : FallbackCommandItem
_copyCommand.Name = string.Empty;
Title = string.Empty;
Subtitle = Resources.calculator_placeholder_text;
Icon = new IconInfo("\ue8ef"); // Calculator
Icon = _cachedIcon;
}
public override void UpdateQuery(string query)

View File

@@ -53,7 +53,11 @@ internal static class RegistryHelper
}
var baseKey = query.Split('\\').FirstOrDefault() ?? string.Empty;
var subKey = query.Replace(baseKey, string.Empty, StringComparison.InvariantCultureIgnoreCase).TrimStart('\\');
var subKey = string.Empty;
if (!string.IsNullOrEmpty(baseKey))
{
subKey = query.Replace(baseKey, string.Empty, StringComparison.InvariantCultureIgnoreCase).TrimStart('\\');
}
var baseKeyResult = _baseKeys
.Where(found => found.Key.StartsWith(baseKey, StringComparison.InvariantCultureIgnoreCase))

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@@ -0,0 +1,66 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1887_18142)">
<rect y="4.5" width="3.75" height="1.25" fill="url(#paint0_linear_1887_18142)"/>
<rect y="6.75" width="3.75" height="1.25" fill="url(#paint1_linear_1887_18142)"/>
<rect y="9" width="3.75" height="1.25" fill="url(#paint2_linear_1887_18142)"/>
<rect y="11.25" width="3.75" height="1.25" fill="url(#paint3_linear_1887_18142)"/>
<path d="M2.62973 4.60404C2.69939 4.25294 3.00745 4 3.36539 4H14.1219C14.5947 4 14.9495 4.43219 14.8575 4.89596L13.3694 12.396C13.2998 12.7471 12.9917 13 12.6338 13H1.8773C1.40448 13 1.04962 12.5678 1.14164 12.104L2.62973 4.60404Z" fill="url(#paint4_linear_1887_18142)"/>
<path opacity="0.8" d="M3.31 5.05188C3.34489 4.87639 3.49889 4.75 3.67781 4.75H13.6685C13.905 4.75 14.0824 4.9662 14.0363 5.19812L12.6943 11.9481C12.6594 12.1236 12.5054 12.25 12.3265 12.25H2.3358C2.09933 12.25 1.92189 12.0338 1.968 11.8019L3.31 5.05188Z" fill="url(#paint5_linear_1887_18142)"/>
<path opacity="0.8" fill-rule="evenodd" clip-rule="evenodd" d="M3.6776 4.75C3.49869 4.75 3.34469 4.87639 3.3098 5.05188L1.9678 11.8019C1.96623 11.8097 1.96492 11.8176 1.96387 11.8254L3.26085 5.30188C3.29574 5.12639 3.44974 5 3.62865 5H13.6194C13.8478 5 14.0212 5.20177 13.9911 5.42457L14.0361 5.19812C14.0822 4.9662 13.9048 4.75 13.6683 4.75H3.6776Z" fill="url(#paint6_linear_1887_18142)"/>
<g filter="url(#filter0_dd_1887_18142)">
<path d="M4.47597 6.85475C4.54535 6.50332 4.85356 6.25 5.21178 6.25L11.3792 6.25C11.8517 6.25 12.2065 6.68168 12.115 7.14525L11.5227 10.1453C11.4534 10.4967 11.1452 10.75 10.7869 10.75H4.61956C4.14704 10.75 3.79225 10.3183 3.88376 9.85475L4.47597 6.85475Z" fill="url(#paint7_linear_1887_18142)"/>
</g>
<path d="M5.14006 7.30488C5.17373 7.12799 5.32838 7 5.50844 7H10.912C11.1472 7 11.3243 7.21405 11.2804 7.44512L11.0424 8.69512C11.0087 8.87201 10.8541 9 10.674 9H5.2705C5.03528 9 4.85813 8.78595 4.90211 8.55488L5.14006 7.30488Z" fill="white"/>
</g>
<defs>
<filter id="filter0_dd_1887_18142" x="3.36914" y="5.75" width="9.26074" height="5.5" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="0.0833333"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1887_18142"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="0.25"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1887_18142" result="effect2_dropShadow_1887_18142"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1887_18142" result="shape"/>
</filter>
<linearGradient id="paint0_linear_1887_18142" x1="3.75" y1="5.39286" x2="3.14495e-08" y2="5.39286" gradientUnits="userSpaceOnUse">
<stop stop-color="#28AFEA" stop-opacity="0.8"/>
<stop offset="1" stop-color="#28AFEA" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint1_linear_1887_18142" x1="3.75" y1="7.64286" x2="3.14495e-08" y2="7.64286" gradientUnits="userSpaceOnUse">
<stop stop-color="#28AFEA" stop-opacity="0.8"/>
<stop offset="1" stop-color="#28AFEA" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint2_linear_1887_18142" x1="3.75" y1="9.89286" x2="3.14495e-08" y2="9.89286" gradientUnits="userSpaceOnUse">
<stop stop-color="#28AFEA" stop-opacity="0.8"/>
<stop offset="1" stop-color="#28AFEA" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint3_linear_1887_18142" x1="3.75" y1="12.1429" x2="3.14495e-08" y2="12.1429" gradientUnits="userSpaceOnUse">
<stop stop-color="#28AFEA" stop-opacity="0.8"/>
<stop offset="1" stop-color="#28AFEA" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint4_linear_1887_18142" x1="5.4463" y1="4" x2="7.3315" y2="13.4932" gradientUnits="userSpaceOnUse">
<stop stop-color="#3CCBF4"/>
<stop offset="1" stop-color="#1493DF"/>
</linearGradient>
<linearGradient id="paint5_linear_1887_18142" x1="4.41381" y1="4.75" x2="7.74261" y2="12.255" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#E8F4FF"/>
</linearGradient>
<linearGradient id="paint6_linear_1887_18142" x1="4.4136" y1="4.75" x2="7.7424" y2="12.255" gradientUnits="userSpaceOnUse">
<stop stop-color="white"/>
<stop offset="1" stop-color="#E8F4FF"/>
</linearGradient>
<linearGradient id="paint7_linear_1887_18142" x1="6.44166" y1="6.25" x2="7.22393" y2="11.0565" gradientUnits="userSpaceOnUse">
<stop stop-color="#3CCBF4"/>
<stop offset="1" stop-color="#1493DF"/>
</linearGradient>
<clipPath id="clip0_1887_18142">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@@ -7,6 +7,9 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Run.svg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
</ItemGroup>
@@ -17,19 +20,18 @@
<AutoGen>True</AutoGen>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\Run.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Run.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Remove="Assets\Run_V2_2x.svg" />
</ItemGroup>
<ItemGroup>
<Content Update="Assets\Run_V2_2x.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,15 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="5.5" y="0.5" width="5" height="6" rx="2.5" stroke="#666666"/>
<rect x="2" y="4" width="12" height="12" rx="3" fill="url(#paint0_linear_1909_18087)"/>
<circle cx="8" cy="10" r="2" fill="url(#paint1_linear_1909_18087)"/>
<defs>
<linearGradient id="paint0_linear_1909_18087" x1="2.5" y1="4" x2="12.5" y2="16" gradientUnits="userSpaceOnUse">
<stop stop-color="#E8EDF2"/>
<stop offset="1" stop-color="#C0C1C1"/>
</linearGradient>
<linearGradient id="paint1_linear_1909_18087" x1="6.5" y1="8" x2="9.5" y2="12.5" gradientUnits="userSpaceOnUse">
<stop stop-color="#666666"/>
<stop offset="1" stop-color="#666666"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 566 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 726 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 679 B

View File

@@ -33,11 +33,11 @@ internal static class Commands
/// Returns a list with all system command results
/// </summary>
/// <param name="isUefi">Value indicating if the system is booted in uefi mode</param>
/// <param name="splitRecycleBinResults">Value indicating if we should show two results for Recycle Bin.</param>
/// <param name="hideEmptyRecycleBin">Value indicating if we should hide the Empty Recycle Bin command.</param>
/// <param name="confirmCommands">A value indicating if the user should confirm the system commands</param>
/// <param name="emptyRBSuccessMessage">Show a success message after empty Recycle Bin.</param>
/// <returns>A list of all results</returns>
public static List<IListItem> GetSystemCommands(bool isUefi, bool splitRecycleBinResults, bool confirmCommands, bool emptyRBSuccessMessage)
public static List<IListItem> GetSystemCommands(bool isUefi, bool hideEmptyRecycleBin, bool confirmCommands, bool emptyRBSuccessMessage)
{
var results = new List<IListItem>();
results.AddRange(new[]
@@ -81,7 +81,7 @@ internal static class Commands
});
// Show Recycle Bin results based on setting.
if (splitRecycleBinResults)
if (!hideEmptyRecycleBin)
{
results.AddRange(new[]
{
@@ -142,6 +142,7 @@ internal static class Commands
}
CompositeFormat sysIpv4DescriptionCompositeFormate = CompositeFormat.Parse(Resources.Microsoft_plugin_sys_ip4_description);
CompositeFormat sysIpv6DescriptionCompositeFormate = CompositeFormat.Parse(Resources.Microsoft_plugin_sys_ip6_description);
CompositeFormat sysMacDescriptionCompositeFormate = CompositeFormat.Parse(Resources.Microsoft_plugin_sys_mac_description);
var hideDisconnectedNetworkInfo = manager.HideDisconnectedNetworkInfo;
@@ -171,7 +172,7 @@ internal static class Commands
results.Add(new ListItem(new CopyTextCommand(intInfo.GetConnectionDetails()))
{
Title = intInfo.IPv6Primary,
Subtitle = string.Format(CultureInfo.InvariantCulture, sysIpv4DescriptionCompositeFormate, intInfo.ConnectionName),
Subtitle = string.Format(CultureInfo.InvariantCulture, sysIpv6DescriptionCompositeFormate, intInfo.ConnectionName),
Icon = Icons.NetworkAdapterIcon,
Details = new Details() { Title = Resources.Microsoft_plugin_ext_connection_details, Body = intInfo.GetConnectionDetails() },
});
@@ -184,7 +185,7 @@ internal static class Commands
Title = intInfo.PhysicalAddress,
Subtitle = string.Format(CultureInfo.InvariantCulture, sysMacDescriptionCompositeFormate, intInfo.Adapter, intInfo.ConnectionName),
Icon = Icons.NetworkAdapterIcon,
Details = new Details() { Title = Resources.Microsoft_plugin_ext_connection_details, Body = intInfo.GetConnectionDetails() },
Details = new Details() { Title = Resources.Microsoft_plugin_ext_adapter_details, Body = intInfo.GetAdapterDetails() },
});
}
}
@@ -203,12 +204,12 @@ internal static class Commands
var isBootedInUefiMode = Win32Helpers.GetSystemFirmwareType() == FirmwareType.Uefi;
var separateEmptyRB = manager.ShowSeparateResultForEmptyRecycleBin;
var hideEmptyRB = manager.HideEmptyRecycleBin;
var confirmSystemCommands = manager.ShowDialogToConfirmCommand;
var showSuccessOnEmptyRB = manager.ShowSuccessMessageAfterEmptyingRecycleBin;
// normal system commands are fast and can be returned immediately
var systemCommands = Commands.GetSystemCommands(isBootedInUefiMode, separateEmptyRB, confirmSystemCommands, showSuccessOnEmptyRB);
var systemCommands = Commands.GetSystemCommands(isBootedInUefiMode, hideEmptyRB, confirmSystemCommands, showSuccessOnEmptyRB);
list.AddRange(systemCommands);
list.AddRange(networkConnectionResults);

View File

@@ -8,11 +8,11 @@ namespace Microsoft.CmdPal.Ext.System.Helpers;
public static partial class Icons
{
public static IconInfo FirmwareSettingsIcon { get; } = IconHelpers.FromRelativePaths("Microsoft.CmdPal.Ext.System\\Assets\\logoff.light.png", "Microsoft.CmdPal.Ext.System\\Assets\\logoff.dark.png");
public static IconInfo FirmwareSettingsIcon { get; } = new IconInfo("\uE950");
public static IconInfo LockIcon { get; } = new IconInfo("\uE72E");
public static IconInfo LogoffIcon { get; } = IconHelpers.FromRelativePaths("Microsoft.CmdPal.Ext.System\\Assets\\logoff.light.png", "Microsoft.CmdPal.Ext.System\\Assets\\logoff.dark.png");
public static IconInfo LogoffIcon { get; } = new IconInfo("\uF3B1");
public static IconInfo NetworkAdapterIcon { get; } = new IconInfo("\uEDA3");
@@ -22,5 +22,5 @@ public static partial class Icons
public static IconInfo ShutdownIcon { get; } = new IconInfo("\uE7E8");
public static IconInfo SleepIcon { get; } = IconHelpers.FromRelativePaths("Microsoft.CmdPal.Ext.System\\Assets\\sleep.light.png", "Microsoft.CmdPal.Ext.System\\Assets\\sleep.dark.png");
public static IconInfo SleepIcon { get; } = new IconInfo("\uE708");
}

View File

@@ -19,6 +19,14 @@ namespace Microsoft.CmdPal.Ext.System.Helpers;
/// </summary>
internal sealed class NetworkConnectionProperties
{
/// <summary>
/// Decimal unicode value for green circle emoji.
/// We need to generate it in the code because it does not render using Markdown emoji syntax or Unicode character syntax.
/// </summary>
/// <seealso cref="https://github.com/CommunityToolkit/Labs-Windows/blob/main/components/MarkdownTextBlock/samples/MarkdownTextBlock.md"/>
/// <seealso cref="https://github.com/xoofx/markdig/blob/master/src/Markdig/Extensions/Emoji/EmojiMapping.cs"/>
private const int GreenCircleCharacter = 128994;
/// <summary>
/// Gets the name of the adapter
/// </summary>
@@ -161,12 +169,12 @@ internal sealed class NetworkConnectionProperties
/// <returns>String with the details</returns>
internal string GetAdapterDetails()
{
return $"{Resources.Microsoft_plugin_sys_AdapterName}: {Adapter}" +
$"\n{Resources.Microsoft_plugin_sys_PhysicalAddress}: {PhysicalAddress}" +
$"\n{Resources.Microsoft_plugin_sys_Speed}: {GetFormattedSpeedValue(Speed)}" +
$"\n{Resources.Microsoft_plugin_sys_Type}: {GetAdapterTypeAsString(Type)}" +
$"\n{Resources.Microsoft_plugin_sys_State}: " + (State == OperationalStatus.Up ? Resources.Microsoft_plugin_sys_Connected : Resources.Microsoft_plugin_sys_Disconnected) +
$"\n{Resources.Microsoft_plugin_sys_ConnectionName}: {ConnectionName}";
return $"**{Resources.Microsoft_plugin_sys_AdapterName}:** {Adapter}" +
$"\n\n**{Resources.Microsoft_plugin_sys_State}:** " + (State == OperationalStatus.Up ? char.ConvertFromUtf32(GreenCircleCharacter) + " " + Resources.Microsoft_plugin_sys_Connected : ":red_circle: " + Resources.Microsoft_plugin_sys_Disconnected) +
$"\n\n**{Resources.Microsoft_plugin_sys_PhysicalAddress}:** {PhysicalAddress}" +
$"\n\n**{Resources.Microsoft_plugin_sys_Speed}:** {GetFormattedSpeedValue(Speed)}" +
$"\n\n**{Resources.Microsoft_plugin_sys_Type}:** {GetAdapterTypeAsString(Type)}" +
$"\n\n**{Resources.Microsoft_plugin_sys_ConnectionName}:** {ConnectionName}";
}
/// <summary>
@@ -175,24 +183,24 @@ internal sealed class NetworkConnectionProperties
/// <returns>String with the details</returns>
internal string GetConnectionDetails()
{
return $"{Resources.Microsoft_plugin_sys_ConnectionName}: {ConnectionName}" +
$"\n{Resources.Microsoft_plugin_sys_State}: " + (State == OperationalStatus.Up ? Resources.Microsoft_plugin_sys_Connected : Resources.Microsoft_plugin_sys_Disconnected) +
$"\n{Resources.Microsoft_plugin_sys_Type}: {GetAdapterTypeAsString(Type)}" +
$"\n{Resources.Microsoft_plugin_sys_Suffix}: {Suffix}" +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip4Address}: ", IPv4) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip4SubnetMask}: ", IPv4Mask) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Address}:\n\t", IPv6Global) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Temp}:\n\t", IPv6Temporary) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Link}:\n\t", IPv6LinkLocal) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Site}:\n\t", IPv6SiteLocal) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Ip6Unique}:\n\t", IPv6UniqueLocal) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Gateways}:\n\t", Gateways) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Dhcp}:\n\t", DhcpServers == null ? string.Empty : DhcpServers) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Dns}:\n\t", DnsServers == null ? string.Empty : DnsServers) +
CreateIpInfoForDetailsText($"{Resources.Microsoft_plugin_sys_Wins}:\n\t", WinsServers == null ? string.Empty : WinsServers) +
$"\n\n{Resources.Microsoft_plugin_sys_AdapterName}: {Adapter}" +
$"\n{Resources.Microsoft_plugin_sys_PhysicalAddress}: {PhysicalAddress}" +
$"\n{Resources.Microsoft_plugin_sys_Speed}: {GetFormattedSpeedValue(Speed)}";
return $"**{Resources.Microsoft_plugin_sys_ConnectionName}:** {ConnectionName}" +
$"\n\n**{Resources.Microsoft_plugin_sys_State}:** " + (State == OperationalStatus.Up ? char.ConvertFromUtf32(GreenCircleCharacter) + " " + Resources.Microsoft_plugin_sys_Connected : ":red_circle: " + Resources.Microsoft_plugin_sys_Disconnected) +
$"\n\n**{Resources.Microsoft_plugin_sys_Type}:** {GetAdapterTypeAsString(Type)}" +
$"\n\n**{Resources.Microsoft_plugin_sys_Suffix}:** {Suffix}" +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip4Address}:** ", IPv4) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip4SubnetMask}:** ", IPv4Mask) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip6Address}:**\n\n* ", IPv6Global) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip6Temp}:**\n\n* ", IPv6Temporary) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip6Link}:**\n\n* ", IPv6LinkLocal) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip6Site}:**\n\n* ", IPv6SiteLocal) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Ip6Unique}:**\n\n* ", IPv6UniqueLocal) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Gateways}:**\n\n* ", Gateways) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Dhcp}:**\n\n* ", DhcpServers == null ? string.Empty : DhcpServers) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Dns}:**\n\n* ", DnsServers == null ? string.Empty : DnsServers) +
CreateIpInfoForDetailsText($"**{Resources.Microsoft_plugin_sys_Wins}:**\n\n* ", WinsServers == null ? string.Empty : WinsServers) +
$"\n\n**{Resources.Microsoft_plugin_sys_AdapterName}:** {Adapter}" +
$"\n\n**{Resources.Microsoft_plugin_sys_PhysicalAddress}:** {PhysicalAddress}" +
$"\n\n**{Resources.Microsoft_plugin_sys_Speed}:** {GetFormattedSpeedValue(Speed)}";
}
/// <summary>
@@ -304,13 +312,13 @@ internal sealed class NetworkConnectionProperties
switch (property)
{
case string:
return $"\n{title}{property}";
return string.IsNullOrWhiteSpace(property) ? string.Empty : $"\n\n{title}{property}";
case List<string> listString:
return listString.Count == 0 ? string.Empty : $"\n{title}{string.Join("\n\t", property)}";
return listString.Count == 0 ? string.Empty : $"\n\n{title}{string.Join("\n\n* ", property)}";
case List<IPAddress> listIP:
return listIP.Count == 0 ? string.Empty : $"\n{title}{string.Join("\n\t", property)}";
return listIP.Count == 0 ? string.Empty : $"\n\n{title}{string.Join("\n\n* ", property)}";
case IPAddressCollection collectionIP:
return collectionIP.Count == 0 ? string.Empty : $"\n{title}{string.Join("\n\t", property)}";
return collectionIP.Count == 0 ? string.Empty : $"\n\n{title}{string.Join("\n\n* ", property)}";
case null:
return string.Empty;
default:

View File

@@ -25,23 +25,23 @@ public class SettingsManager : JsonSettingsManager
Resources.Microsoft_plugin_sys_RecycleBin_ShowEmptySuccessMessage,
false); // TODO -- double check default value
private readonly ToggleSetting _showSeparateResultForEmptyRecycleBin = new(
Namespaced(nameof(ShowSeparateResultForEmptyRecycleBin)),
Resources.Microsoft_plugin_sys_RecycleBin_ShowEmptySeparate,
Resources.Microsoft_plugin_sys_RecycleBin_ShowEmptySeparate,
true); // TODO -- double check default value
private readonly ToggleSetting _hideEmptyRecycleBin = new(
Namespaced(nameof(HideEmptyRecycleBin)),
Resources.Microsoft_plugin_sys_RecycleBin_HideEmpty,
Resources.Microsoft_plugin_sys_RecycleBin_HideEmpty,
false);
private readonly ToggleSetting _hideDisconnectedNetworkInfo = new(
Namespaced(nameof(HideDisconnectedNetworkInfo)),
Resources.Microsoft_plugin_ext_settings_hideDisconnectedNetworkInfo,
Resources.Microsoft_plugin_ext_settings_hideDisconnectedNetworkInfo,
true); // TODO -- double check default value
false);
public bool ShowDialogToConfirmCommand => _showDialogToConfirmCommand.Value;
public bool ShowSuccessMessageAfterEmptyingRecycleBin => _showSuccessMessageAfterEmptyingRecycleBin.Value;
public bool ShowSeparateResultForEmptyRecycleBin => _showSeparateResultForEmptyRecycleBin.Value;
public bool HideEmptyRecycleBin => _hideEmptyRecycleBin.Value;
public bool HideDisconnectedNetworkInfo => _hideDisconnectedNetworkInfo.Value;
@@ -60,7 +60,7 @@ public class SettingsManager : JsonSettingsManager
Settings.Add(_showDialogToConfirmCommand);
Settings.Add(_showSuccessMessageAfterEmptyingRecycleBin);
Settings.Add(_showSeparateResultForEmptyRecycleBin);
Settings.Add(_hideEmptyRecycleBin);
Settings.Add(_hideDisconnectedNetworkInfo);
// Load settings from file upon initialization

View File

@@ -17,6 +17,14 @@
<AutoGen>True</AutoGen>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\SystemCommand.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\SystemCommand.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -15,7 +15,8 @@ public sealed partial class SystemCommandPage : ListPage
public SystemCommandPage(SettingsManager settingsManager)
{
Title = Resources.Microsoft_plugin_ext_system_page_name;
Icon = new IconInfo("\uE72E");
Name = Resources.Microsoft_plugin_ext_system_page_name;
Icon = IconHelpers.FromRelativePath("Assets\\SystemCommand.svg");
_settingsManager = settingsManager;
ShowDetails = true;
}

View File

@@ -159,6 +159,15 @@ namespace Microsoft.CmdPal.Ext.System {
}
}
/// <summary>
/// Looks up a localized string similar to Adapter Details.
/// </summary>
public static string Microsoft_plugin_ext_adapter_details {
get {
return ResourceManager.GetString("Microsoft_plugin_ext_adapter_details", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connection Details.
/// </summary>
@@ -528,6 +537,15 @@ namespace Microsoft.CmdPal.Ext.System {
}
}
/// <summary>
/// Looks up a localized string similar to Hide the Empty Recycle Bin command.
/// </summary>
public static string Microsoft_plugin_sys_RecycleBin_HideEmpty {
get {
return ResourceManager.GetString("Microsoft_plugin_sys_RecycleBin_HideEmpty", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Recycle Bin is empty..
/// </summary>
@@ -546,15 +564,6 @@ namespace Microsoft.CmdPal.Ext.System {
}
}
/// <summary>
/// Looks up a localized string similar to Show separate result for Empty Recycle Bin command.
/// </summary>
public static string Microsoft_plugin_sys_RecycleBin_ShowEmptySeparate {
get {
return ResourceManager.GetString("Microsoft_plugin_sys_RecycleBin_ShowEmptySeparate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Show a success message after emptying the Recycle Bin.
/// </summary>

View File

@@ -151,6 +151,9 @@
<data name="Microsoft_plugin_ext_connection_details" xml:space="preserve">
<value>Connection Details</value>
</data>
<data name="Microsoft_plugin_ext_adapter_details" xml:space="preserve">
<value>Adapter Details</value>
</data>
<data name="Microsoft_plugin_ext_copy" xml:space="preserve">
<value>Copy to clipboard</value>
</data>
@@ -309,8 +312,8 @@
<value>Empty Recycle Bin</value>
<comment>This should align to the action in Windows of emptying the recycle bin on your computer.</comment>
</data>
<data name="Microsoft_plugin_sys_RecycleBin_ShowEmptySeparate" xml:space="preserve">
<value>Show separate result for Empty Recycle Bin command</value>
<data name="Microsoft_plugin_sys_RecycleBin_HideEmpty" xml:space="preserve">
<value>Hide the Empty Recycle Bin command</value>
</data>
<data name="Microsoft_plugin_sys_RecycleBin_ShowEmptySuccessMessage" xml:space="preserve">
<value>Show a success message after emptying the Recycle Bin</value>

View File

@@ -22,13 +22,14 @@ public partial class SystemCommandExtensionProvider : CommandProvider
_commands = [
new CommandItem(Page)
{
Title = DisplayName,
Title = Resources.Microsoft_plugin_ext_system_page_name,
Icon = Page.Icon,
MoreCommands = [new CommandContextItem(_settingsManager.Settings.SettingsPage)],
},
];
Icon = Page.Icon;
Settings = _settingsManager.Settings;
}
public override ICommandItem[] TopLevelCommands()

View File

@@ -20,7 +20,7 @@ public sealed partial class SystemCommandsCache
{
var isBootedInUefiMode = Win32Helpers.GetSystemFirmwareType() == FirmwareType.Uefi;
var separateEmptyRB = manager.ShowSeparateResultForEmptyRecycleBin;
var separateEmptyRB = manager.HideEmptyRecycleBin;
var confirmSystemCommands = manager.ShowDialogToConfirmCommand;
var showSuccessOnEmptyRB = manager.ShowSuccessMessageAfterEmptyingRecycleBin;

View File

@@ -268,7 +268,7 @@ namespace Microsoft.CmdPal.Ext.TimeDate {
}
/// <summary>
/// Looks up a localized string similar to Time &amp;amp; Date.
/// Looks up a localized string similar to Time and Date.
/// </summary>
public static string Microsoft_plugin_timedate_main_page_title {
get {

View File

@@ -370,7 +370,7 @@
<value>Error: Invalid input</value>
</data>
<data name="Microsoft_plugin_timedate_main_page_title" xml:space="preserve">
<value>Time &amp;amp; Date</value>
<value>Time and Date</value>
</data>
<data name="Microsoft_plugin_timedate_InvalidInput_ErrorMessageSubTitle" xml:space="preserve">
<value>Valid prefixes: 'u' for Unix Timestamp, 'ums' for Unix Timestamp in milliseconds, 'ft' for Windows file time</value>

View File

@@ -32,6 +32,7 @@ public partial class TimeDateCommandsProvider : CommandProvider
};
Icon = _timeDateExtensionPage.Icon;
Settings = _settingsManager.Settings;
}
private string GetTranslatedPluginDescription()

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,14 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.64706 0C9.69012 0 10.5357 0.884576 10.5357 1.97576L10.5351 2.4H13.2353C13.6576 2.4 14 2.75818 14 3.2V7C13.4477 7 13 7.44772 13 8C13 8.55229 13.4477 9 14 9V12.8023C14 13.2442 13.6576 13.6023 13.2353 13.6023L10.5351 13.6016L10.5357 14.0242C10.5357 15.1154 9.69012 16 8.64706 16C7.604 16 6.75846 15.1154 6.75846 14.0242L6.75823 13.6016L4.05882 13.6023C3.63649 13.6023 3.29412 13.2442 3.29412 12.8023L3.29335 9.9768L2.88859 9.97696C1.84555 9.97696 1 9.09232 1 8.0012C1 6.91 1.84555 6.02542 2.88859 6.02542L3.29335 6.0248L3.29412 3.2C3.29412 2.75818 3.63649 2.4 4.05882 2.4H6.75823L6.75846 1.97576C6.75846 0.884576 7.604 0 8.64706 0Z" fill="url(#paint0_linear_1889_18231)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.39833 4.18539C7.43685 4.07388 7.53504 4 7.64474 4H9.42105C9.50736 4 9.58818 4.04595 9.63735 4.12297C9.68651 4.19999 9.69776 4.29829 9.66745 4.38603L8.81395 6.85714H10.7368C10.8413 6.85714 10.9359 6.92426 10.9779 7.02818C11.0198 7.13209 11.0011 7.2531 10.9303 7.33651L7.04875 11.9079C6.96343 12.0084 6.82451 12.0292 6.71732 11.9576C6.61012 11.886 6.56466 11.7419 6.60886 11.614L7.65974 8.57142H6.26316C6.17685 8.57142 6.09602 8.52547 6.04686 8.44845C5.9977 8.37143 5.98645 8.27313 6.01676 8.18539L7.39833 4.18539Z" fill="url(#paint1_linear_1889_18231)"/>
<defs>
<linearGradient id="paint0_linear_1889_18231" x1="5.5" y1="1" x2="11.5" y2="15" gradientUnits="userSpaceOnUse">
<stop stop-color="#097ED1"/>
<stop offset="1" stop-color="#0F5499"/>
</linearGradient>
<linearGradient id="paint1_linear_1889_18231" x1="6" y1="5.28571" x2="11.4103" y2="10.2689" gradientUnits="userSpaceOnUse">
<stop stop-color="#32BCEF"/>
<stop offset="1" stop-color="#128FDD"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,34 @@
<svg width="18" height="16" viewBox="0 0 18 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect y="3" width="16" height="10" rx="2" fill="url(#paint0_linear_1900_17890)"/>
<g filter="url(#filter0_dd_1900_17890)">
<path d="M14.375 10.0137H10.625C10.2798 10.0137 10 9.78981 10 9.51367V6.51367C10 6.23753 10.2798 6.01367 10.625 6.01367H14.375C14.7202 6.01367 15 6.23753 15 6.51367V9.51367C15 9.78981 14.7202 10.0137 14.375 10.0137Z" fill="url(#paint1_linear_1900_17890)"/>
</g>
<rect x="2" y="7.01367" width="3" height="2" rx="0.5" fill="#CAD2D9"/>
<path d="M6 7.51367C6 7.23753 6.22386 7.01367 6.5 7.01367H8.5C8.77614 7.01367 9 7.23753 9 7.51367V8.51367C9 8.78981 8.77614 9.01367 8.5 9.01367H6.5C6.22386 9.01367 6 8.78981 6 8.51367V7.51367Z" fill="#CAD2D9"/>
<defs>
<filter id="filter0_dd_1900_17890" x="7" y="4.01367" width="11" height="10" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="0.5"/>
<feGaussianBlur stdDeviation="0.5"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1900_17890"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="1"/>
<feGaussianBlur stdDeviation="1.5"/>
<feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1900_17890" result="effect2_dropShadow_1900_17890"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1900_17890" result="shape"/>
</filter>
<linearGradient id="paint0_linear_1900_17890" x1="14.4562" y1="13.2418" x2="10.9314" y2="0.217619" gradientUnits="userSpaceOnUse">
<stop stop-color="#626F7A"/>
<stop offset="1" stop-color="#8B9299"/>
</linearGradient>
<linearGradient id="paint1_linear_1900_17890" x1="13.4016" y1="12.3863" x2="8.18482" y2="9.15927" gradientUnits="userSpaceOnUse">
<stop stop-color="#28AFEA"/>
<stop offset="0.37387" stop-color="#3CCAF4"/>
<stop offset="0.74949" stop-color="#4BDFFC"/>
<stop offset="1" stop-color="#50E6FF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -7,6 +7,9 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\WindowWalker.svg" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\extensionsdk\Microsoft.CommandPalette.Extensions.Toolkit\Microsoft.CommandPalette.Extensions.Toolkit.csproj" />
</ItemGroup>
@@ -17,6 +20,14 @@
<AutoGen>True</AutoGen>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\WindowWalker.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\WindowWalker.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>

View File

@@ -19,7 +19,7 @@ internal sealed partial class WindowWalkerListPage : DynamicListPage, IDisposabl
public WindowWalkerListPage()
{
Icon = new IconInfo("\ue8f9"); // SwitchApps
Icon = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg");
Name = Resources.windowwalker_name;
Id = "com.microsoft.cmdpal.windowwalker";
PlaceholderText = Resources.windowwalker_PlaceholderText;

View File

@@ -20,7 +20,7 @@ public partial class WindowWalkerCommandsProvider : CommandProvider
{
Id = "WindowWalker";
DisplayName = Resources.windowwalker_name;
Icon = new IconInfo("\ue8f9"); // SwitchApps
Icon = IconHelpers.FromRelativePath("Assets\\WindowWalker.svg");
Settings = SettingsManager.Instance.Settings;
_windowWalkerPageItem = new CommandItem(new WindowWalkerListPage())

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,19 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1909_18132)">
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.69797 0.156184C7.77288 0.031333 7.89773 -0.0186073 8.02258 0.031333C8.34719 0.156184 8.64683 0.281034 8.97144 0.505765C9.27109 0.680556 9.57073 0.880318 9.82043 1.10505C9.92031 1.20493 9.94527 1.35475 9.87036 1.45463C9.52078 2.05391 9.49581 2.80302 9.87036 3.45224C10.2449 4.10146 10.9191 4.45104 11.6183 4.45104C11.7681 4.45104 11.868 4.55092 11.893 4.67577C12.0178 5.34997 12.0428 6.04913 11.9179 6.72332C11.9179 6.84817 11.7931 6.94806 11.6682 6.94806C10.9691 6.94806 10.2949 7.29764 9.92031 7.94686C9.54575 8.57111 9.5957 9.34519 9.94528 9.94447C10.0202 10.0443 9.99522 10.1942 9.89534 10.2691C9.37097 10.7185 8.77168 11.0681 8.12245 11.2929C7.9976 11.3178 7.87276 11.2679 7.79785 11.168C7.44826 10.5437 6.79904 10.1442 6.04994 10.1442C5.30083 10.1442 4.65161 10.5438 4.30203 11.143C4.22712 11.2679 4.10227 11.3178 3.97742 11.2679C3.65281 11.143 3.3282 10.9932 3.02856 10.8184C2.72892 10.6436 2.42927 10.4439 2.17957 10.2191C2.07969 10.1193 2.05472 9.96944 2.12963 9.86956C2.47922 9.27028 2.50419 8.52117 2.12963 7.87195C1.75508 7.22273 1.08089 6.87314 0.381727 6.87314C0.231906 6.87314 0.132024 6.77326 0.107054 6.64841C-0.0177965 5.97422 -0.0427681 5.27506 0.0820824 4.60086C0.0820824 4.47601 0.206933 4.37613 0.331784 4.37613C1.03095 4.37613 1.70514 4.02655 2.07969 3.37733C2.45424 2.75308 2.4043 1.979 2.05472 1.37972C1.97981 1.25487 2.00478 1.10505 2.10466 1.03014C2.62904 0.580676 3.22832 0.231094 3.87754 0.00636323C4.00239 -0.0186069 4.12724 0.0313334 4.20215 0.131214C4.55173 0.755467 5.20096 1.15499 5.95006 1.15499C6.69916 1.15499 7.34838 0.755466 7.69797 0.156184ZM8.25 5.625C8.25 6.86764 7.24264 7.875 6 7.875C4.75736 7.875 3.75 6.86764 3.75 5.625C3.75 4.38236 4.75736 3.375 6 3.375C7.24264 3.375 8.25 4.38236 8.25 5.625Z" fill="url(#paint0_linear_1909_18132)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.5724 14.505C14.6177 14.5866 14.6054 14.672 14.5376 14.7254C14.3641 14.8657 14.1986 14.9922 13.9695 15.1005C13.7763 15.2109 13.5691 15.3133 13.3641 15.38C13.2766 15.4034 13.1853 15.3692 13.1539 15.2956C12.933 14.909 12.5247 14.6548 12.0438 14.6547C11.5629 14.6545 11.1523 14.917 10.928 15.3055C10.8799 15.3888 10.7924 15.4122 10.715 15.3861C10.3003 15.2391 9.90374 15.0287 9.56915 14.743C9.49977 14.703 9.48433 14.6015 9.52438 14.5322C9.7487 14.1436 9.77074 13.6568 9.53014 13.2404C9.30341 12.832 8.85723 12.6114 8.41206 12.6134C8.33252 12.623 8.25728 12.561 8.2477 12.4815C8.16617 12.0459 8.16418 11.6007 8.24759 11.1679C8.27377 11.0905 8.34158 11.0371 8.42111 11.0275C8.88016 11.0335 9.31047 10.801 9.5508 10.3847C9.79114 9.96841 9.77741 9.47946 9.55655 9.09293C9.51121 9.01125 9.52351 8.92585 9.59132 8.87249C9.76484 8.73216 9.95224 8.59985 10.1455 8.48942C10.3388 8.37899 10.5459 8.27656 10.7509 8.20991C10.8385 8.18645 10.9297 8.22064 10.9612 8.29431C11.1821 8.68084 11.5903 8.93505 12.0713 8.93521C12.5522 8.93536 12.9628 8.67287 13.1871 8.28435C13.2351 8.2011 13.3227 8.17764 13.4001 8.20382C13.8148 8.35074 14.2113 8.56118 14.5459 8.84686C14.6153 8.88691 14.6307 8.98834 14.5907 9.05772C14.3664 9.44624 14.3443 9.93304 14.5849 10.3495C14.8116 10.7579 15.2578 10.9785 15.703 10.9765C15.7964 10.9749 15.8716 11.0369 15.8812 11.1164C15.9628 11.552 15.9647 11.9972 15.8813 12.43C15.8552 12.5074 15.7873 12.5608 15.7078 12.5704C15.2488 12.5643 14.8185 12.7969 14.5781 13.2132C14.3378 13.6295 14.3515 14.1184 14.5724 14.505ZM11.3563 13.0572C10.6657 12.6585 10.4291 11.7755 10.8278 11.085C11.2265 10.3944 12.1095 10.1579 12.8 10.5565C13.4905 10.9552 13.7271 11.8382 13.3285 12.5287C12.9298 13.2192 12.0468 13.4558 11.3563 13.0572Z" fill="url(#paint1_linear_1909_18132)"/>
</g>
<defs>
<linearGradient id="paint0_linear_1909_18132" x1="8.9717" y1="10.8245" x2="2.97903" y2="0.444546" gradientUnits="userSpaceOnUse">
<stop stop-color="#626F7A"/>
<stop offset="1" stop-color="#8B9299"/>
</linearGradient>
<linearGradient id="paint1_linear_1909_18132" x1="8.23537" y1="11.79" x2="15.9261" y2="11.7902" gradientUnits="userSpaceOnUse">
<stop stop-color="#626F7A"/>
<stop offset="1" stop-color="#8B9299"/>
</linearGradient>
<clipPath id="clip0_1909_18132">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@@ -10,9 +10,9 @@ using System.Linq;
using System.ServiceProcess;
using Microsoft.CmdPal.Ext.WindowsServices.Commands;
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;
@@ -43,9 +43,14 @@ public static class ServiceHelper
serviceList = servicesStartsWith.Concat(servicesContains);
}
return serviceList.Select(s =>
var result = serviceList.Select(s =>
{
var serviceResult = new ServiceResult(s);
var serviceResult = ServiceResult.CreateServiceController(s);
if (serviceResult == null)
{
return null;
}
ServiceCommand serviceCommand;
CommandContextItem[] moreCommands;
if (serviceResult.IsRunning)
@@ -53,7 +58,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
@@ -89,7 +97,9 @@ public static class ServiceHelper
// ToolTipData = new ToolTipData(serviceResult.DisplayName, serviceResult.ServiceName),
// IcoPath = icoPath,
};
});
}).Where(s => s != null);
return result;
}
// TODO GH #118 IPublicAPI contextAPI isn't used anymore, but we need equivalent ways to show notifications and status

View File

@@ -8,6 +8,9 @@
<!-- MRT from windows app sdk will search for a pri file with the same name of the module before defaulting to resources.pri -->
<ProjectPriFileName>Microsoft.CmdPal.Ext.WindowsServices.pri</ProjectPriFileName>
</PropertyGroup>
<ItemGroup>
<None Remove="Assets\Services.svg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.ServiceProcess.ServiceController" />
</ItemGroup>
@@ -21,6 +24,14 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\Services.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Update="Assets\Services.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>

View File

@@ -127,7 +127,7 @@
<value>Name</value>
</data>
<data name="wox_plugin_service_open_services" xml:space="preserve">
<value>Open services (Ctrl+O)</value>
<value>Open services</value>
</data>
<data name="wox_plugin_service_paused" xml:space="preserve">
<value>Paused</value>
@@ -142,7 +142,7 @@
<value>Service</value>
</data>
<data name="wox_plugin_service_restart" xml:space="preserve">
<value>Restart (Ctrl+R)</value>
<value>Restart</value>
</data>
<data name="wox_plugin_service_restarted_notification" xml:space="preserve">
<value>The service has been restarted</value>

View File

@@ -17,7 +17,7 @@ public class ServiceResult
public bool IsRunning { get; }
public ServiceResult(ServiceController serviceController)
private ServiceResult(ServiceController serviceController)
{
ArgumentNullException.ThrowIfNull(serviceController);
@@ -26,4 +26,21 @@ public class ServiceResult
StartMode = serviceController.StartType;
IsRunning = serviceController.Status != ServiceControllerStatus.Stopped && serviceController.Status != ServiceControllerStatus.StopPending;
}
public static ServiceResult CreateServiceController(ServiceController serviceController)
{
try
{
var result = new ServiceResult(serviceController);
return result;
}
catch (Exception)
{
// try to log the exception in the future
// retrieve properties from serviceController will throw exception. Such as PlatformNotSupportedException.
}
return null;
}
}

View File

@@ -11,7 +11,7 @@ namespace Microsoft.CmdPal.Ext.WindowsServices;
public partial class WindowsServicesCommandsProvider : CommandProvider
{
// For giggles, "%windir%\\system32\\filemgmt.dll" also _just works_.
public static IconInfo ServicesIcon { get; } = new("\ue9f5");
public static IconInfo ServicesIcon { get; } = IconHelpers.FromRelativePath("Assets\\Services.svg");
public WindowsServicesCommandsProvider()
{

View File

@@ -54,6 +54,11 @@ internal sealed partial class SampleListPage : ListPage
Title = "This item will take you to another page",
Subtitle = "This allows for nested lists of items",
},
new ListItem(new OpenUrlCommand("https://github.com/microsoft/powertoys"))
{
Title = "Or you can go to links",
Subtitle = "This takes you to the PowerToys repo on GitHub",
},
new ListItem(new SampleMarkdownPage())
{
Title = "Items can have tags",

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -0,0 +1,25 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M8.64706 0C9.69012 0 10.5357 0.884576 10.5357 1.97576L10.5351 2.4H13.2353C13.6576 2.4 14 2.75818 14 3.2V7C13.4477 7 13 7.44772 13 8C13 8.55229 13.4477 9 14 9V12.8023C14 13.2442 13.6576 13.6023 13.2353 13.6023L10.5351 13.6016L10.5357 14.0242C10.5357 15.1154 9.69012 16 8.64706 16C7.604 16 6.75846 15.1154 6.75846 14.0242L6.75823 13.6016L4.05882 13.6023C3.63649 13.6023 3.29412 13.2442 3.29412 12.8023L3.29335 9.9768L2.88859 9.97696C1.84555 9.97696 1 9.09232 1 8.0012C1 6.91 1.84555 6.02542 2.88859 6.02542L3.29335 6.0248L3.29412 3.2C3.29412 2.75818 3.63649 2.4 4.05882 2.4H6.75823L6.75846 1.97576C6.75846 0.884576 7.604 0 8.64706 0Z" fill="url(#paint0_linear_1889_18238)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.39833 4.18539C7.43685 4.07388 7.53504 4 7.64474 4H9.42105C9.50736 4 9.58818 4.04595 9.63735 4.12297C9.68651 4.19999 9.69776 4.29829 9.66745 4.38603L8.81395 6.85714H10.7368C10.8413 6.85714 10.9359 6.92426 10.9779 7.02818C11.0198 7.13209 11.0011 7.2531 10.9303 7.33651L7.04875 11.9079C6.96343 12.0084 6.82451 12.0292 6.71732 11.9576C6.61012 11.886 6.56466 11.7419 6.60886 11.614L7.65974 8.57142H6.26316C6.17685 8.57142 6.09602 8.52547 6.04686 8.44845C5.9977 8.37143 5.98645 8.27313 6.01676 8.18539L7.39833 4.18539Z" fill="url(#paint1_linear_1889_18238)"/>
<path d="M9.17749 8.02412C9.86491 7.56481 10.6731 7.31963 11.4998 7.31959C12.6082 7.32093 13.6707 7.76181 14.4545 8.54554C15.2382 9.32931 15.6791 10.392 15.6804 11.5004C15.6803 12.3271 15.4352 13.1352 14.9759 13.8225C14.5165 14.51 13.8636 15.0458 13.0998 15.3622C12.3359 15.6786 11.4954 15.7614 10.6844 15.6001C9.87352 15.4388 9.12865 15.0406 8.54401 14.456C7.95937 13.8713 7.56122 13.1265 7.39992 12.3156C7.23862 11.5046 7.3214 10.6641 7.63781 9.90023C7.95421 9.13636 8.49003 8.48347 9.17749 8.02412Z" fill="url(#paint2_linear_1889_18238)" stroke="url(#paint3_linear_1889_18238)" stroke-width="0.639184"/>
<rect x="8" y="11" width="7" height="1" rx="0.5" fill="#0C58A2"/>
<rect x="11" y="15" width="7" height="1" rx="0.5" transform="rotate(-90 11 15)" fill="#0C58A2"/>
<defs>
<linearGradient id="paint0_linear_1889_18238" x1="5.5" y1="1" x2="11.5" y2="15" gradientUnits="userSpaceOnUse">
<stop stop-color="#097ED1"/>
<stop offset="1" stop-color="#0F5499"/>
</linearGradient>
<linearGradient id="paint1_linear_1889_18238" x1="6" y1="5.28571" x2="11.4103" y2="10.2689" gradientUnits="userSpaceOnUse">
<stop stop-color="#32BCEF"/>
<stop offset="1" stop-color="#128FDD"/>
</linearGradient>
<linearGradient id="paint2_linear_1889_18238" x1="13.7504" y1="15.3978" x2="9.24963" y2="7.60225" gradientUnits="userSpaceOnUse">
<stop stop-color="#FCFCFC"/>
<stop offset="1" stop-color="#E7E7E7"/>
</linearGradient>
<linearGradient id="paint3_linear_1889_18238" x1="9.75" y1="7" x2="12.8347" y2="16.0704" gradientUnits="userSpaceOnUse">
<stop stop-color="#173A73" stop-opacity="0.1"/>
<stop offset="1" stop-color="#173A73" stop-opacity="0.25"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -2,6 +2,7 @@
// 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.Immutable;
using System.Collections.Specialized;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.CmdPal.Ext.Apps;
@@ -101,12 +102,7 @@ public partial class MainListPage : DynamicListPage,
var commands = _tlcManager.TopLevelCommands;
lock (commands)
{
// This gets called on a background thread, because ListViewModel
// updates the .SearchText of all extensions on a BG thread.
foreach (var command in commands)
{
command.TryUpdateFallbackText(newSearch);
}
UpdateFallbacks(newSearch, commands.ToImmutableArray());
// Cleared out the filter text? easy. Reset _filteredItems, and bail out.
if (string.IsNullOrEmpty(newSearch))
@@ -137,6 +133,26 @@ public partial class MainListPage : DynamicListPage,
}
}
private void UpdateFallbacks(string newSearch, IReadOnlyList<TopLevelViewModel> commands)
{
// fire and forget
_ = Task.Run(() =>
{
var needsToUpdate = false;
foreach (var command in commands)
{
var changedVisibility = command.SafeUpdateFallbackTextSynchronous(newSearch);
needsToUpdate = needsToUpdate || changedVisibility;
}
if (needsToUpdate)
{
RaiseItemsChanged();
}
});
}
private bool ActuallyLoading()
{
var tlcManager = _serviceProvider.GetService<TopLevelCommandManager>()!;
@@ -149,17 +165,14 @@ public partial class MainListPage : DynamicListPage,
// _always_ show up first.
private int ScoreTopLevelItem(string query, IListItem topLevelOrAppItem)
{
if (string.IsNullOrWhiteSpace(query))
{
return 1;
}
var title = topLevelOrAppItem.Title;
if (string.IsNullOrEmpty(title))
if (string.IsNullOrWhiteSpace(title))
{
return 0;
}
var isWhiteSpace = string.IsNullOrWhiteSpace(query);
var isFallback = false;
var isAliasSubstringMatch = false;
var isAliasMatch = false;
@@ -179,17 +192,45 @@ public partial class MainListPage : DynamicListPage,
extensionDisplayName = topLevel.ExtensionHost?.Extension?.PackageDisplayName ?? string.Empty;
}
var nameMatch = StringMatcher.FuzzySearch(query, title);
var descriptionMatch = StringMatcher.FuzzySearch(query, topLevelOrAppItem.Subtitle);
var extensionTitleMatch = StringMatcher.FuzzySearch(query, extensionDisplayName);
// StringMatcher.FuzzySearch will absolutely BEEF IT if you give it a
// whitespace-only query.
//
// in that scenario, we'll just use a simple string contains for the
// query. Maybe someone is really looking for things with a space in
// them, I don't know.
// Title:
// * whitespace query: 1 point
// * otherwise full weight match
var nameMatch = isWhiteSpace ?
(title.Contains(query) ? 1 : 0) :
StringMatcher.FuzzySearch(query, title).Score;
// Subtitle:
// * whitespace query: 1/2 point
// * otherwise ~half weight match. Minus a bit, because subtitles tend to be longer
var descriptionMatch = isWhiteSpace ?
(topLevelOrAppItem.Subtitle.Contains(query) ? .5 : 0) :
(StringMatcher.FuzzySearch(query, topLevelOrAppItem.Subtitle).Score - 4) / 2.0;
// Extension title: despite not being visible, give the extension name itself some weight
// * whitespace query: 0 points
// * otherwise more weight than a subtitle, but not much
var extensionTitleMatch = isWhiteSpace ? 0 : StringMatcher.FuzzySearch(query, extensionDisplayName).Score / 1.5;
var scores = new[]
{
nameMatch.Score,
(descriptionMatch.Score - 4) / 2.0,
nameMatch,
descriptionMatch,
isFallback ? 1 : 0, // Always give fallbacks a chance...
};
var max = scores.Max();
max = max + (extensionTitleMatch.Score / 1.5);
// _Add_ the extension name. This will bubble items that match both
// title and extension name up above ones that just match title.
// e.g. "git" will up-weight "GitHub searches" from the GitHub extension
// above "git" from "whatever"
max = max + extensionTitleMatch;
// ... but downweight them
var matchSomething = (max / (isFallback ? 3 : 1))

View File

@@ -21,7 +21,7 @@ public partial class NewExtensionPage : ContentPage
{
Name = Properties.Resources.builtin_create_extension_name;
Title = Properties.Resources.builtin_create_extension_title;
Icon = new IconInfo("\uEA86"); // Puzzle
Icon = IconHelpers.FromRelativePath("Assets\\CreateExtension.svg");
_inputForm.FormSubmitted += FormSubmitted;
}

View File

@@ -38,6 +38,7 @@
</ItemGroup>
<ItemGroup>
<None Remove="Assets\CreateExtension.svg" />
<None Remove="Assets\template.zip" />
</ItemGroup>
@@ -48,11 +49,22 @@
<AutoGen>True</AutoGen>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\CreateExtension.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<Generator>PublicResXFileCodeGenerator</Generator>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Update="Assets\CreateExtension.svg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>

View File

@@ -131,6 +131,7 @@ public class ExtensionService : IExtensionService, IDisposable
try
{
_installedExtensions.RemoveAll(i => removedExtensions.Contains(i));
_enabledExtensions.RemoveAll(i => removedExtensions.Contains(i));
OnExtensionRemoved?.Invoke(this, removedExtensions);
}

View File

@@ -22,7 +22,9 @@ public partial class SettingsModel : ObservableObject
///////////////////////////////////////////////////////////////////////////
// SETTINGS HERE
public HotkeySettings? Hotkey { get; set; } = new HotkeySettings(true, false, true, false, 0x20); // win+alt+space
public static HotkeySettings DefaultActivationShortcut { get; } = new HotkeySettings(true, false, true, false, 0x20); // win+alt+space
public HotkeySettings? Hotkey { get; set; } = DefaultActivationShortcut;
public bool ShowAppDetails { get; set; }

View File

@@ -3,22 +3,26 @@
// See the LICENSE file in the project root for more information.
using System.Collections.ObjectModel;
using System.ComponentModel;
using Microsoft.CmdPal.UI.ViewModels.Settings;
using Microsoft.Extensions.DependencyInjection;
namespace Microsoft.CmdPal.UI.ViewModels;
public partial class SettingsViewModel
public partial class SettingsViewModel : INotifyPropertyChanged
{
private readonly SettingsModel _settings;
private readonly IServiceProvider _serviceProvider;
public event PropertyChangedEventHandler? PropertyChanged;
public HotkeySettings? Hotkey
{
get => _settings.Hotkey;
set
{
_settings.Hotkey = value;
_settings.Hotkey = value ?? SettingsModel.DefaultActivationShortcut;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Hotkey)));
Save();
}
}

View File

@@ -2,6 +2,8 @@
// 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.Runtime.InteropServices;
using System.Runtime.Versioning;
using CommunityToolkit.Common;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@@ -13,7 +15,7 @@ using Microsoft.CmdPal.UI.ViewModels.Messages;
using Microsoft.CmdPal.UI.ViewModels.Models;
using Microsoft.CommandPalette.Extensions;
using Microsoft.Extensions.DependencyInjection;
using Windows.Win32;
using WinRT;
namespace Microsoft.CmdPal.UI.ViewModels;
@@ -148,14 +150,16 @@ public partial class ShellViewModel(IServiceProvider _serviceProvider, TaskSched
// need to handle that
_activeExtension = extension;
var extensionComObject = _activeExtension?.GetExtensionObject();
if (extensionComObject != null)
var extensionWinRtObject = _activeExtension?.GetExtensionObject();
if (extensionWinRtObject != null)
{
try
{
unsafe
{
var hr = PInvoke.CoAllowSetForegroundWindow(extensionComObject);
var winrtObj = (IWinRTObject)extensionWinRtObject;
var intPtr = winrtObj.NativeObject.ThisPtr;
var hr = Native.CoAllowSetForegroundWindow(intPtr);
if (hr != 0)
{
Logger.LogWarning($"Error giving foreground rights: 0x{hr.Value:X8}");
@@ -174,4 +178,18 @@ public partial class ShellViewModel(IServiceProvider _serviceProvider, TaskSched
{
SetActiveExtension(null);
}
// You may ask yourself, why aren't we using CsWin32 for this?
// The CsWin32 projected version includes some object marshalling, like so:
//
// HRESULT CoAllowSetForegroundWindow([MarshalAs(UnmanagedType.IUnknown)] object pUnk,...)
//
// And if you do it like that, then the IForegroundTransfer interface isn't marshalled correctly
internal sealed class Native
{
[DllImport("OLE32.dll", ExactSpelling = true)]
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
[SupportedOSPlatform("windows5.0")]
internal static extern unsafe global::Windows.Win32.Foundation.HRESULT CoAllowSetForegroundWindow(nint pUnk, [Optional] void* lpvReserved);
}
}

View File

@@ -2,6 +2,7 @@
// 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.Immutable;
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
@@ -133,16 +134,11 @@ public partial class TopLevelCommandManager : ObservableObject,
var wrapper = clone[i];
try
{
// TODO! this can be safer, we're not directly exposing ICommandItem's out of CPW anymore
var thisCommand = wrapper.ItemViewModel.Model.Unsafe;
if (thisCommand != null)
var isTheSame = wrapper == firstCommand;
if (isTheSame)
{
var isTheSame = thisCommand == firstCommand;
if (isTheSame)
{
startIndex = i;
break;
}
startIndex = i;
break;
}
}
catch
@@ -214,7 +210,7 @@ public partial class TopLevelCommandManager : ObservableObject,
extensionService.OnExtensionAdded -= ExtensionService_OnExtensionAdded;
extensionService.OnExtensionRemoved -= ExtensionService_OnExtensionRemoved;
var extensions = await extensionService.GetInstalledExtensionsAsync();
var extensions = (await extensionService.GetInstalledExtensionsAsync()).ToImmutableList();
_extensionCommandProviders.Clear();
if (extensions != null)
{
@@ -246,6 +242,7 @@ public partial class TopLevelCommandManager : ObservableObject,
// TODO This most definitely needs a lock
foreach (var extension in extensions)
{
Logger.LogDebug($"Starting {extension.PackageFullName}");
try
{
// start it ...

View File

@@ -4,8 +4,7 @@
using System.Collections.ObjectModel;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.CmdPal.UI.ViewModels.Messages;
using ManagedCommon;
using Microsoft.CmdPal.UI.ViewModels.Settings;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
@@ -208,12 +207,11 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem
tags.Add(new Tag() { Text = Alias.SearchPrefix });
}
PropChanged?.Invoke(this, new PropChangedEventArgs(nameof(Tags)));
DoOnUiThread(
() =>
{
ListHelpers.InPlaceUpdateList(Tags, tags);
PropChanged?.Invoke(this, new PropChangedEventArgs(nameof(Tags)));
});
}
@@ -237,32 +235,46 @@ public sealed partial class TopLevelViewModel : ObservableObject, IListItem
}
}
public void TryUpdateFallbackText(string newQuery)
internal bool SafeUpdateFallbackTextSynchronous(string newQuery)
{
if (!IsFallback)
{
return;
return false;
}
_ = Task.Run(() =>
try
{
try
{
var model = _commandItemViewModel.Model.Unsafe;
if (model is IFallbackCommandItem fallback)
{
var wasEmpty = string.IsNullOrEmpty(Title);
fallback.FallbackHandler.UpdateQuery(newQuery);
var isEmpty = string.IsNullOrEmpty(Title);
if (wasEmpty != isEmpty)
{
WeakReferenceMessenger.Default.Send<UpdateFallbackItemsMessage>();
}
}
}
catch (Exception)
{
}
});
return UnsafeUpdateFallbackSynchronous(newQuery);
}
catch (Exception ex)
{
Logger.LogError(ex.ToString());
}
return false;
}
/// <summary>
/// Calls UpdateQuery on our command, if we're a fallback item. This does
/// RPC work, so make sure you're calling it on a BG thread.
/// </summary>
/// <param name="newQuery">The new search text to pass to the extension</param>
/// <returns>true if our Title changed across this call</returns>
private bool UnsafeUpdateFallbackSynchronous(string newQuery)
{
var model = _commandItemViewModel.Model.Unsafe;
// RPC to check type
if (model is IFallbackCommandItem fallback)
{
var wasEmpty = string.IsNullOrEmpty(Title);
// RPC for method
fallback.FallbackHandler.UpdateQuery(newQuery);
var isEmpty = string.IsNullOrEmpty(Title);
return wasEmpty != isEmpty;
}
return false;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 328 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 435 B

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 826 B

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 178 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 723 B

After

Width:  |  Height:  |  Size: 660 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Some files were not shown because too many files have changed in this diff Show More