Skip to content

Commit

Permalink
[Mouse Jump] Merge branch 'main' into dev/mikeclayton/mouse-jump (mic…
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeclayton committed Apr 13, 2023
2 parents ad31917 + 8b25026 commit 6b7788b
Show file tree
Hide file tree
Showing 17 changed files with 254 additions and 65 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/package-submissions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Submit Microsoft.PowerToys package to Windows Package Manager Community Repository
name: Submit Microsoft.PowerToys package to Windows Package Manager Community Repository
# based off of https://github.com/nushell/nushell/blob/main/.github/workflows/winget-submission.yml

on:
Expand All @@ -7,24 +7,25 @@ on:
types: [published]

jobs:

winget:
name: Publish winget package
runs-on: windows-latest
steps:
- name: Submit package to Windows Package Manager Community Repository
run: |
$wingetPackage = "Microsoft.PowerToys"
$gitToken = "${{ secrets.PT_WINGET }}"
$github = Invoke-RestMethod -uri "https://api.github.com/repos/Microsoft/PowerToys/releases"
$targetRelease = $github | Where-Object -Property name -match 'Release'| Select -First 1
$installerUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
$installerUrlArm = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
$installerUserX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*x64' | Select -ExpandProperty browser_download_url
$installerMachineX64Url = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*x64' | Select -ExpandProperty browser_download_url
$installerUserArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysUserSetup.*arm64' | Select -ExpandProperty browser_download_url
$installerMachineArmUrl = $targetRelease | Select -ExpandProperty assets -First 1 | Where-Object -Property name -match 'PowerToysSetup.*arm64' | Select -ExpandProperty browser_download_url
$ver = $targetRelease.tag_name.Trim("v")
# getting latest wingetcreate file
iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
.\wingetcreate.exe update $wingetPackage -s -v $ver -u $installerUrl $installerUrlArm -t $gitToken
.\wingetcreate.exe update $wingetPackage -s -v $ver -u $installerUserX64Url $installerMachineX64Url $installerUserArmUrl $installerMachineArmUrl -t $gitToken
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline

Go to [Microsoft PowerToys GitHub releases page][github-release-link], 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.

- **For x64 processors (most common) per-user installer:** [PowerToysUserSetup-0.69.0-x64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.0/PowerToysUserSetup-0.69.0-x64.exe)
- **For x64 processors per-machine installer:** [PowerToysSetup-0.69.0-x64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.0/PowerToysSetup-0.69.0-x64.exe)
- **For ARM64 processors per-user installer:** [PowerToysUserSetup-0.69.0-arm64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.0/PowerToysUserSetup-0.69.0-arm64.exe)
- **For ARM64 processors per-machine installer:** [PowerToysSetup-0.69.0-arm64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.0/PowerToysSetup-0.69.0-arm64.exe)
- **For x64 processors (most common) per-user installer:** [PowerToysUserSetup-0.69.1-x64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.1/PowerToysUserSetup-0.69.1-x64.exe)
- **For x64 processors per-machine installer:** [PowerToysSetup-0.69.1-x64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.1/PowerToysSetup-0.69.1-x64.exe)
- **For ARM64 processors per-user installer:** [PowerToysUserSetup-0.69.1-arm64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.1/PowerToysUserSetup-0.69.1-arm64.exe)
- **For ARM64 processors per-machine installer:** [PowerToysSetup-0.69.1-arm64.exe](https://github.com/microsoft/PowerToys/releases/download/v0.69.1/PowerToysSetup-0.69.1-arm64.exe)

This is our preferred method.

Expand Down
12 changes: 12 additions & 0 deletions installer/PowerToysSetup/FileLocksmith.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,27 @@
<!--FileLocksmithAssetsFiles_Component_Def-->
</DirectoryRef>

<DirectoryRef Id="FileLocksmithMicrosoftUIXamlAssetsInstallFolder" FileSource="$(var.BinDir)modules\$(var.FileLocksmithProjectName)\Microsoft.UI.Xaml\Assets">
<Component Id="FileLocksmithMicrosoftUIXamlAssets_NoiseAsset_256x256_PNG.png" Win64="yes" Guid="39889494-838A-4B9A-BD0A-105A1F0161BF">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="FileLocksmithMicrosoftUIXamlAssets_NoiseAsset_256x256_PNG" Value="" KeyPath="yes"/>
</RegistryKey>
<File Id="FileLocksmithMicrosoftUIXamlAssetsFile_NoiseAsset_256x256_PNG.png" Source="$(var.BinDir)modules\$(var.FileLocksmithProjectName)\Microsoft.UI.Xaml\Assets\NoiseAsset_256x256_PNG.png" />
</Component>
</DirectoryRef>

<ComponentGroup Id="FileLocksmithComponentGroup">
<Component Id="RemoveFileLocksmithFolder" Guid="1DAC9A3F-D89C-4730-BF57-1778E011709B" Directory="FileLocksmithInstallFolder" >
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RemoveFileLocksmithFolder" Value="" KeyPath="yes"/>
</RegistryKey>
<RemoveFolder Id="RemoveFolderFileLocksmithFolder" Directory="FileLocksmithInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderFileLocksmithAssetsFolder" Directory="FileLocksmithAssetsInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderFileLocksmithMicrosoftUIXamlInstallFolder" Directory="FileLocksmithMicrosoftUIXamlInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderFileLocksmithMicrosoftUIXamlAssetsInstallFolder" Directory="FileLocksmithMicrosoftUIXamlAssetsInstallFolder" On="uninstall"/>
</Component>
<ComponentRef Id="Module_FileLocksmith" />
<ComponentRef Id="FileLocksmithMicrosoftUIXamlAssets_NoiseAsset_256x256_PNG.png" />
</ComponentGroup>

</Fragment>
Expand Down
6 changes: 6 additions & 0 deletions installer/PowerToysSetup/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,9 @@
</Directory>
<Directory Id="FileLocksmithInstallFolder" Name="$(var.FileLocksmithProjectName)">
<Directory Id="FileLocksmithAssetsInstallFolder" Name="Assets" />
<Directory Id="FileLocksmithMicrosoftUIXamlInstallFolder" Name="Microsoft.UI.Xaml">
<Directory Id="FileLocksmithMicrosoftUIXamlAssetsInstallFolder" Name="Assets" />
</Directory>
</Directory>
<Directory Id="PowerRenameInstallFolder" Name="$(var.PowerRenameProjectName)">
<Directory Id="PowerRenameAssetsFolder" Name="Assets" />
Expand Down Expand Up @@ -501,6 +504,9 @@
<!-- RegistryPreview -->
<Directory Id="RegistryPreviewInstallFolder" Name="$(var.RegistryPreviewProjectName)">
<Directory Id="RegistryPreviewAssetsInstallFolder" Name="Assets" />
<Directory Id="RegistryPreviewMicrosoftUIXamlInstallFolder" Name="Microsoft.UI.Xaml">
<Directory Id="RegistryPreviewMicrosoftUIXamlAssetsInstallFolder" Name="Assets" />
</Directory>
</Directory>

<!-- AlwaysOnTop -->
Expand Down
12 changes: 12 additions & 0 deletions installer/PowerToysSetup/RegistryPreview.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,26 @@
<!--RegistryPreviewAssetsFiles_Component_Def-->
</DirectoryRef>

<DirectoryRef Id="RegistryPreviewMicrosoftUIXamlAssetsInstallFolder" FileSource="$(var.BinDir)modules\$(var.RegistryPreviewProjectName)\Microsoft.UI.Xaml\Assets">
<Component Id="RegistryPreviewMicrosoftUIXamlAssets_NoiseAsset_256x256_PNG.png" Win64="yes" Guid="CBE56377-8E9F-4C4E-85B5-514916FCE818">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RegistryPreviewMicrosoftUIXamlAssets_NoiseAsset_256x256_PNG" Value="" KeyPath="yes"/>
</RegistryKey>
<File Id="RegistryPreviewMicrosoftUIXamlAssetsFile_NoiseAsset_256x256_PNG.png" Source="$(var.BinDir)modules\$(var.RegistryPreviewProjectName)\Microsoft.UI.Xaml\Assets\NoiseAsset_256x256_PNG.png" />
</Component>
</DirectoryRef>

<ComponentGroup Id="RegistryPreviewComponentGroup">
<Component Id="RemoveRegistryPreviewFolder" Guid="D3DBC395-FAC5-44B1-BE44-3FE2B6E0F391" Directory="RegistryPreviewInstallFolder" >
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RemoveRegistryPreviewFolder" Value="" KeyPath="yes"/>
</RegistryKey>
<RemoveFolder Id="RemoveFolderRegistryPreviewFolder" Directory="RegistryPreviewInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderRegistryPreviewAssetsFolder" Directory="RegistryPreviewAssetsInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderRegistryPreviewMicrosoftUIXamlInstallFolder" Directory="RegistryPreviewMicrosoftUIXamlInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderRegistryPreviewMicrosoftUIXamlAssetsInstallFolder" Directory="RegistryPreviewMicrosoftUIXamlAssetsInstallFolder" On="uninstall"/>
</Component>
<ComponentRef Id="RegistryPreviewMicrosoftUIXamlAssets_NoiseAsset_256x256_PNG.png" />
</ComponentGroup>

</Fragment>
Expand Down
2 changes: 1 addition & 1 deletion installer/PowerToysSetup/generateFileList.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ if ($isWinAppSdkProj -eq $True) {

$fileExclusionList = @("*Test*", "*.pdb", "*.lastcodeanalysissucceeded", "createdump.exe") + $interopFilesList + $winAppSDKfilesList

$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*png", "*gif", "*ico", "*cur", "*svg", "index.html", "reg.js", "monacoSpecialLanguages.js", "resources.pri")
$fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*png", "*gif", "*ico", "*cur", "*svg", "index.html", "reg.js", "monacoSpecialLanguages.js", "resources.pri", "NLog.config")

$dllsToIgnore = @("System.CodeDom.dll", "WindowsBase.dll")

Expand Down
39 changes: 39 additions & 0 deletions src/modules/registrypreview/RegistryPreviewUI/FileName.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Runtime.InteropServices;

namespace RegistryPreview
{
// Workaround for File Pickers that don't work while running as admin, per:
// https://github.com/microsoft/WindowsAppSDK/issues/2504
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct FileName
{
public int StructSize;
public IntPtr HwndOwner;
public IntPtr Instance;
public string Filter;
public string CustomFilter;
public int MaxCustFilter;
public int FilterIndex;
public string File;
public int MaxFile;
public string FileTitle;
public int MaxFileTitle;
public string InitialDir;
public string Title;
public int Flags;
public short FileOffset;
public short FileExtension;
public string DefExt;
public IntPtr CustData;
public IntPtr Hook;
public string TemplateName;
public IntPtr PtrReserved;
public int Reserved;
public int FlagsEx;
}
}
52 changes: 24 additions & 28 deletions src/modules/registrypreview/RegistryPreviewUI/MainWindow.Events.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,18 +134,18 @@ private async void OpenButton_Click(object sender, RoutedEventArgs e)
}
}

// Pull in a new REG file
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.ViewMode = PickerViewMode.List;
fileOpenPicker.CommitButtonText = resourceLoader.GetString("OpenButtonText");
fileOpenPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
fileOpenPicker.FileTypeFilter.Add(".reg");
// Pull in a new REG file - we have to use the direct Win32 method because FileOpenPicker crashes when it's
// called while running as admin
string filename = OpenFilePicker.ShowDialog(
resourceLoader.GetString("FilterRegistryName") + '\0' + "*.reg" + '\0' + resourceLoader.GetString("FilterAllFiles") + '\0' + "*.*" + '\0' + '\0',
resourceLoader.GetString("OpenDialogTitle"));

// Get the HWND so we an open the modal
IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
InitializeWithWindow.Initialize(fileOpenPicker, hWnd);
if (filename == string.Empty || File.Exists(filename) == false)
{
return;
}

StorageFile storageFile = await fileOpenPicker.PickSingleFileAsync();
StorageFile storageFile = await StorageFile.GetFileFromPathAsync(filename);

if (storageFile != null)
{
Expand Down Expand Up @@ -174,27 +174,23 @@ private void SaveButton_Click(object sender, RoutedEventArgs e)
/// <summary>
/// Uses a picker to save out a copy of the current reg file
/// </summary>
private async void SaveAsButton_Click(object sender, RoutedEventArgs e)
private void SaveAsButton_Click(object sender, RoutedEventArgs e)
{
// Save out a new REG file and then open it
FileSavePicker fileSavePicker = new FileSavePicker();
fileSavePicker.CommitButtonText = resourceLoader.GetString("SaveButtonText");
fileSavePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary;
fileSavePicker.FileTypeChoices.Add("Registry file", new List<string>() { ".reg" });
fileSavePicker.SuggestedFileName = resourceLoader.GetString("SuggestFileName");

// Get the HWND so we an save the modal
IntPtr hWnd = WinRT.Interop.WindowNative.GetWindowHandle(this);
InitializeWithWindow.Initialize(fileSavePicker, hWnd);

StorageFile storageFile = await fileSavePicker.PickSaveFileAsync();

if (storageFile != null)
// Save out a new REG file and then open it - we have to use the direct Win32 method because FileOpenPicker crashes when it's
// called while running as admin
string filename = SaveFilePicker.ShowDialog(
resourceLoader.GetString("SuggestFileName"),
resourceLoader.GetString("FilterRegistryName") + '\0' + "*.reg" + '\0' + resourceLoader.GetString("FilterAllFiles") + '\0' + "*.*" + '\0' + '\0',
resourceLoader.GetString("SaveDialogTitle"));

if (filename == string.Empty)
{
App.AppFilename = storageFile.Path;
SaveFile();
UpdateToolBarAndUI(OpenRegistryFile(App.AppFilename));
return;
}

App.AppFilename = filename;
SaveFile();
UpdateToolBarAndUI(OpenRegistryFile(App.AppFilename));
}

/// <summary>
Expand Down
Loading

0 comments on commit 6b7788b

Please sign in to comment.