mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-01-06 04:17:04 +01:00
Compare commits
2 Commits
0.85_relea
...
dev/ethanf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21b438bb0b | ||
|
|
452f9e3a2b |
4
.github/actions/spell-check/expect.txt
vendored
4
.github/actions/spell-check/expect.txt
vendored
@@ -367,7 +367,6 @@ dllmain
|
||||
DNLEN
|
||||
DONOTROUND
|
||||
DONTVALIDATEPATH
|
||||
DOPUS
|
||||
dotnet
|
||||
DPICHANGED
|
||||
DPIs
|
||||
@@ -1266,7 +1265,6 @@ PWSTR
|
||||
pwsz
|
||||
pwtd
|
||||
QDC
|
||||
QDir
|
||||
qianlifeng
|
||||
qit
|
||||
QITAB
|
||||
@@ -1644,7 +1642,6 @@ toolkitconverters
|
||||
Toolset
|
||||
toolwindow
|
||||
TOPDOWNDIB
|
||||
TOTALCMD
|
||||
TOUCHEVENTF
|
||||
TOUCHINPUT
|
||||
touchpad
|
||||
@@ -1911,7 +1908,6 @@ XLoc
|
||||
XNamespace
|
||||
XPels
|
||||
XPixel
|
||||
xplorer
|
||||
XResource
|
||||
xsi
|
||||
XStr
|
||||
|
||||
@@ -224,7 +224,7 @@ jobs:
|
||||
inputs:
|
||||
solution: '**\HostsUILib.csproj'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog
|
||||
msbuildArgs: /p:CIBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog
|
||||
configuration: $(BuildConfiguration)
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
@@ -237,7 +237,7 @@ jobs:
|
||||
inputs:
|
||||
solution: '**\EnvironmentVariablesUILib.csproj'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog
|
||||
msbuildArgs: /p:CIBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog
|
||||
configuration: $(BuildConfiguration)
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
@@ -250,7 +250,7 @@ jobs:
|
||||
inputs:
|
||||
solution: '**\RegistryPreviewUILib.csproj'
|
||||
vsVersion: 17.0
|
||||
msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog
|
||||
msbuildArgs: /p:CIBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog
|
||||
configuration: $(BuildConfiguration)
|
||||
msbuildArchitecture: x64
|
||||
maximumCpuCount: true
|
||||
|
||||
@@ -3,9 +3,6 @@ variables:
|
||||
value: false
|
||||
- name: EnablePipelineCache
|
||||
value: true
|
||||
- ${{ if eq(parameters.enableMsBuildCaching, true) }}:
|
||||
- name: EnablePipelineCache
|
||||
value: true
|
||||
|
||||
parameters:
|
||||
- name: buildPlatforms
|
||||
|
||||
@@ -67,12 +67,3 @@ $fileLocksmithContextMenuAppManifestReadFileLocation = $fileLocksmithContextMenu
|
||||
$fileLocksmithContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
|
||||
Write-Host "FileLocksmithContextMenu version" $fileLocksmithContextMenuAppManifest.Package.Identity.Version
|
||||
$fileLocksmithContextMenuAppManifest.Save($fileLocksmithContextMenuAppManifestWriteFileLocation);
|
||||
|
||||
# Set NewPlusContextMenu package version in AppManifest.xml
|
||||
$newPlusContextMenuAppManifestWriteFileLocation = $PSScriptRoot + '/../src/modules/NewPlus/NewShellExtensionContextMenu/AppxManifest.xml';
|
||||
$newPlusContextMenuAppManifestReadFileLocation = $newPlusContextMenuAppManifestWriteFileLocation;
|
||||
|
||||
[XML]$newPlusContextMenuAppManifest = Get-Content $newPlusContextMenuAppManifestReadFileLocation
|
||||
$newPlusContextMenuAppManifest.Package.Identity.Version = $versionNumber + '.0'
|
||||
Write-Host "NewPlusContextMenu version" $newPlusContextMenuAppManifest.Package.Identity.Version
|
||||
$newPlusContextMenuAppManifest.Save($newPlusContextMenuAppManifestWriteFileLocation);
|
||||
|
||||
150
README.md
150
README.md
@@ -22,10 +22,10 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline
|
||||
| [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) | [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) | [Workspaces](https://aka.ms/PowerToysOverview_Workspaces) |
|
||||
| [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) |
|
||||
| [Video Conference Mute](https://aka.ms/PowerToysOverview_VideoConference) | [Workspaces](https://aka.ms/PowerToysOverview_Workspaces) |
|
||||
|
||||
## Installing and running Microsoft PowerToys
|
||||
|
||||
@@ -41,19 +41,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.86%22
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.85%22
|
||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.85.0/PowerToysUserSetup-0.85.0-x64.exe
|
||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.85.0/PowerToysUserSetup-0.85.0-arm64.exe
|
||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.85.0/PowerToysSetup-0.85.0-x64.exe
|
||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.85.0/PowerToysSetup-0.85.0-arm64.exe
|
||||
[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.85%22
|
||||
[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.84%22
|
||||
[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.84.1/PowerToysUserSetup-0.84.1-x64.exe
|
||||
[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.84.1/PowerToysUserSetup-0.84.1-arm64.exe
|
||||
[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.84.1/PowerToysSetup-0.84.1-x64.exe
|
||||
[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.84.1/PowerToysSetup-0.84.1-arm64.exe
|
||||
|
||||
| Description | Filename | sha256 hash |
|
||||
|----------------|----------|-------------|
|
||||
| Per user - x64 | [PowerToysUserSetup-0.85.0-x64.exe][ptUserX64] | 28A8BEA61040751287FF47C9BAC627A53A4670CFEA0C17B96EE947219E9A6EA9 |
|
||||
| Per user - ARM64 | [PowerToysUserSetup-0.85.0-arm64.exe][ptUserArm64] | 2CA077E842B7C53BAFC75A25DBD16C1A4FCE20924C36FDA5AD8CF23CD836B855 |
|
||||
| Machine wide - x64 | [PowerToysSetup-0.85.0-x64.exe][ptMachineX64] | 4A248AA914EEE339AA99D467FDFBDB1FCD7A49A8564DDBBB811D0EC69CEBAB75 |
|
||||
| Machine wide - ARM64 | [PowerToysSetup-0.85.0-arm64.exe][ptMachineArm64] | B5FB04EAF44C4203E785411FF55025842B9C39D4970C0C934CB8ADBE79EF31AF |
|
||||
| Per user - x64 | [PowerToysUserSetup-0.84.1-x64.exe][ptUserX64] | 1CDAF3482B031D84DAE15188DE292FB44C5D211698089921040D94B256EBD3CA |
|
||||
| Per user - ARM64 | [PowerToysUserSetup-0.84.1-arm64.exe][ptUserArm64] | E0207EF5147EE281D4F438E87A30586D8CAA24DE948950FF1B12E05454622CD9 |
|
||||
| Machine wide - x64 | [PowerToysSetup-0.84.1-x64.exe][ptMachineX64] | 10DF9774DE1857051E135B9790A18A92C5C7F42587C733DEE991186E67231EE0 |
|
||||
| Machine wide - ARM64 | [PowerToysSetup-0.84.1-arm64.exe][ptMachineArm64] | EB5DDA5EFBA17E813DBF24AFF668DDF5424ED3659234ABBC15441D478D812699 |
|
||||
|
||||
This is our preferred method.
|
||||
|
||||
@@ -99,117 +99,99 @@ 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.85 - September 2024 Update
|
||||
### 0.84 - August 2024 Update
|
||||
|
||||
In this release, we focused on new features, stability, and improvements.
|
||||
In this release, we focused on adding a new utility (PowerToys Workspaces), Advanced paste custom actions feature, stability, and improvements.
|
||||
|
||||
**Highlights**
|
||||
|
||||
- New utility: New+ - allows setting a personalized set of templates to quickly create files and folders from a File Explorer context menu. Thanks [@cgaarden](https://github.com/cgaarden)!
|
||||
- Language selection - it's now possible to select which UI language should be used by PowerToys utilities.
|
||||
- Lots of quality fixes for Workspaces, improving the number of supported applications.
|
||||
- Reduced Peek memory usage by fixing image leaks. Thanks [@daverayment](https://github.com/daverayment)!
|
||||
- New utility: PowerToys Workspaces - this utility can launch a set of applications to a custom layout and configuration on the desktop. App arrangements can be saved as a workspace and then relaunched with one click from the Workspaces Editor or from a desktop shortcut. In the editor, app configuration can be customized using CLI arguments and "launch as admin" modifiers, and app window sizes and positions can be updated as desired. This is our first public version of Workspaces and we are excited for you to try it out for yourself! Make sure to file issues you encounter on our GitHub so the team can continue to improve the utility.
|
||||
- Known issues - the team is actively working on fixing these:
|
||||
- Apps that launch as admin are unable to be repositioned to the desired layout.
|
||||
- Border of "Remove" / "Add Back" app button in editor is not clearly visible on light themes.
|
||||
- Added Awake --use-parent-pid CLI argument to attach to parent process. Thanks [@dend](https://github.com/dend)!
|
||||
- Added custom actions - user-specified pre-defined prompts for the AI model. Additionally, actions (both standard and custom) are now searchable from prompt box and Ctrl + number in-app shortcuts are now applicable for first 9 search results.
|
||||
- Ported all C++/CX code to C++/WinRT as part of a refactor and upgrade series aimed at enabling AOT (Ahead of Time) compilation for enhanced performance and reduced disk footprint.
|
||||
|
||||
### General
|
||||
|
||||
- Added a general setting to select which UI language should be used in PowerToys utilities.
|
||||
- Fixed internal code of some policies for Group Policy Objects, that were reading registry entries using the wrong internal functions, and structured code better to avoid future mistakes of the same kind. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
|
||||
- Added DSC support for ImageResizer resize sizes property.
|
||||
|
||||
### Advanced Paste
|
||||
|
||||
- Fixed some telemetry calls to signal Advanced Paste activation on the cases where a direct shortcut is being used without showing the UI.
|
||||
- User-defined custom actions can only be used with AI turned on, so custom actions were disabled on Settings when AI is disabled and were hidden from the Advanced Paste UI.
|
||||
- Added custom actions - user-specified pre-defined prompts for the AI model. Additionally, actions (both standard and custom) are now searchable from prompt box and Ctrl + number in-app shortcuts are now applicable for first 9 search results.
|
||||
|
||||
### Awake
|
||||
|
||||
- Fixed tray icon behaviors, not appearing and showing incorrect time. Thanks [@dend](https://github.com/dend)!
|
||||
- Added --use-parent-pid CLI argument to attach to parent process and fixed issue causing tray icon to disappear. Thanks [@dend](https://github.com/dend)!
|
||||
|
||||
### Environment Variables Editor
|
||||
### Hosts File Editor
|
||||
|
||||
- Added the `_NT_SYMBOL_PATH`, `_NT_ALT_SYMBOL_PATH` and `_NT_SYMCACHE_PATH` as variables that are shown as lists. Thanks [@chwarr](https://github.com/chwarr)!
|
||||
- Fixed save failure when the hosts file is hidden. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### FancyZones
|
||||
### File Explorer add-ons
|
||||
|
||||
- Allow snapping applications that were launched by Workspaces.
|
||||
- Fixed multiple preview form positioning issues causing floating, detached windows, CoreWebView2 related exception and process leak. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### File Locksmith
|
||||
### Keyboard Manager
|
||||
|
||||
- Fixed an issue causing File Locksmith to be triggered by unrelated verbs in the context menu.
|
||||
|
||||
### Mouse Pointer Crosshairs
|
||||
|
||||
- Allow crosshairs radius to be 0 pixels. Thanks [@octastylos-pseudodipteros](https://github.com/octastylos-pseudodipteros)!
|
||||
|
||||
### New+
|
||||
|
||||
- New utility - Allows setting a personalized set of templates to quickly create files and folders from a File Explorer context menu. Thanks [@cgaarden](https://github.com/cgaarden)!
|
||||
- Added missing entry for New+ policy state reporting in the Bug Report tool. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Added a policy for enabling/disabling whether filename extensions should be shown. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Convert RemapBufferRow to a struct with descriptive field names. Thanks [@masaru-iritani](https://github.com/masaru-iritani)!
|
||||
- Fixed issue causing stuck Ctrl key when shortcuts contain AltGr key.
|
||||
|
||||
### Peek
|
||||
|
||||
- Properly show file's modified date instead of creation date in the file previewer. Thanks [@daverayment](https://github.com/daverayment)!
|
||||
- Fixed memory leak caused by unmanaged bitmap images not being freed. Thanks [@daverayment](https://github.com/daverayment)!
|
||||
- Fixed an issue causing Peek to not be displayed the first time when using a preview handler to display files. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Prevent tooltip in file previewer from overlapping with title bar controls. Thanks [@daverayment](https://github.com/daverayment)!
|
||||
- Fixed memory leaks in thumbnails and refactored image previewer. Thanks [@daverayment](https://github.com/daverayment)!
|
||||
|
||||
### PowerToys Run
|
||||
|
||||
- Improved the message boxes to be more specific when PowerToys Run failed to initialize itself or any plugin. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Use capital letters when showing degree results in the Unit Converter plugin. Thanks [@PesBandi](https://github.com/PesBandi)!
|
||||
- Added long paths support. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Quick Accent
|
||||
|
||||
- Add the Middle Eastern Romanization character set. Thanks [@PesBandi](https://github.com/PesBandi)!
|
||||
- Add the degree sign, integral and vertical ellipsis when "All Languages" is selected. Thanks [@rddunphy](https://github.com/rddunphy)!
|
||||
- Moved number superscripts and subscripts from Portuguese to all languages definition. Thanks [@octastylos-pseudodipteros](https://github.com/octastylos-pseudodipteros)!
|
||||
|
||||
### PowerRename
|
||||
|
||||
- Updated the tooltip text of the replace box info button. Thanks [@Agnibaan](https://github.com/Agnibaan)!
|
||||
|
||||
### PowerToys Run
|
||||
|
||||
- Fixed window positioning on start-up introduced in 0.83.
|
||||
- Improved default web browser detection. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed volume ounces conversion to support both imperial and metric. Thanks [@GhostVaibhav](https://github.com/GhostVaibhav)!
|
||||
- Fixed thread-safety issue causing results not to be shown on first launch.
|
||||
|
||||
### Screen Ruler
|
||||
|
||||
- Added multiple measurements support for all measuring tools.
|
||||
|
||||
### Settings
|
||||
|
||||
- Fixed the link to the Workspaces documentation. (This was a hotfix for 0.84)
|
||||
- Fixed flyout issues after the Windows App SDK upgrade. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Fixed initialization for the New+ settings page. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Fixed enabled state of a control on the New+ settings page if the module is enabled by policy. Thanks [@htcfreek](https://github.com/htcfreek)!
|
||||
- Fixed a crash when cancelling the template folder selection in the New+ settings page.
|
||||
- Improved disabled animations InfoBar in Find My Mouse page. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
|
||||
### Workspaces
|
||||
|
||||
- Fixed detecting and snapping applications like Discord. (This was a hotfix for 0.84)
|
||||
- Fixed detecting and snapping applications like Steam. (This was a hotfix for 0.84)
|
||||
- Fixed button visibility in the UI. (This was a hotfix for 0.84)
|
||||
- Fixed an issue launching the wrong project when the editor was closed without saving or cancelling a new project.
|
||||
- Properly handle repositioning windows running as administrator.
|
||||
- Properly handle cases where the monitor where a workspace was saved is no longer present.
|
||||
- Fixed the workspace launcher restarting itself in a loop without success.
|
||||
- Properly handle standalone applications.
|
||||
- Fixed issues causing icons to not show.
|
||||
- New utility: PowerToys Workspaces - this utility can launch a set of applications to a custom layout and configuration on the desktop. App arrangements can be saved as a workspace and then relaunched with one click from the Workspaces Editor or from a desktop shortcut. In the editor, app configuration can be customized using CLI arguments and "launch as admin" modifiers, and app window sizes and positions can be updated as desired. This is our first public version of Workspaces and we are excited for you to try it out for yourself! Make sure to file issues you encounter on our GitHub so the team can continue to improve the utility.
|
||||
|
||||
### Documentation
|
||||
|
||||
- Fixed the thirdPartyRunPlugins.md entry for the RDP plugin. Thanks [@YisroelTech](https://github.com/YisroelTech)!
|
||||
- Added ChatGPTPowerToys plugin mention to thirdPartyRunPlugins.md. Thanks [@ferraridavide](https://github.com/ferraridavide)!
|
||||
|
||||
### Development
|
||||
|
||||
- Upgraded Windows App SDK to 1.6.
|
||||
- Upgraded the Target Platform Version to 10.0.22621.0.
|
||||
- Added a bot trigger to automatically add a label to Workspaces issues. Thanks [@plante-msft](https://github.com/plante-msft)!
|
||||
- Fixed a regular expression in the bot triggers for wanting to submit community contributions. Thanks [@PesBandi](https://github.com/PesBandi)!
|
||||
- Fixed analyzer errors after the Visual Studio 17.12 update. Thanks [@snickler](https://github.com/snickler)!
|
||||
- Fixed the TSA configuration for release CI builds.
|
||||
- Refactored automated file component generation during installer builds.
|
||||
- Rewrote the Azure Devops build system to be more modular and share more definitions between PR CI and Release CI.
|
||||
- Fixed debugging of the New+ page of the Settings application when a settings file was not present.
|
||||
- Fixed setting the version of the App Manifest in the File Locksmith and New+ context menu app packages.
|
||||
- Fixed abstracted UI library nuget package signing on release CI.
|
||||
- Removed build status from GitHub README.
|
||||
- Ported all C++/CX code to C++/WinRT.
|
||||
- Moved Version.props import to Directory.Build.props.
|
||||
- Extracted self-containment related .csproj properties to src/Common.SelfContained.props.
|
||||
- Unused and obsolete dependencies cleanup. Thanks [@davidegiacometti](https://github.com/davidegiacometti)!
|
||||
- Extracted CSWinRT related .csproj properties to src/Common.Dotnet.CsWinRT.props.
|
||||
- Upgraded Microsoft.Windows.CsWinRT to 2.0.8 and updated verifyDepsJsonLibraryVersions.ps1 to unblock PRs.
|
||||
- Explicitly Set NuGet Audit Mode to Direct in Directory.Build.props to revert changes made with VS 17.12 update. Thanks [@snickler](https://github.com/snickler)!
|
||||
- Upgraded UnitsNet to 5.56.0.
|
||||
|
||||
#### What is being planned for version 0.86
|
||||
#### What is being planned for version 0.84
|
||||
|
||||
For [v0.86][github-next-release-work], we'll work on the items below:
|
||||
For [v0.85][github-next-release-work], we'll work on the items below:
|
||||
|
||||
- Stability / bug fixes
|
||||
- Language selection
|
||||
- New module: File Actions Menu
|
||||
- Integrate Sysinternals ZoomIt
|
||||
- New module: New+
|
||||
|
||||
## PowerToys Community
|
||||
|
||||
|
||||
@@ -10,22 +10,13 @@ The build ID can be found in `Core\Constants.cs` in the `BuildId` variable - it
|
||||
|
||||
The build ID moniker is made up of two components - a reference to a [Halo](https://en.wikipedia.org/wiki/Halo_(franchise)) character, and the date when the work on the specific build started in the format of `MMDDYYYY`.
|
||||
|
||||
| Build ID | Build Date |
|
||||
|:-------------------------------------------------------------------|:------------------|
|
||||
| [`PROMETHEAN_09082024`](#PROMETHEAN_09082024-september-8-2024) | September 8, 2024 |
|
||||
| [`VISEGRADRELAY_08152024`](#VISEGRADRELAY_08152024-august-15-2024) | August 15, 2024 |
|
||||
| [`DAISY023_04102024`](#DAISY023_04102024-april-10-2024) | April 10, 2024 |
|
||||
| [`ATRIOX_04132023`](#ATRIOX_04132023-april-13-2023) | April 13, 2023 |
|
||||
| [`LIBRARIAN_03202022`](#librarian_03202022-march-20-2022) | March 20, 2022 |
|
||||
| `ARBITER_01312022` | January 31, 2022 |
|
||||
|
||||
### `PROMETHEAN_09082024` (September 8, 2024)
|
||||
|
||||
>[!NOTE]
|
||||
>See pull request: [Awake - `PROMETHEAN_09082024`](https://github.com/microsoft/PowerToys/pull/34717)
|
||||
|
||||
- Updating the initialization logic to make sure that settings are respected for proper group policy and single-instance detection.
|
||||
- [#34148] Fixed a bug from the previous release that incorrectly synchronized threads for shell icon creation and initialized parent PID when it was not parented.
|
||||
| Build ID | Build Date |
|
||||
|:-------------------------------------------------------------------|:----------------|
|
||||
| [`VISEGRADRELAY_08152024`](#VISEGRADRELAY_08152024-august-15-2024) | August 15, 2024 |
|
||||
| [`DAISY023_04102024`](#DAISY023_04102024-april-10-2024) | April 10, 2024 |
|
||||
| [`ATRIOX_04132023`](#ATRIOX_04132023-april-13-2023) | April 13, 2023 |
|
||||
| [`LIBRARIAN_03202022`](#librarian_03202022-march-20-2022) | March 20, 2022 |
|
||||
| `ARBITER_01312022` | January 31, 2022 |
|
||||
|
||||
### `VISEGRADRELAY_08152024` (August 15, 2024)
|
||||
|
||||
|
||||
@@ -19,15 +19,6 @@ namespace SnapshotUtils
|
||||
namespace NonLocalizable
|
||||
{
|
||||
const std::wstring ApplicationFrameHost = L"ApplicationFrameHost.exe";
|
||||
|
||||
namespace FileManagers
|
||||
{
|
||||
const std::wstring FileExplorer = L"EXPLORER"; // windows explorer
|
||||
const std::wstring TotalCommander = L"TOTALCMD"; // total commander
|
||||
const std::wstring DirectoryOpus = L"DOPUS"; // directory opus
|
||||
const std::wstring QDir = L"Q-DIR"; // Q-Dir
|
||||
const std::wstring Xplorer2 = L"XPLORER2"; // Xplorer2
|
||||
}
|
||||
}
|
||||
|
||||
class WbemHelper
|
||||
@@ -200,17 +191,6 @@ namespace SnapshotUtils
|
||||
return res;
|
||||
}
|
||||
|
||||
bool IsFileManagerApp(std::wstring processPath)
|
||||
{
|
||||
std::wstring appName = std::filesystem::path(processPath).stem();
|
||||
std::transform(appName.begin(), appName.end(), appName.begin(), towupper);
|
||||
return ((appName == NonLocalizable::FileManagers::FileExplorer) // windows explorer
|
||||
|| (appName.starts_with(NonLocalizable::FileManagers::TotalCommander)) // total commander
|
||||
|| (appName == NonLocalizable::FileManagers::DirectoryOpus) // directory opus
|
||||
|| (appName == NonLocalizable::FileManagers::QDir) // Q-Dir
|
||||
|| (appName.starts_with(NonLocalizable::FileManagers::Xplorer2))); // Xplorer2
|
||||
}
|
||||
|
||||
std::vector<WorkspacesData::WorkspacesProject::Application> GetApps(const std::function<unsigned int(HWND)> getMonitorNumberFromWindowHandle)
|
||||
{
|
||||
std::vector<WorkspacesData::WorkspacesProject::Application> apps{};
|
||||
@@ -289,72 +269,25 @@ namespace SnapshotUtils
|
||||
if (!data.has_value() || data->name.empty())
|
||||
{
|
||||
Logger::info(L"Installed app not found: {}, try parent process", processPath);
|
||||
|
||||
bool standaloneApp = false;
|
||||
bool steamLikeApp = false;
|
||||
|
||||
|
||||
// try with parent process (fix for Steam)
|
||||
auto parentPid = GetParentPid(pid);
|
||||
auto parentProcessPath = get_process_path(parentPid);
|
||||
|
||||
// check if original process is in the subfolder of the parent process which is a sign of an steam-like app
|
||||
std::wstring processDir = std::filesystem::path(processPath).parent_path().c_str();
|
||||
std::wstring parentProcessDir = std::filesystem::path(parentProcessPath).parent_path().c_str();
|
||||
|
||||
if (parentProcessPath == L"")
|
||||
if (!parentProcessPath.empty())
|
||||
{
|
||||
if (processPath.ends_with(NonLocalizable::ApplicationFrameHost))
|
||||
data = Utils::Apps::GetApp(parentProcessPath, installedApps);
|
||||
if (!data.has_value() || data->name.empty())
|
||||
{
|
||||
// filter out ApplicationFrameHost.exe
|
||||
Logger::info(L"Installed parent app not found: {}", processPath);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::info(L"parent process unknown, the parent app is an already closed file manager app, it is a standalone app");
|
||||
standaloneApp = true;
|
||||
}
|
||||
}
|
||||
else if (processDir.starts_with(parentProcessDir))
|
||||
{
|
||||
Logger::info(L"parent process: {}, original process is in the subfolder of the parent process, it is a steam-like app", parentProcessPath);
|
||||
steamLikeApp = true;
|
||||
}
|
||||
else if (IsFileManagerApp(parentProcessPath))
|
||||
{
|
||||
Logger::info(L"parent process: {}, The parent process is a known file manager app, it is a standalone app", parentProcessPath);
|
||||
standaloneApp = true;
|
||||
|
||||
processPath = parentProcessPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::info(L"parent process: {}, The parent process is NOT a known file manager app, it is a steam-like app", parentProcessPath);
|
||||
steamLikeApp = true;
|
||||
}
|
||||
|
||||
if (standaloneApp)
|
||||
{
|
||||
data = Utils::Apps::AppData{
|
||||
.name = std::filesystem::path(processPath).stem(),
|
||||
.installPath = processPath,
|
||||
};
|
||||
}
|
||||
else if (steamLikeApp)
|
||||
{
|
||||
if (!parentProcessPath.empty())
|
||||
{
|
||||
data = Utils::Apps::GetApp(parentProcessPath, installedApps);
|
||||
if (!data.has_value() || data->name.empty())
|
||||
{
|
||||
Logger::info(L"Installed parent app not found: {}", processPath);
|
||||
continue;
|
||||
}
|
||||
|
||||
processPath = parentProcessPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger::info(L"Parent process path not found");
|
||||
continue;
|
||||
}
|
||||
Logger::info(L"Parent process path not found");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -174,15 +174,13 @@ void WindowArranger::processWindow(HWND window)
|
||||
}
|
||||
|
||||
auto data = Utils::Apps::GetApp(processPath, m_installedApps);
|
||||
if (!data.has_value())
|
||||
if (!data.has_value() || data->name.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
auto iter = std::find_if(m_launchingApps.begin(), m_launchingApps.end(), [&](const auto& val)
|
||||
{
|
||||
return val.second.state == LaunchingState::Waiting && !val.second.window && (val.first.name == data.value().name || val.first.path == data.value().installPath);
|
||||
});
|
||||
{ return val.second.state == LaunchingState::Waiting && val.first.name == data.value().name; });
|
||||
if (iter == m_launchingApps.end())
|
||||
{
|
||||
Logger::info(L"A window of {} is not in the project", processPath);
|
||||
|
||||
@@ -17,6 +17,6 @@ namespace Awake.Core
|
||||
// Format of the build ID is: CODENAME_MMDDYYYY, where MMDDYYYY
|
||||
// is representative of the date when the last change was made before
|
||||
// the pull request is issued.
|
||||
internal const string BuildId = "PROMETHEAN_09082024";
|
||||
internal const string BuildId = "VISEGRADRELAY_08152024";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,16 +6,17 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Awake.Core.Threading
|
||||
namespace Awake.Core.Models
|
||||
{
|
||||
internal sealed class SingleThreadSynchronizationContext : SynchronizationContext
|
||||
{
|
||||
private readonly Queue<Tuple<SendOrPostCallback, object?>?> queue = new();
|
||||
private readonly Queue<Tuple<SendOrPostCallback, object>> queue =
|
||||
new();
|
||||
|
||||
public override void Post(SendOrPostCallback d, object? state)
|
||||
#pragma warning disable CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
|
||||
public override void Post(SendOrPostCallback d, object state)
|
||||
#pragma warning restore CS8765 // Nullability of type of parameter doesn't match overridden member (possibly because of nullability attributes).
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(d);
|
||||
|
||||
lock (queue)
|
||||
{
|
||||
queue.Enqueue(Tuple.Create(d, state));
|
||||
@@ -27,7 +28,7 @@ namespace Awake.Core.Threading
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Tuple<SendOrPostCallback, object?>? work;
|
||||
Tuple<SendOrPostCallback, object> work;
|
||||
lock (queue)
|
||||
{
|
||||
while (queue.Count == 0)
|
||||
@@ -43,14 +44,7 @@ namespace Awake.Core.Threading
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
work.Item1(work.Item2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Error during execution: " + e.Message);
|
||||
}
|
||||
work.Item1(work.Item2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,7 +52,9 @@ namespace Awake.Core.Threading
|
||||
{
|
||||
lock (queue)
|
||||
{
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
queue.Enqueue(null); // Signal the end of the message loop
|
||||
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
Monitor.Pulse(queue);
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,10 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Awake.Core.Models;
|
||||
using Awake.Core.Native;
|
||||
using Awake.Core.Threading;
|
||||
using Awake.Properties;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
@@ -28,13 +29,13 @@ namespace Awake.Core
|
||||
internal static class TrayHelper
|
||||
{
|
||||
private static NotifyIconData _notifyIconData;
|
||||
|
||||
private static IntPtr _trayMenu;
|
||||
private static IntPtr _hiddenWindowHandle;
|
||||
private static SingleThreadSynchronizationContext? _syncContext;
|
||||
private static Thread? _mainThread;
|
||||
|
||||
private static IntPtr TrayMenu { get => _trayMenu; set => _trayMenu = value; }
|
||||
|
||||
private static IntPtr _hiddenWindowHandle;
|
||||
|
||||
internal static IntPtr HiddenWindowHandle { get => _hiddenWindowHandle; private set => _hiddenWindowHandle = value; }
|
||||
|
||||
static TrayHelper()
|
||||
@@ -45,35 +46,42 @@ namespace Awake.Core
|
||||
|
||||
private static void ShowContextMenu(IntPtr hWnd)
|
||||
{
|
||||
if (TrayMenu == IntPtr.Zero)
|
||||
if (TrayMenu != IntPtr.Zero)
|
||||
{
|
||||
Logger.LogError("Tried to create a context menu while the TrayMenu object is a null pointer. Normal when used in standalone mode.");
|
||||
return;
|
||||
Bridge.SetForegroundWindow(hWnd);
|
||||
|
||||
// Get the handle to the context menu associated with the tray icon
|
||||
IntPtr hMenu = TrayMenu;
|
||||
|
||||
// Get the current cursor position
|
||||
Bridge.GetCursorPos(out Models.Point cursorPos);
|
||||
|
||||
Bridge.ScreenToClient(hWnd, ref cursorPos);
|
||||
|
||||
MenuInfo menuInfo = new()
|
||||
{
|
||||
CbSize = (uint)Marshal.SizeOf(typeof(MenuInfo)),
|
||||
FMask = Native.Constants.MIM_STYLE,
|
||||
DwStyle = Native.Constants.MNS_AUTO_DISMISS,
|
||||
};
|
||||
Bridge.SetMenuInfo(hMenu, ref menuInfo);
|
||||
|
||||
// Display the context menu at the cursor position
|
||||
Bridge.TrackPopupMenuEx(
|
||||
hMenu,
|
||||
Native.Constants.TPM_LEFT_ALIGN | Native.Constants.TPM_BOTTOMALIGN | Native.Constants.TPM_LEFT_BUTTON,
|
||||
cursorPos.X,
|
||||
cursorPos.Y,
|
||||
hWnd,
|
||||
IntPtr.Zero);
|
||||
}
|
||||
|
||||
Bridge.SetForegroundWindow(hWnd);
|
||||
|
||||
// Get cursor position and convert it to client coordinates
|
||||
Bridge.GetCursorPos(out Models.Point cursorPos);
|
||||
Bridge.ScreenToClient(hWnd, ref cursorPos);
|
||||
|
||||
// Set menu information
|
||||
var menuInfo = new MenuInfo
|
||||
else
|
||||
{
|
||||
CbSize = (uint)Marshal.SizeOf<MenuInfo>(),
|
||||
FMask = Native.Constants.MIM_STYLE,
|
||||
DwStyle = Native.Constants.MNS_AUTO_DISMISS,
|
||||
};
|
||||
Bridge.SetMenuInfo(TrayMenu, ref menuInfo);
|
||||
|
||||
// Display the context menu at the cursor position
|
||||
Bridge.TrackPopupMenuEx(
|
||||
TrayMenu,
|
||||
Native.Constants.TPM_LEFT_ALIGN | Native.Constants.TPM_BOTTOMALIGN | Native.Constants.TPM_LEFT_BUTTON,
|
||||
cursorPos.X,
|
||||
cursorPos.Y,
|
||||
hWnd,
|
||||
IntPtr.Zero);
|
||||
// Tray menu was not initialized. Log the issue.
|
||||
// This is normal when operating in "standalone mode" - that is, detached
|
||||
// from the PowerToys configuration file.
|
||||
Logger.LogError("Tried to create a context menu while the TrayMenu object is a null pointer. Normal when used in standalone mode.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void InitializeTray(Icon icon, string text)
|
||||
@@ -81,11 +89,8 @@ namespace Awake.Core
|
||||
IntPtr hWnd = IntPtr.Zero;
|
||||
|
||||
// Start the message loop asynchronously
|
||||
_mainThread = new Thread(() =>
|
||||
Task.Run(() =>
|
||||
{
|
||||
_syncContext = new SingleThreadSynchronizationContext();
|
||||
SynchronizationContext.SetSynchronizationContext(_syncContext);
|
||||
|
||||
RunOnMainThread(() =>
|
||||
{
|
||||
WndClassEx wcex = new()
|
||||
@@ -132,82 +137,74 @@ namespace Awake.Core
|
||||
|
||||
Bridge.ShowWindow(hWnd, 0); // SW_HIDE
|
||||
Bridge.UpdateWindow(hWnd);
|
||||
Logger.LogInfo($"Created HWND for the window: {hWnd}");
|
||||
|
||||
SetShellIcon(hWnd, text, icon);
|
||||
});
|
||||
}).Wait();
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
RunOnMainThread(() =>
|
||||
{
|
||||
RunMessageLoop();
|
||||
});
|
||||
|
||||
_syncContext!.BeginMessageLoop();
|
||||
});
|
||||
|
||||
_mainThread.IsBackground = true;
|
||||
_mainThread.Start();
|
||||
}
|
||||
|
||||
internal static void SetShellIcon(IntPtr hWnd, string text, Icon? icon, TrayIconAction action = TrayIconAction.Add)
|
||||
{
|
||||
if (hWnd != IntPtr.Zero && icon != null)
|
||||
Logger.LogInfo($"Setting the shell icon.\nText: {text}\nAction: {action}");
|
||||
|
||||
int message = Native.Constants.NIM_ADD;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
int message = Native.Constants.NIM_ADD;
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case TrayIconAction.Update:
|
||||
message = Native.Constants.NIM_MODIFY;
|
||||
break;
|
||||
case TrayIconAction.Delete:
|
||||
message = Native.Constants.NIM_DELETE;
|
||||
break;
|
||||
case TrayIconAction.Add:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (action == TrayIconAction.Add || action == TrayIconAction.Update)
|
||||
{
|
||||
_notifyIconData = new NotifyIconData
|
||||
{
|
||||
CbSize = Marshal.SizeOf(typeof(NotifyIconData)),
|
||||
HWnd = hWnd,
|
||||
UId = 1000,
|
||||
UFlags = Native.Constants.NIF_ICON | Native.Constants.NIF_TIP | Native.Constants.NIF_MESSAGE,
|
||||
UCallbackMessage = (int)Native.Constants.WM_USER,
|
||||
HIcon = icon?.Handle ?? IntPtr.Zero,
|
||||
SzTip = text,
|
||||
};
|
||||
}
|
||||
else if (action == TrayIconAction.Delete)
|
||||
{
|
||||
_notifyIconData = new NotifyIconData
|
||||
{
|
||||
CbSize = Marshal.SizeOf(typeof(NotifyIconData)),
|
||||
HWnd = hWnd,
|
||||
UId = 1000,
|
||||
UFlags = 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (!Bridge.Shell_NotifyIcon(message, ref _notifyIconData))
|
||||
{
|
||||
int errorCode = Marshal.GetLastWin32Error();
|
||||
Logger.LogInfo($"Could not set the shell icon. Action: {action} and error code: {errorCode}. HIcon handle is {icon?.Handle} and HWnd is {hWnd}");
|
||||
|
||||
throw new Win32Exception(errorCode, $"Failed to change tray icon. Action: {action} and error code: {errorCode}");
|
||||
}
|
||||
|
||||
if (action == TrayIconAction.Delete)
|
||||
{
|
||||
_notifyIconData = default;
|
||||
}
|
||||
case TrayIconAction.Update:
|
||||
message = Native.Constants.NIM_MODIFY;
|
||||
break;
|
||||
case TrayIconAction.Delete:
|
||||
message = Native.Constants.NIM_DELETE;
|
||||
break;
|
||||
case TrayIconAction.Add:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
||||
if (action == TrayIconAction.Add || action == TrayIconAction.Update)
|
||||
{
|
||||
Logger.LogInfo($"Cannot set the shell icon - parent window handle is zero or icon is not available. Text: {text} Action: {action}");
|
||||
Logger.LogInfo($"Adding or updating tray icon. HIcon handle is {icon?.Handle}\nHWnd: {hWnd}");
|
||||
|
||||
_notifyIconData = new NotifyIconData
|
||||
{
|
||||
CbSize = Marshal.SizeOf(typeof(NotifyIconData)),
|
||||
HWnd = hWnd,
|
||||
UId = 1000,
|
||||
UFlags = Native.Constants.NIF_ICON | Native.Constants.NIF_TIP | Native.Constants.NIF_MESSAGE,
|
||||
UCallbackMessage = (int)Native.Constants.WM_USER,
|
||||
HIcon = icon?.Handle ?? IntPtr.Zero,
|
||||
SzTip = text,
|
||||
};
|
||||
}
|
||||
else if (action == TrayIconAction.Delete)
|
||||
{
|
||||
_notifyIconData = new NotifyIconData
|
||||
{
|
||||
CbSize = Marshal.SizeOf(typeof(NotifyIconData)),
|
||||
HWnd = hWnd,
|
||||
UId = 1000,
|
||||
UFlags = 0,
|
||||
};
|
||||
}
|
||||
|
||||
if (!Bridge.Shell_NotifyIcon(message, ref _notifyIconData))
|
||||
{
|
||||
int errorCode = Marshal.GetLastWin32Error();
|
||||
throw new Win32Exception(errorCode, $"Failed to change tray icon. Action: {action} and error code: {errorCode}");
|
||||
}
|
||||
|
||||
if (action == TrayIconAction.Delete)
|
||||
{
|
||||
_notifyIconData = default;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -218,8 +215,6 @@ namespace Awake.Core
|
||||
Bridge.TranslateMessage(ref msg);
|
||||
Bridge.DispatchMessage(ref msg);
|
||||
}
|
||||
|
||||
Logger.LogInfo("Message loop terminated.");
|
||||
}
|
||||
|
||||
private static int WndProc(IntPtr hWnd, uint message, IntPtr wParam, IntPtr lParam)
|
||||
@@ -300,20 +295,30 @@ namespace Awake.Core
|
||||
|
||||
internal static void RunOnMainThread(Action action)
|
||||
{
|
||||
_syncContext!.Post(
|
||||
_ =>
|
||||
var syncContext = new SingleThreadSynchronizationContext();
|
||||
SynchronizationContext.SetSynchronizationContext(syncContext);
|
||||
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
syncContext.Post(
|
||||
_ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
Logger.LogInfo($"Thread execution is on: {Environment.CurrentManagedThreadId}");
|
||||
action();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Error: " + e.Message);
|
||||
}
|
||||
},
|
||||
null);
|
||||
action();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Error: " + e.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
syncContext.EndMessageLoop();
|
||||
}
|
||||
},
|
||||
null);
|
||||
#pragma warning restore CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
|
||||
syncContext.BeginMessageLoop();
|
||||
}
|
||||
|
||||
internal static void SetTray(AwakeSettings settings, bool startedFromPowerToys)
|
||||
@@ -348,7 +353,6 @@ namespace Awake.Core
|
||||
private static void CreateNewTrayMenu(bool startedFromPowerToys, bool keepDisplayOn, AwakeMode mode)
|
||||
{
|
||||
TrayMenu = Bridge.CreatePopupMenu();
|
||||
|
||||
if (TrayMenu == IntPtr.Zero)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -53,6 +53,7 @@ namespace Awake
|
||||
{
|
||||
_settingsUtils = new SettingsUtils();
|
||||
LockMutex = new Mutex(true, Core.Constants.AppName, out bool instantiated);
|
||||
|
||||
Logger.InitializeLogger(Path.Combine("\\", Core.Constants.AppName, "Logs"));
|
||||
|
||||
try
|
||||
@@ -70,93 +71,86 @@ namespace Awake
|
||||
|
||||
AppDomain.CurrentDomain.UnhandledException += AwakeUnhandledExceptionCatcher;
|
||||
|
||||
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredAwakeEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
||||
{
|
||||
Exit("PowerToys.Awake tried to start with a group policy setting that disables the tool. Please contact your system administrator.", 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!instantiated)
|
||||
{
|
||||
// Awake is already running - there is no need for us to process
|
||||
// anything further
|
||||
Exit(Core.Constants.AppName + " is already running! Exiting the application.", 1);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
|
||||
Logger.LogInfo($"Launching {Core.Constants.AppName}...");
|
||||
Logger.LogInfo(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion);
|
||||
Logger.LogInfo($"Build: {Core.Constants.BuildId}");
|
||||
Logger.LogInfo($"OS: {Environment.OSVersion}");
|
||||
Logger.LogInfo($"OS Build: {Manager.GetOperatingSystemBuild()}");
|
||||
|
||||
TaskScheduler.UnobservedTaskException += (sender, args) =>
|
||||
{
|
||||
if (PowerToys.GPOWrapper.GPOWrapper.GetConfiguredAwakeEnabledValue() == PowerToys.GPOWrapper.GpoRuleConfigured.Disabled)
|
||||
{
|
||||
Exit("PowerToys.Awake tried to start with a group policy setting that disables the tool. Please contact your system administrator.", 1);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInfo($"Launching {Core.Constants.AppName}...");
|
||||
Logger.LogInfo(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion);
|
||||
Logger.LogInfo($"Build: {Core.Constants.BuildId}");
|
||||
Logger.LogInfo($"OS: {Environment.OSVersion}");
|
||||
Logger.LogInfo($"OS Build: {Manager.GetOperatingSystemBuild()}");
|
||||
Trace.WriteLine($"Task scheduler error: {args.Exception.Message}"); // somebody forgot to check!
|
||||
args.SetObserved();
|
||||
};
|
||||
|
||||
TaskScheduler.UnobservedTaskException += (sender, args) =>
|
||||
{
|
||||
Trace.WriteLine($"Task scheduler error: {args.Exception.Message}"); // somebody forgot to check!
|
||||
args.SetObserved();
|
||||
};
|
||||
// To make it easier to diagnose future issues, let's get the
|
||||
// system power capabilities and aggregate them in the log.
|
||||
Bridge.GetPwrCapabilities(out _powerCapabilities);
|
||||
Logger.LogInfo(JsonSerializer.Serialize(_powerCapabilities));
|
||||
|
||||
// To make it easier to diagnose future issues, let's get the
|
||||
// system power capabilities and aggregate them in the log.
|
||||
Bridge.GetPwrCapabilities(out _powerCapabilities);
|
||||
Logger.LogInfo(JsonSerializer.Serialize(_powerCapabilities));
|
||||
Logger.LogInfo("Parsing parameters...");
|
||||
|
||||
Logger.LogInfo("Parsing parameters...");
|
||||
var configOption = new Option<bool>(AliasesConfigOption, () => false, Resources.AWAKE_CMD_HELP_CONFIG_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
|
||||
var configOption = new Option<bool>(AliasesConfigOption, () => false, Resources.AWAKE_CMD_HELP_CONFIG_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
var displayOption = new Option<bool>(AliasesDisplayOption, () => true, Resources.AWAKE_CMD_HELP_DISPLAY_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
|
||||
var displayOption = new Option<bool>(AliasesDisplayOption, () => true, Resources.AWAKE_CMD_HELP_DISPLAY_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
var timeOption = new Option<uint>(AliasesTimeOption, () => 0, Resources.AWAKE_CMD_HELP_TIME_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ExactlyOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
|
||||
var timeOption = new Option<uint>(AliasesTimeOption, () => 0, Resources.AWAKE_CMD_HELP_TIME_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ExactlyOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
var pidOption = new Option<int>(AliasesPidOption, () => 0, Resources.AWAKE_CMD_HELP_PID_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
|
||||
var pidOption = new Option<int>(AliasesPidOption, () => 0, Resources.AWAKE_CMD_HELP_PID_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
var expireAtOption = new Option<string>(AliasesExpireAtOption, () => string.Empty, Resources.AWAKE_CMD_HELP_EXPIRE_AT_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
|
||||
var expireAtOption = new Option<string>(AliasesExpireAtOption, () => string.Empty, Resources.AWAKE_CMD_HELP_EXPIRE_AT_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
var parentPidOption = new Option<bool>(AliasesParentPidOption, () => true, Resources.AWAKE_CMD_PARENT_PID_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
|
||||
var parentPidOption = new Option<bool>(AliasesParentPidOption, () => false, Resources.AWAKE_CMD_PARENT_PID_OPTION)
|
||||
{
|
||||
Arity = ArgumentArity.ZeroOrOne,
|
||||
IsRequired = false,
|
||||
};
|
||||
RootCommand? rootCommand =
|
||||
[
|
||||
configOption,
|
||||
displayOption,
|
||||
timeOption,
|
||||
pidOption,
|
||||
expireAtOption,
|
||||
parentPidOption,
|
||||
];
|
||||
|
||||
RootCommand? rootCommand =
|
||||
[
|
||||
configOption,
|
||||
displayOption,
|
||||
timeOption,
|
||||
pidOption,
|
||||
expireAtOption,
|
||||
parentPidOption,
|
||||
];
|
||||
rootCommand.Description = Core.Constants.AppName;
|
||||
rootCommand.SetHandler(HandleCommandLineArguments, configOption, displayOption, timeOption, pidOption, expireAtOption, parentPidOption);
|
||||
|
||||
rootCommand.Description = Core.Constants.AppName;
|
||||
rootCommand.SetHandler(HandleCommandLineArguments, configOption, displayOption, timeOption, pidOption, expireAtOption, parentPidOption);
|
||||
|
||||
return rootCommand.InvokeAsync(args).Result;
|
||||
}
|
||||
}
|
||||
return rootCommand.InvokeAsync(args).Result;
|
||||
}
|
||||
|
||||
private static void AwakeUnhandledExceptionCatcher(object sender, UnhandledExceptionEventArgs e)
|
||||
@@ -186,11 +180,15 @@ namespace Awake
|
||||
if (pid == 0 && !useParentPid)
|
||||
{
|
||||
Logger.LogInfo("No PID specified. Allocating console...");
|
||||
AllocateLocalConsole();
|
||||
Manager.AllocateConsole();
|
||||
|
||||
_handler += new ConsoleEventHandler(ExitHandler);
|
||||
Manager.SetConsoleControlHandler(_handler, true);
|
||||
|
||||
Trace.Listeners.Add(new ConsoleTraceListener());
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogInfo("Starting with PID binding.");
|
||||
_startedFromPowerToys = true;
|
||||
}
|
||||
|
||||
@@ -248,7 +246,7 @@ namespace Awake
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"There was a problem with the configuration file. Make sure it exists. {ex.Message}");
|
||||
Logger.LogError($"There was a problem with the configuration file. Make sure it exists.\n{ex.Message}");
|
||||
}
|
||||
}
|
||||
else if (pid != 0 || useParentPid)
|
||||
@@ -309,22 +307,38 @@ namespace Awake
|
||||
}
|
||||
}
|
||||
|
||||
private static void AllocateLocalConsole()
|
||||
{
|
||||
Manager.AllocateConsole();
|
||||
|
||||
_handler += new ConsoleEventHandler(ExitHandler);
|
||||
Manager.SetConsoleControlHandler(_handler, true);
|
||||
|
||||
Trace.Listeners.Add(new ConsoleTraceListener());
|
||||
}
|
||||
|
||||
private static void ScaffoldConfiguration(string settingsPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
SetupFileSystemWatcher(settingsPath);
|
||||
InitializeSettings();
|
||||
var directory = Path.GetDirectoryName(settingsPath)!;
|
||||
var fileName = Path.GetFileName(settingsPath);
|
||||
|
||||
_watcher = new FileSystemWatcher
|
||||
{
|
||||
Path = directory,
|
||||
EnableRaisingEvents = true,
|
||||
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime,
|
||||
Filter = fileName,
|
||||
};
|
||||
|
||||
var mergedObservable = Observable.Merge(
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(
|
||||
h => _watcher.Changed += h,
|
||||
h => _watcher.Changed -= h),
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(
|
||||
h => _watcher.Created += h,
|
||||
h => _watcher.Created -= h));
|
||||
|
||||
mergedObservable
|
||||
.Throttle(TimeSpan.FromMilliseconds(25))
|
||||
.SubscribeOn(TaskPoolScheduler.Default)
|
||||
.Select(e => e.EventArgs)
|
||||
.Subscribe(HandleAwakeConfigChange);
|
||||
|
||||
var settings = Manager.ModuleSettings!.GetSettings<AwakeSettings>(Core.Constants.AppName) ?? new AwakeSettings();
|
||||
TrayHelper.SetTray(settings, _startedFromPowerToys);
|
||||
|
||||
ProcessSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -333,38 +347,6 @@ namespace Awake
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetupFileSystemWatcher(string settingsPath)
|
||||
{
|
||||
var directory = Path.GetDirectoryName(settingsPath)!;
|
||||
var fileName = Path.GetFileName(settingsPath);
|
||||
|
||||
_watcher = new FileSystemWatcher
|
||||
{
|
||||
Path = directory,
|
||||
EnableRaisingEvents = true,
|
||||
NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.CreationTime,
|
||||
Filter = fileName,
|
||||
};
|
||||
|
||||
Observable.Merge(
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(
|
||||
h => _watcher.Changed += h,
|
||||
h => _watcher.Changed -= h),
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(
|
||||
h => _watcher.Created += h,
|
||||
h => _watcher.Created -= h))
|
||||
.Throttle(TimeSpan.FromMilliseconds(25))
|
||||
.SubscribeOn(TaskPoolScheduler.Default)
|
||||
.Select(e => e.EventArgs)
|
||||
.Subscribe(HandleAwakeConfigChange);
|
||||
}
|
||||
|
||||
private static void InitializeSettings()
|
||||
{
|
||||
var settings = Manager.ModuleSettings?.GetSettings<AwakeSettings>(Core.Constants.AppName) ?? new AwakeSettings();
|
||||
TrayHelper.SetTray(settings, _startedFromPowerToys);
|
||||
}
|
||||
|
||||
private static void HandleAwakeConfigChange(FileSystemEventArgs fileEvent)
|
||||
{
|
||||
try
|
||||
@@ -382,9 +364,7 @@ namespace Awake
|
||||
{
|
||||
try
|
||||
{
|
||||
var settings = _settingsUtils!.GetSettings<AwakeSettings>(Core.Constants.AppName)
|
||||
?? throw new InvalidOperationException("Settings are null.");
|
||||
|
||||
var settings = _settingsUtils!.GetSettings<AwakeSettings>(Core.Constants.AppName) ?? throw new InvalidOperationException("Settings are null.");
|
||||
Logger.LogInfo($"Identified custom time shortcuts for the tray: {settings.Properties.CustomTrayTimes.Count}");
|
||||
|
||||
switch (settings.Properties.Mode)
|
||||
@@ -398,7 +378,7 @@ namespace Awake
|
||||
break;
|
||||
|
||||
case AwakeMode.TIMED:
|
||||
uint computedTime = (settings.Properties.IntervalHours * 3600) + (settings.Properties.IntervalMinutes * 60);
|
||||
uint computedTime = (settings.Properties.IntervalHours * 60 * 60) + (settings.Properties.IntervalMinutes * 60);
|
||||
Manager.SetTimedKeepAwake(computedTime, settings.Properties.KeepDisplayOn);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user