diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 56800fb1d6..f2eb897a4d 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,5 +1,6 @@ name: "๐Ÿ•ท๏ธ Bug report" description: Report errors or unexpected behavior +type: Bug labels: - Issue-Bug - Needs-Triage diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index ade50bf5f5..d7d092dbca 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,5 +1,6 @@ name: "โญ Feature or enhancement request" description: Propose something new. +type: Feature labels: - Needs-Triage body: diff --git a/.github/ISSUE_TEMPLATE/translation_issue.yml b/.github/ISSUE_TEMPLATE/translation_issue.yml index 7cb712df30..69787a3ed6 100644 --- a/.github/ISSUE_TEMPLATE/translation_issue.yml +++ b/.github/ISSUE_TEMPLATE/translation_issue.yml @@ -1,5 +1,6 @@ name: "๐ŸŒ Localization/Translation issue" description: Report incorrect translations. +type: Bug labels: - Issue-Bug - Area-Localization diff --git a/.github/actions/spell-check/allow/code.txt b/.github/actions/spell-check/allow/code.txt index 2737b7327c..752c1864bd 100644 --- a/.github/actions/spell-check/allow/code.txt +++ b/.github/actions/spell-check/allow/code.txt @@ -226,3 +226,8 @@ arcosh dbus anypass gpg + +# .NET + +AOT +Aot diff --git a/.github/actions/spell-check/allow/names.txt b/.github/actions/spell-check/allow/names.txt index 95c1427b9d..c141bd5980 100644 --- a/.github/actions/spell-check/allow/names.txt +++ b/.github/actions/spell-check/allow/names.txt @@ -28,7 +28,8 @@ videoconference # USERS -LWXpg # (number eight)LWXpg is actual user name but spell checker throws error with a numeric leading value ... which is kinda odd +# 8LWXpg is user name but user folder causes a flag +LWXpg Adoumie Advaith alekhyareddy @@ -43,6 +44,7 @@ Bartosz betadele betsegaw bricelam +bsky CCcat Chinh chrdavis @@ -55,7 +57,6 @@ damienleroy davidegiacometti debian Deibisu -Deibisu Delimarsky Deondre DHowett @@ -71,6 +72,7 @@ Garside Gershaft Giordani Gokce +grzhan Guo hanselman Harmath @@ -86,10 +88,10 @@ jefflord Jordi jyuwono Kairu -Kairu Kamra Kantarci Karthick +kaylacinnamon kevinguo Krigun Lambson @@ -122,7 +124,6 @@ Quriz randyrants ricardosantos riri -riri ritchielawrence robmikh Rutkas @@ -146,6 +147,7 @@ TBM tilovell Triet waaverecords +Whuihuan Xpg ycv Yuniardi @@ -156,6 +158,8 @@ Zykova # OTHERS +Bilibili +BVID cmdow Controlz cortana diff --git a/.github/actions/spell-check/excludes.txt b/.github/actions/spell-check/excludes.txt index fd89d668a2..fa1d25eda9 100644 --- a/.github/actions/spell-check/excludes.txt +++ b/.github/actions/spell-check/excludes.txt @@ -2,11 +2,11 @@ (?:^|/)(?i)COPYRIGHT (?:^|/)(?i)LICEN[CS]E (?:^|/)3rdparty/ -(?:^|/)FilePreviewCommon/Assets/Monaco/customLanguages/ -(?:^|/)FilePreviewCommon/Assets/Monaco/generateLanguagesJson.html -(?:^|/)FilePreviewCommon/Assets/Monaco/index.html -(?:^|/)FilePreviewCommon/Assets/Monaco/monaco_languages.json -(?:^|/)FilePreviewCommon/Assets/Monaco/monacoSpecialLanguages.js +(?:^|/)src/Monaco/customLanguages/ +(?:^|/)src/Monaco/generateLanguagesJson.html +(?:^|/)src/Monaco/index.html +(?:^|/)src/Monaco/monaco_languages.json +(?:^|/)src/Monaco/monacoSpecialLanguages.js (?:^|/)go\.sum$ (?:^|/)monacoSRC/ (?:^|/)package(?:-lock|)\.json$ @@ -99,7 +99,7 @@ ^\Q.pipelines/ESRPSigning_core.json\E$ ^\Q.pipelines/sdl.gdnbaselines\E$ ^\Qinstaller/PowerToysSetup/Settings.wxs\E$ -^\Qsrc/common/FilePreviewCommon/Assets/Monaco/monaco_languages.json\E$ +^\Qsrc/Monaco/monaco_languages.json\E$ ^\Qsrc/common/ManagedCommon/ColorFormatHelper.cs\E$ ^\Qsrc/common/notifications/BackgroundActivatorDLL/cpp.hint\E$ ^\Qsrc/modules/colorPicker/ColorPickerUI/Assets/ColorPicker/colorPicker.cur\E$ diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 1fca6be137..de32d2a324 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -29,7 +29,6 @@ AFFINETRANSFORM AFX AGGREGATABLE AHybrid -AKV akv ALarger ALLAPPS @@ -57,14 +56,12 @@ APPBARDATA appdata APPEXECLINK Appium -applayout Applicationcan APPLICATIONFRAMEHOST appmanifest APPNAME appref appsettings -appsfolder appwindow appwiz APSTUDIO @@ -72,11 +69,9 @@ AQS ARandom ARCHITEW ARemapped -ari ARPINSTALLLOCATION ARPPRODUCTICON ARRAYSIZE -arw asf AShortcut ASingle @@ -107,6 +102,7 @@ backtracer bbwe bck BESTEFFORT +bezelled bhid BIF bigbar @@ -145,7 +141,6 @@ BTNFACE bugreport BUILDARCH BUILDNUMBER -buildtask buildtransitive BVal BValue @@ -155,6 +150,7 @@ CALG callbackptr calpwstr Cangjie +caniuse CANRENAME CAPTUREBLT CAPTURECHANGED @@ -263,13 +259,12 @@ CRH critsec Crossdevice CRSEL -crw +crx CSearch CSettings cso CSRW CStyle -cswinrt CSY CTest currentculture @@ -306,8 +301,8 @@ DCOM dcommon dcomp DComposition -dcr -dcs +DCR +DCs ddd DDEIf DDevice @@ -351,7 +346,6 @@ devpkey DEVSOURCE DIIRFLAG dimm -directshow DISABLEASACTIONKEY diskmgmt DISPLAYCHANGE @@ -367,7 +361,6 @@ dllmain DNLEN DONOTROUND DONTVALIDATEPATH -DOPUS dotnet DPICHANGED DPIs @@ -379,7 +372,6 @@ DRAWCLIPBOARD DRAWFRAME drawingcolor dreamsofameaningfullife -drf drivedetectionwarning dshow DSTINVERT @@ -423,7 +415,6 @@ editkeyboardwindow EDITSHORTCUTS editshortcutswindow EFile -eip ekus emmintrin Emoji @@ -450,12 +441,13 @@ erwrite ESettings esrp etl -ETW +etw EUQ eurochange eventlog eventvwr everytime +evntrace evt EWXFORCE EWXFORCEIFHUNG @@ -527,7 +519,6 @@ FZE gacutil Gaeilge Gaidhlig -GBarm GCLP gdi gdiplus @@ -597,7 +588,7 @@ Hiberboot HIBYTE hicon HIDEWINDOW -hif +Hif HIMAGELIST himl hinst @@ -646,6 +637,7 @@ HWNDLAST HWNDNEXT HWNDPREV hyjiacan +IApp IBeam ICapture IClass @@ -672,10 +664,10 @@ IGNOREUNKNOWN IGraphics iid Iindex -iiq IJson Ijwhost IKs +iljxck ILogon IMAGEHLP IMAGERESIZERCONTEXTMENU @@ -735,17 +727,17 @@ ISSEPARATOR ITask ith ITHUMBNAIL +ITwoWayPipeMessageIPCManaged IUI IUnknown +IUse IWbem IWeb IWIC iwr IYUV -jfi jfif jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi -jif jjw jobject jpe @@ -754,7 +746,6 @@ Jsons jsonval junja jxr -kdc keybd KEYBDDATA KEYBDINPUT @@ -780,6 +771,7 @@ lastcodeanalysissucceeded Lastdevice LASTEXITCODE LAYOUTRTL +lcb LCIDTo lcl Lclean @@ -879,7 +871,6 @@ MAXIMIZEBOX MAXSHORTCUTSIZE maxversiontested MBR -mdc MDICHILD MDL mdtext @@ -887,7 +878,6 @@ mdtxt mdwn MEDIASUBTYPE mediatype -mef MENUITEMINFO MENUITEMINFOW MERGECOPY @@ -945,7 +935,6 @@ mpmc MRM MRT mru -mrw msc mscorlib msdata @@ -997,7 +986,6 @@ NCRENDERING ndp NEEDDISPATCH needinfo -netcore netcoreapp netcpl netframework @@ -1006,10 +994,12 @@ netsh newcolor newdev NEWDIALOGSTYLE +NEWFILE newitem newpath newplus NEWPLUSCONTEXTMENU +NEWPLUSSHELLEXTENSIONWIN newrow newsgroups NIF @@ -1068,13 +1058,11 @@ NOZORDER NPH npmjs NResize -nrw nsunt NTAPI ntdll ntfs NTSTATUS -nugets nullonfailure numberbox nwc @@ -1099,7 +1087,6 @@ opensource openxmlformats OPTIMIZEFORINVOKE ORAW -ori ORPHANEDDIALOGTITLE ORSCANS oss @@ -1148,7 +1135,7 @@ pdo pdto pdtobj pdw -Peb +peb pef PElems Pels @@ -1184,6 +1171,7 @@ pnid Pnp Popups POPUPWINDOW +POSITIONITEM POWERRENAMECONTEXTMENU powerrenameinput POWERRENAMETEST @@ -1220,11 +1208,13 @@ prgms pri PRINTCLIENT printmanagement +privacystatement prm proactively PROCESSENTRY PROCESSKEY processthreadsapi +PROCESSTRACE PRODEXT PRODUCTVERSION Progman @@ -1266,7 +1256,6 @@ PWSTR pwsz pwtd QDC -QDir qianlifeng qit QITAB @@ -1277,7 +1266,6 @@ QUERYENDSESSION QUERYOPEN QUEUESYNC QUNS -raf RAII RAlt Rasterize @@ -1381,8 +1369,6 @@ runtimes ruuid rvm rwin -rwl -rwz sacl safeprojectname SAMEKEYPREVIOUSLYMAPPED @@ -1516,7 +1502,6 @@ Srch SRCINVERT SRCPAINT SResize -srf srme srre srw @@ -1590,9 +1575,9 @@ SYSKEYUP SYSLIB SYSMENU SYSTEMAPPS -systemsettings SYSTEMTIME SYSTEMWOW +tailwindcss tapp TApplication TApplied @@ -1612,7 +1597,6 @@ TCustom tdbuild TDefault TDevice -telem telephon templatenamespace testprocess @@ -1637,6 +1621,7 @@ tkconverters TLayout tlb tlbimp +tlhelp TMPVAR TNP Toolhelp @@ -1644,11 +1629,12 @@ toolkitconverters Toolset toolwindow TOPDOWNDIB -TOTALCMD TOUCHEVENTF TOUCHINPUT touchpad +TRACEHANDLE tracelogging +tracerpt trafficmanager traies transicc @@ -1706,11 +1692,9 @@ urlmon Usb USEDEFAULT USEFILEATTRIBUTES -USEPOSITION USERDATA Userenv USESHOWWINDOW -USESIZE USESTDHANDLES USRDLL UType @@ -1803,7 +1787,6 @@ wgpocpl WIC wil winapi -winappdriver wincodec Wincodecsdk wincolor @@ -1867,6 +1850,7 @@ WNDCLASSEX WNDCLASSEXW WNDCLASSW WNDPROC +wnode workarounds WORKSPACESEDITOR WORKSPACESLAUNCHER @@ -1909,9 +1893,9 @@ XFile XIncrement XLoc XNamespace +Xoshiro XPels XPixel -xplorer XResource xsi XStr diff --git a/.pipelines/ESRPSigning_core.json b/.pipelines/ESRPSigning_core.json index 57a22ffd57..878716c7d7 100644 --- a/.pipelines/ESRPSigning_core.json +++ b/.pipelines/ESRPSigning_core.json @@ -166,6 +166,7 @@ "PowerToys.FindMyMouse.dll", "PowerToys.MouseHighlighter.dll", "PowerToys.MouseJump.dll", + "PowerToys.MouseJump.Common.dll", "PowerToys.MousePointerCrosshairs.dll", "PowerToys.MouseJumpUI.dll", "PowerToys.MouseJumpUI.exe", @@ -180,6 +181,7 @@ "WinUI3Apps\\PowerToys.NewPlus.ShellExtension.dll", "WinUI3Apps\\NewPlusPackage.msix", + "WinUI3Apps\\PowerToys.NewPlus.ShellExtension.win10.dll", "PowerAccent.Core.dll", "PowerToys.PowerAccent.dll", @@ -200,6 +202,7 @@ "PowerToys.WorkspacesLauncherUI.exe", "PowerToys.WorkspacesLauncherUI.dll", "PowerToys.WorkspacesModuleInterface.dll", + "PowerToys.WorkspacesCsharpLibrary.dll", "WinUI3Apps\\PowerToys.RegistryPreviewExt.dll", "WinUI3Apps\\PowerToys.RegistryPreviewUILib.dll", @@ -320,6 +323,10 @@ "WinUI3Apps\\ReverseMarkdown.dll", "WinUI3Apps\\SharpCompress.dll", "WinUI3Apps\\ZstdSharp.dll", + "TestableIO.System.IO.Abstractions.dll", + "WinUI3Apps\\TestableIO.System.IO.Abstractions.dll", + "TestableIO.System.IO.Abstractions.Wrappers.dll", + "WinUI3Apps\\TestableIO.System.IO.Abstractions.Wrappers.dll", "ColorCode.Core.dll", "ColorCode.UWP.dll", "UnitsNet.dll", diff --git a/.pipelines/applyXamlStyling.ps1 b/.pipelines/applyXamlStyling.ps1 index 8a9dd1b1df..e47edd0c0f 100644 --- a/.pipelines/applyXamlStyling.ps1 +++ b/.pipelines/applyXamlStyling.ps1 @@ -117,7 +117,10 @@ else { Write-Error 'XAML Styling is incorrect, please run `.\.pipelines\applyXamlStyling.ps1 -Main` locally.' } - + if ($lastExitCode -lt 0) + { + Write-Error "Error running dotnet tool run, with the exit code $lastExitCode. Please verify logs and running environment." + } # Return XAML Styler Status exit $lastExitCode } diff --git a/.pipelines/packages.config b/.pipelines/packages.config index a5cab593eb..43fa34c91c 100644 --- a/.pipelines/packages.config +++ b/.pipelines/packages.config @@ -1,4 +1,4 @@ - + diff --git a/.pipelines/v2/ci.yml b/.pipelines/v2/ci.yml index 5e7bf26676..0b8daa76d6 100644 --- a/.pipelines/v2/ci.yml +++ b/.pipelines/v2/ci.yml @@ -4,22 +4,22 @@ trigger: include: - main - stable - paths: - exclude: - - doc/* - - temp/* - - tools/* - - '**.md' +# paths: +# exclude: +# - doc/* +# - temp/* +# - tools/* +# - '**.md' pr: branches: include: - main - stable - paths: - exclude: - - '**.md' - - doc +# paths: +# exclude: +# - '**.md' +# - doc name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) @@ -37,6 +37,10 @@ parameters: type: boolean displayName: "Run Tests" default: true + - name: useVSPreview + type: boolean + displayName: "Build Using Visual Studio Preview" + default: false extends: template: templates/pipeline-ci-build.yml @@ -44,3 +48,4 @@ extends: buildPlatforms: ${{ parameters.buildPlatforms }} enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }} runTests: ${{ parameters.runTests }} + useVSPreview: ${{ parameters.useVSPreview }} diff --git a/.pipelines/v2/release.yml b/.pipelines/v2/release.yml index b4a6a80833..7a5b29c1d4 100644 --- a/.pipelines/v2/release.yml +++ b/.pipelines/v2/release.yml @@ -33,6 +33,11 @@ parameters: - x64 - arm64 + - name: useVSPreview + type: boolean + displayName: "Build Using Visual Studio Preview" + default: false + name: $(BuildDefinitionName)_$(date:yyMM).$(date:dd)$(rev:rrr) extends: @@ -42,7 +47,10 @@ extends: - 1ES.PT.ViaStartRight pool: name: SHINE-INT-S - image: SHINE-VS17-Latest + ${{ if eq(parameters.useVSPreview, true) }}: + demands: ImageOverride -equals SHINE-VS17-Preview + ${{ else }}: + image: SHINE-VS17-Latest os: windows sdl: tsa: @@ -58,7 +66,10 @@ extends: parameters: pool: name: SHINE-INT-L - image: SHINE-VS17-Latest + ${{ if eq(parameters.useVSPreview, true) }}: + demands: ImageOverride -equals SHINE-VS17-Preview + ${{ else }}: + image: SHINE-VS17-Latest os: windows variables: IsPipeline: 1 # The installer uses this to detect whether it should pick up localizations @@ -90,8 +101,8 @@ extends: - script: | call nuget.exe restore -configFile .pipelines/release-nuget.config -PackagesDirectory . .pipelines/packages.config || exit /b 1 - move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1 - move /Y "Microsoft.PowerToys.Telemetry.2.0.0\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1 + move /Y "Microsoft.PowerToys.Telemetry.2.0.2\build\include\TraceLoggingDefines.h" "src\common\Telemetry\TraceLoggingDefines.h" || exit /b 1 + move /Y "Microsoft.PowerToys.Telemetry.2.0.2\build\include\TelemetryBase.cs" "src\common\Telemetry\TelemetryBase.cs" || exit /b 1 displayName: Emplace telemetry files - stage: Publish diff --git a/.pipelines/v2/templates/job-build-project.yml b/.pipelines/v2/templates/job-build-project.yml index d24158658b..1933b74e8d 100644 --- a/.pipelines/v2/templates/job-build-project.yml +++ b/.pipelines/v2/templates/job-build-project.yml @@ -50,7 +50,9 @@ parameters: - name: runTests type: boolean default: true - + - name: useVSPreview + type: boolean + default: false - name: versionNumber type: string default: '0.0.1' @@ -127,17 +129,15 @@ jobs: Write-Host "##vso[task.setvariable variable=MSBuildCacheParameters]$MSBuildCacheParameters" displayName: Prepare MSBuildCache variables - - ${{ if eq(parameters.codeSign, true) }}: - # Only required if we're using ESRP - - template: steps-ensure-dotnet-version.yml - parameters: - sdk: true - version: '6.0' + - template: steps-ensure-dotnet-version.yml + parameters: + sdk: true + version: '6.0' - template: steps-ensure-dotnet-version.yml parameters: sdk: true - version: '8.0' + version: '9.0' - ${{ if eq(parameters.runTests, true) }}: - task: VisualStudioTestPlatformInstaller@1 @@ -145,13 +145,19 @@ jobs: - pwsh: |- & '.pipelines/applyXamlStyling.ps1' -Passive + displayName: Verify XAML formatting + + - pwsh: |- & '.pipelines/verifyNugetPackages.ps1' -solution '$(build.sourcesdirectory)\PowerToys.sln' + displayName: Verify Nuget package versions for PowerToys.sln + + - pwsh: |- & '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\PowerToys.sln' & '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\tools\BugReportTool\BugReportTool.sln' & '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\tools\WebcamReportTool\WebcamReportTool.sln' & '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\tools\StylesReportTool\StylesReportTool.sln' & '.pipelines/verifyArm64Configuration.ps1' -solution '$(build.sourcesdirectory)\installer\PowerToysSetup.sln' - displayName: Verify formatting, nuget, and ARM64 configurations + displayName: Verify ARM64 configurations - ${{ if eq(parameters.enablePackageCaching, true) }}: - task: Cache@2 @@ -177,6 +183,9 @@ jobs: - pwsh: |- & "$(build.sourcesdirectory)\.pipelines\verifyAndSetLatestVCToolsVersion.ps1" displayName: Work around DD-1541167 (VCToolsVersion) + ${{ if eq(parameters.useVSPreview, true) }}: + env: + VCWhereExtraVersionTarget: '-prerelease' - pwsh: |- & "$(build.sourcesdirectory)\.pipelines\installWiX.ps1" @@ -224,7 +233,10 @@ jobs: inputs: solution: '**\HostsUILib.csproj' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog + ${{ if eq(parameters.useVSPreview, true) }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog /p:NoWarn=NU5104 + ${{ else }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-hosts.binlog configuration: $(BuildConfiguration) msbuildArchitecture: x64 maximumCpuCount: true @@ -237,7 +249,10 @@ jobs: inputs: solution: '**\EnvironmentVariablesUILib.csproj' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog + ${{ if eq(parameters.useVSPreview, true) }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog /p:NoWarn=NU5104 + ${{ else }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-env-var-editor.binlog configuration: $(BuildConfiguration) msbuildArchitecture: x64 maximumCpuCount: true @@ -250,7 +265,10 @@ jobs: inputs: solution: '**\RegistryPreviewUILib.csproj' vsVersion: 17.0 - msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog + ${{ if eq(parameters.useVSPreview, true) }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog /p:NoWarn=NU5104 + ${{ else }}: + msbuildArgs: /p:CIBuild=true;NoBuild=true -t:pack /bl:$(LogOutputDirectory)\build-registry-preview.binlog configuration: $(BuildConfiguration) msbuildArchitecture: x64 maximumCpuCount: true @@ -372,6 +390,16 @@ jobs: msbuildArchitecture: x64 maximumCpuCount: true + ### HACK: On ARM64 builds, building an app with Windows App SDK copies the x64 WebView2 dll instead of the ARM64 one. This task makes sure the right dll is used. + - task: CopyFiles@2 + displayName: HACK Copy core WebView2 ARM64 dll to output directory + condition: eq(variables['BuildPlatform'],'arm64') + inputs: + contents: packages/Microsoft.Web.WebView2.1.0.2739.15/runtimes/win-ARM64/native_uap/Microsoft.Web.WebView2.Core.dll + targetFolder: $(Build.SourcesDirectory)/ARM64/Release/WinUI3Apps/ + flattenFolders: True + OverWrite: True + # Check if deps.json files don't reference different dll versions. - pwsh: |- & '.pipelines/verifyDepsJsonLibraryVersions.ps1' -targetDir '$(build.sourcesdirectory)\$(BuildPlatform)\$(BuildConfiguration)' diff --git a/.pipelines/v2/templates/job-test-project.yml b/.pipelines/v2/templates/job-test-project.yml index d878413cd6..bcac47b6a1 100644 --- a/.pipelines/v2/templates/job-test-project.yml +++ b/.pipelines/v2/templates/job-test-project.yml @@ -45,7 +45,7 @@ jobs: - template: steps-ensure-dotnet-version.yml parameters: sdk: true - version: '8.0' + version: '9.0' - task: VisualStudioTestPlatformInstaller@1 displayName: Ensure VSTest Platform diff --git a/.pipelines/v2/templates/pipeline-ci-build.yml b/.pipelines/v2/templates/pipeline-ci-build.yml index 17f4654ccd..71ebd6a33b 100644 --- a/.pipelines/v2/templates/pipeline-ci-build.yml +++ b/.pipelines/v2/templates/pipeline-ci-build.yml @@ -19,6 +19,9 @@ parameters: - name: runTests type: boolean default: true + - name: useVSPreview + type: boolean + default: false stages: # Allow manual builds to skip pre-check @@ -32,23 +35,26 @@ stages: displayName: Build ${{ platform }} ${{ if ne(variables['Build.Reason'], 'Manual') }}: dependsOn: [Precheck] + condition: and(succeeded(), ne(dependencies.Precheck.outputs['Precheck.verifyBuildRequest.skipBuild'], 'Yes')) ${{ else }}: dependsOn: [] jobs: - template: job-build-project.yml parameters: - condition: and(succeeded(), or(eq(variables['Build.Reason'], 'Manual'), ne(stageDependencies.Precheck.Precheck.outputs['verifyBuildRequest.skipBuild'], 'Yes'))) pool: ${{ if eq(variables['System.CollectionId'], 'cb55739e-4afe-46a3-970f-1b49d8ee7564') }}: name: SHINE-INT-L ${{ else }}: name: SHINE-OSS-L + ${{ if eq(parameters.useVSPreview, true) }}: + demands: ImageOverride -equals SHINE-VS17-Preview buildPlatforms: - ${{ platform }} buildConfigurations: [Release] enablePackageCaching: true enableMsBuildCaching: ${{ parameters.enableMsBuildCaching }} runTests: ${{ parameters.runTests }} + useVSPreview: ${{ parameters.useVSPreview }} - ${{ if eq(parameters.runTests, true) }}: - stage: Test_${{ platform }} diff --git a/.pipelines/v2/templates/steps-ensure-dotnet-version.yml b/.pipelines/v2/templates/steps-ensure-dotnet-version.yml index ee688d18f6..c3204d065a 100644 --- a/.pipelines/v2/templates/steps-ensure-dotnet-version.yml +++ b/.pipelines/v2/templates/steps-ensure-dotnet-version.yml @@ -1,7 +1,7 @@ parameters: - name: version type: string - default: "8.0" + default: "9.0" - name: sdk type: boolean default: false diff --git a/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 b/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 index 3d140a6c9b..6527b63574 100644 --- a/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 +++ b/.pipelines/verifyAndSetLatestVCToolsVersion.ps1 @@ -1,4 +1,4 @@ -$LatestVCToolsVersion = (([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml)).instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.CRT.Source" }).version; +$LatestVCToolsVersion = (([xml](& 'C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe' -latest $env:VCWhereExtraVersionTarget -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -include packages -format xml)).instances.instance.packages.package | ? { $_.id -eq "Microsoft.VisualCpp.CRT.Source" }).version; Write-Output "Latest VCToolsVersion: $LatestVCToolsVersion" Write-Output "Updating VCToolsVersion environment variable for job" diff --git a/.pipelines/verifyArm64Configuration.ps1 b/.pipelines/verifyArm64Configuration.ps1 index 3a6a9cfe29..a509ec374f 100644 --- a/.pipelines/verifyArm64Configuration.ps1 +++ b/.pipelines/verifyArm64Configuration.ps1 @@ -59,6 +59,7 @@ if ($errorTable.Count -gt 0) { }; Write-Host -ForegroundColor Red `r } + Write-Error "Found arm64 verification errors." exit 1; } diff --git a/.pipelines/verifyDepsJsonLibraryVersions.ps1 b/.pipelines/verifyDepsJsonLibraryVersions.ps1 index 16ef379188..7d5fc02c10 100644 --- a/.pipelines/verifyDepsJsonLibraryVersions.ps1 +++ b/.pipelines/verifyDepsJsonLibraryVersions.ps1 @@ -15,7 +15,7 @@ Param( $referencedFileVersionsPerDll = @{} $totalFailures = 0 -Get-ChildItem $targetDir -Recurse -Filter *.deps.json -Exclude UITests-FancyZones* | ForEach-Object { +Get-ChildItem $targetDir -Recurse -Filter *.deps.json -Exclude UITests-FancyZones*,MouseJump.Common.UnitTests* | ForEach-Object { # Temporarily exclude FancyZones UI tests because of Appium.WebDriver dependencies $depsJsonFullFileName = $_.FullName $depsJsonFileName = $_.Name diff --git a/.pipelines/verifyNugetPackages.ps1 b/.pipelines/verifyNugetPackages.ps1 index 1fcc5237f0..54d0137121 100644 --- a/.pipelines/verifyNugetPackages.ps1 +++ b/.pipelines/verifyNugetPackages.ps1 @@ -8,6 +8,12 @@ Write-Host "Verifying Nuget packages for $solution" dotnet tool restore dotnet consolidate -s $solution +if ($lastExitCode -ne 0) +{ + $result = $lastExitCode + Write-Error "Error running dotnet consolidate, with the exit code $lastExitCode. Please verify logs and running environment." + exit $result +} if (-not $?) { diff --git a/.pipelines/versionAndSignCheck.ps1 b/.pipelines/versionAndSignCheck.ps1 index 1b15fe52db..1baf34570e 100644 --- a/.pipelines/versionAndSignCheck.ps1 +++ b/.pipelines/versionAndSignCheck.ps1 @@ -48,7 +48,7 @@ $totalFailure = 0; Write-Host $DirPath; if (-not (Test-Path $DirPath)) { - Write-Host "Folder does not exist!" + Write-Error "Folder does not exist!" } Write-Host "Total items: " $items.Count @@ -79,6 +79,7 @@ $items | ForEach-Object { } if ($totalFailure -gt 0) { + Write-Error "Some items had issues." exit 1 } diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 43eb58e7e0..02f8746a78 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,53 +1,53 @@ # PowerToys Contributor's Guide -Below is our guidance for how to report issues, propose new features, and submit contributions via Pull Requests (PRs). Our philosophy is heavily based around understanding the problem and scenarios first, this is why we follow this pattern before work has started. +Below is our guidance for reporting issues, proposing new features, and submitting contributions via Pull Requests (PRs). Our philosophy is to understand the problem and scenarios first, which is why we follow this pattern before work starts. -1. There is an issue -2. There has been a conversation -3. There is agreement on the problem, the fit for PowerToys, and the solution to the problem (implementation) +1. There is an issue. +2. There has been a conversation. +3. There is agreement on the problem, the fit for PowerToys, and the solution to the problem (implementation). -## Filing an issue +## Filing an Issue -Please follow this simple rule to help us eliminate any unnecessary wasted effort & frustration, and ensure an efficient and effective use of everyone's time - yours, ours, and other community members': +**Importance of Filing an Issue First** -> ๐Ÿ‘‰ If you have a question, think you've discovered an issue, would like to propose a new feature, etc., then find/file an issue **BEFORE** starting work to fix/implement it. +Please follow this rule to help eliminate wasted effort and frustration, and to ensure an efficient and effective use of everyoneโ€™s time: -When requesting new features / enhancements, understanding problem and scenario around it is extremely important. Having additional evidence, data, tweets, blog posts, research, ... anything is extremely helpful. This information provides context to the scenario that may otherwise be lost. +> ๐Ÿ‘‰ If you have a question, think you've discovered an issue, or would like to propose a new feature, please find/file an issue **BEFORE** starting work to fix/implement it. -* Don't know whether you're reporting an issue or requesting a feature? File an issue -* Have a question that you don't see answered in docs, videos, etc.? File an issue -* Want to know if we're planning on building a particular feature? File an issue -* Got a great idea for a new utility or feature? File an issue/request/idea -* Don't understand how to do something? File an issue/Community Guidance Request -* Found an existing issue that describes yours? Great - upvote and add additional commentary / info / repro-steps / etc. +When requesting new features or enhancements, providing additional evidence, data, tweets, blog posts, or research is extremely helpful. This information gives context to the scenario that may otherwise be lost. -A quick search before filing an issue also could be helpful. It is likely someone else has found the problem you're seeing, and someone may be working on or have already contributed a fix! +* Unsure whether itโ€™s an issue or feature request? File an issue. +* Have a question that isn't answered in the docs, videos, etc.? File an issue. +* Want to know if weโ€™re planning a particular feature? File an issue. +* Got a great idea for a new utility or feature? File an issue/request/idea. +* Donโ€™t understand how to do something? File an issue/Community Guidance Request. +* Found an existing issue that describes yours? Great! Upvote and add additional commentary, info, or repro steps. -### How to tell the PowerToys team this is an interesting thing to focus on +A quick search before filing an issue could be helpful. Itโ€™s likely someone else has found the same problem, and they may even be working on or have already contributed a fix! -Upvote the original issue by clicking its [+๐Ÿ˜Š] button and hitting ๐Ÿ‘ (+1) icon or a different one. This way allows us to measure how impactful different issues are compared to others. The issue with comments like "+1", "me too", or similar is they actually make it harder to have a conversation and harder to quickly determine trending important requests. +### Indicating Interest in Issues + +To let the team know which issues are important, upvote by clicking the [+๐Ÿ˜Š] button and the ๐Ÿ‘ icon on the original issue post. Avoid comments like "+1" or "me too" as they clutter the discussion and make it harder to prioritize requests. --- -## Contributing fixes / features +## Contributing Fixes/Features -Please comment on [our "Would you like to contribute to PowerToys?" thread](https://github.com/microsoft/PowerToys/issues/28769) to let us know you're interested in working on something before you start the work. Not only does this avoid multiple people unexpectedly working on the same thing at the same time but it enables us to make sure everyone is clear on what should be done to implement any new functionality. It's less work for everyone, in the long run, to establish this up front. +Please comment on our ["Would you like to contribute to PowerToys?"](https://github.com/microsoft/PowerToys/issues/28769) thread to let us know you're interested in working on something before you start. This helps avoid multiple people unexpectedly working on the same thing and ensures everyone is clear on what should be done. It's less work for everyone to establish this up front. -### Localization issues +### Localization Issues -Please file localization issues, so our internal localization team can identify and fix them. However we currently don't accept community Pull Requests fixing localization issues. Localization is handled by the internal Microsoft team only. +For localization issues, please file an issue to notify our internal localization team, as community PRs for localization aren't accepted. Localization is handled exclusively by the internal Microsoft team. -### To Spec or not to Spec +### To Spec or Not to Spec -A key point is for everyone to understand the approach that will be taken. We want to be sure if anyone does work, we will accept it in. Items that are larger in scope we'll want some type of spec to understand what is being planned and have a discussion. Specs help collaborators discuss different approaches to solve a problem, describe how the feature will behave, how the feature will impact the user, what happens if something goes wrong, etc. Driving towards agreement in a spec, before any code is written, often results in simpler code, and less wasted effort in the long run. +A key point is for everyone to understand the approach that will be taken. We want to be sure that any work done will be accepted. Larger-scope items will require a spec to outline the approach and allow for discussion. Specs help collaborators consider different solutions, describe feature behavior, and plan for errors. Achieving agreement in a spec before writing code often results in simpler code and less wasted effort. -For such scenarios, once a team member has agreed with your approach, skip ahead to the section headed "Development" section below. - -Team members will be happy to help review specs and guide them to completion. +Once a team member has agreed with your approach, proceed to the "Development" section below. Team members are happy to help review specs and guide them to completion. ### Help Wanted -Once the team has approved an issue/spec approach to solving, development can proceed. If no developers are immediately available, the spec can be parked ready for a developer to get started. Parked specs' issues will be labeled "Help Wanted". To find a list of development opportunities waiting for developer involvement, visit the Issues and filter on [the Help-Wanted label](https://github.com/microsoft/PowerToys/labels/Help%20Wanted). +Once the team has approved an issue/spec approach, development can proceed. If no developers are immediately available, the spec may be parked and labeled "Help Wanted," ready for a developer to get started. For development opportunities, visit [Issues labeled Help Wanted](https://github.com/microsoft/PowerToys/labels/Help%20Wanted). --- @@ -55,18 +55,18 @@ Once the team has approved an issue/spec approach to solving, development can pr Follow the [development guidelines](https://github.com/microsoft/PowerToys/blob/main/doc/devdocs/readme.md). -### Naming of features and functionality +### Naming Features and Functionality -Naming should be descriptive and straight forward. We want names to be clear about functionality and usefulness moving forward. +Names should be descriptive and straightforward, clearly reflecting functionality and usefulness. -### How can I become a collaborator on the PowerToys team +### Becoming a Collaborator on the PowerToys Team -Be a great community member. Just help out a lot and make useful additions, filing bugs/suggestions, help develop fixes and features, code reviews, and always, docs. Lets continue to make the PowerToys repository a great spot to learn and make a great set of utilities. +Be an active community member! Make helpful contributions by filing bugs, offering suggestions, developing fixes and features, conducting code reviews, and updating documentation. -When the time comes, Microsoft will reach out and help make you a formal team member. Just make sure they can reach out to you :) +When the time comes, Microsoft will reach out to you about becoming a formal team member. Just make sure they have a way to contact you. ๐Ÿ˜Š --- -## Thank you +## Thank You -Thank you in advance for your contribution! +Thank you in advance for your contribution! We appreciate your help in making PowerToys a better tool for everyone. diff --git a/DATA_AND_PRIVACY.md b/DATA_AND_PRIVACY.md new file mode 100644 index 0000000000..5570729c20 --- /dev/null +++ b/DATA_AND_PRIVACY.md @@ -0,0 +1,1020 @@ +# PowerToys Data & Privacy +## Overview +PowerToys diagnostic data is completely optional for users and is off by default in v0.86 and beyond. Our team believes in transparency and trust. As PowerToys is open source, all of our diagnostic data events are in the codebase. + +Additionally, this document aims to list each diagnostic data event individually and describe their purpose clearly. + +For more information, please read the [Microsoft privacy statement](https://privacy.microsoft.com/privacystatement). + +## What does PowerToys collect? + +1. **Usage**: Understanding usage and frequency rates for utilities and settings helps us make decisions on where to focus our time and energy. This data also helps us better understand what and how to move well-loved features directly into Windows! +2. **Stability**: Monitoring bugs and system crashes, as well as analyzing GitHub issue reports, assists us in prioritizing the most urgent issues. +3. **Performance**: Assessing the performance of PowerToys features to load and execute gives us an understanding of what surfaces are causing slowdowns. This supports our commitment to providing you with tools that are both speedy and effective. + +### Success Story: Fixing FancyZones Bugs with Your Help +FancyZones had numerous bug reports related to virtual desktop interactions. Initially, these were considered lower priority, since the assumption was that virtual desktops were not widely used, so we chose to focus on more urgent issues. However, the volume of bug reports suggested otherwise, prompting us to add additional diagnostics to see virtual desktop usage with FancyZones. We discovered that virtual desktop usage was much higher among FancyZones users. This new understanding led us to prioritize this class of bugs and get them fixed. + +## Transparency and Public Sharing +As much as possible, we aim to share the results of diagnostic data publicly. + +We hope this document provides clarity on why and how we collect diagnostic data to improve PowerToys for our users. If you have any questions or concerns, please feel free to reach out to us. + +Thank you for using PowerToys! + +## List of Diagnostic Data Events +_**Note:** We're in the process of updating this section with more events and their descriptions. We aim to keep this list current by adding any new diagnostic data events as they become available._ + +_If you want to find diagnostic data events in the source code, these two links will be good starting points based on the source code's langauge._ +- [C# events](https://github.com/search?q=repo%3Amicrosoft/PowerToys%20EventBase&type=code) +- [C++ events](https://github.com/search?q=repo%3Amicrosoft%2FPowerToys+ProjectTelemetryPrivacyDataTag&type=code) + +### General + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.DebugEventLogs debugging information for diagnostics and troubleshooting.
Microsoft.PowerToys.GeneralSettingsChangedLogs changes made to general settings within PowerToys.
Microsoft.PowerToys.Runner_LaunchIndicates when the PowerToys Runner is launched.
Microsoft.PowerToys.SettingsBootEventTriggered when PowerToys settings are initialized at startup.
Microsoft.PowerToys.SettingsEnabledEventIndicates that the PowerToys settings have been enabled.
Microsoft.PowerToys.ScoobeStartedEventTriggered when SCOOBE (Secondary Out-of-box experience) starts.
Microsoft.PowerToys.TrayFlyoutActivatedEventIndicates when the tray flyout menu is activated.
Microsoft.PowerToys.TrayFlyoutModuleRunEventLogs when a utility from the tray flyout menu is run.
Microsoft.PowerToys.Uninstall_SuccessLogs when PowerToys is successfully uninstalled (who would do such a thing!).
+ +### OOBE (Out-of-box experience) + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.OobeSectionEventOccurs when OOBE is shown to the user.
Microsoft.PowerToys.OobeSettingsEventTriggers when a Settings page is opened from an OOBE page.
Microsoft.PowerToys.OobeStartedEventIndicates when the out-of-box experience has been initiated.
+ +### Advanced Paste + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.AdvancedPaste_EnableAdvancedPasteTriggered when Advanced Paste is enabled.
Microsoft.PowerToys.AdvancedPaste_ErrorOccurs when an error is encountered during the Advanced Paste process.
Microsoft.PowerToys.AdvancedPaste_InvokeAdvancedPasteActivated when Advanced Paste is called by the user.
Microsoft.PowerToys.AdvancedPaste_SettingsTriggered when settings for Advanced Paste are accessed or modified.
Microsoft.PowerToys.AdvancedPasteClipboardItemClickedOccurs when a clipboard item is selected from the Advanced Paste menu.
Microsoft.PowerToys.AdvancedPasteClipboardItemDeletedEventTriggered when an item is removed from the Advanced Paste clipboard history.
Microsoft.PowerToys.AdvancedPasteCustomFormatOutputThumbUpDownEventTriggered when a user gives feedback on a custom format output (thumb up/down).
Microsoft.PowerToys.AdvancedPasteFormatClickedEventOccurs when a specific paste format is clicked in the Advanced Paste menu.
Microsoft.PowerToys.AdvancedPasteGenerateCustomErrorEventTriggered when an error occurs while generating a custom paste format.
Microsoft.PowerToys.AdvancedPasteGenerateCustomFormatEventOccurs when a custom paste format is successfully generated.
Microsoft.PowerToys.AdvancedPasteInAppKeyboardShortcutEventTriggered when a keyboard shortcut is used within the Advanced Paste interface.
Microsoft.PowerToys.AdvancedPasteSemanticKernelFormatEventTriggered when Advanced Paste leverages the Semantic Kernel.
+ +### Always on Top + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.AlwaysOnTop_EnableAlwaysOnTopTriggered when Always on Top is enabled.
Microsoft.PowerToys.AlwaysOnTop_PinWindowOccurs when a window is pinned to stay on top of other windows.
Microsoft.PowerToys.AlwaysOnTop_UnpinWindowTriggered when a pinned window is unpinned, allowing it to be behind other windows.
+ +### Awake + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.Awake_EnableAwakeTriggered when Awake is enabled.
Microsoft.PowerToys.AwakeExpirableKeepAwakeEventOccurs when the system is kept awake for a temporary, expirable duration.
Microsoft.PowerToys.AwakeIndefinitelyKeepAwakeEventTriggered when the system is set to stay awake indefinitely.
Microsoft.PowerToys.AwakeNoKeepAwakeEventOccurs when Awake is turned off, allowing the computer to enter sleep mode.
Microsoft.PowerToys.AwakeTimedKeepAwakeEventTriggered when the system is kept awake for a specified time duration.
+ +### Color Picker + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.ColorPicker_EnableColorPickerTriggered when Color Picker is enabled.
Microsoft.PowerToys.ColorPicker_SessionOccurs during a Color Picker usage session.
Microsoft.PowerToys.ColorPicker_SettingsTriggered when the settings for the Color Picker are accessed or modified.
Microsoft.PowerToys.ColorPickerCancelledEventOccurs when a color picking action is cancelled by the user.
Microsoft.PowerToys.ColorPickerShowEventTriggered when the Color Picker UI is displayed on the screen.
+ +### Command Not Found + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.CmdNotFoundInstallEventTriggered when a Command Not Found is installed.
Microsoft.PowerToys.CmdNotFoundInstanceCreatedEventOccurs when an instance of a Command Not Found is created.
Microsoft.PowerToys.CmdNotFoundUninstallEventTriggered when Command Not Found is uninstalled after being previously installed.
+ +### Crop And Lock + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.CropAndLock_ActivateReparentTriggered when the cropping interface is activated for reparenting the cropped content.
Microsoft.PowerToys.CropAndLock_ActivateThumbnailOccurs when the thumbnail view for cropped content is activated.
Microsoft.PowerToys.CropAndLock_EnableCropAndLockTriggered when Crop and Lock is enabled.
Microsoft.PowerToys.CropAndLock_SettingsOccurs when settings related to Crop and Lock are modified.
+ +### Environment Variables + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.EnvironmentVariables_ActivateTriggered when Environment Variables is launched.
Microsoft.PowerToys.EnvironmentVariables_EnableEnvironmentVariablesOccurs when Environment Variables is enabled.
Microsoft.PowerToys.EnvironmentVariablesOpenedEventTriggered when the Environment Variables interface is opened.
Microsoft.PowerToys.EnvironmentVariablesProfileEnabledEventOccurs when an environment variable profile is enabled.
Microsoft.PowerToys.EnvironmentVariablesVariableChangedEventTriggered when an environment variable is added, modified, or deleted.
+ +### FancyZones + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.FancyZones_CycleActiveZoneSetTriggered when the active zone set is cycled through.
Microsoft.PowerToys.FancyZones_EditorLaunchOccurs when the FancyZones editor is launched.
Microsoft.PowerToys.FancyZones_EnableFancyZonesOccurs when FancyZones is enabled.
Microsoft.PowerToys.FancyZones_KeyboardSnapWindowToZoneTriggered when a window is snapped to a zone using the keyboard.
Microsoft.PowerToys.FancyZones_MoveOrResizeEndedOccurs when a window move or resize action has completed.
Microsoft.PowerToys.FancyZones_MoveOrResizeStartedTriggered when a window move or resize action is initiated.
Microsoft.PowerToys.FancyZones_MoveSizeEndOccurs when the moving or resizing of a window has ended.
Microsoft.PowerToys.FancyZones_OnKeyDownTriggered when a key is pressed down while interacting with zones.
Microsoft.PowerToys.FancyZones_QuickLayoutSwitchOccurs when a quick switch between zone layouts is performed.
Microsoft.PowerToys.FancyZones_SettingsTriggered when FancyZones settings are accessed or modified.
Microsoft.PowerToys.FancyZones_SettingsChangedOccurs when there is a change in the FancyZones settings.
Microsoft.PowerToys.FancyZones_SnapNewWindowIntoZoneTriggered when a new window is snapped into a zone.
Microsoft.PowerToys.FancyZones_VirtualDesktopChangedOccurs when the virtual desktop changes, affecting zone layout.
Microsoft.PowerToys.FancyZones_ZoneSettingsChangedTriggered when the settings for specific zones are altered.
Microsoft.PowerToys.FancyZones_ZoneWindowKeyUpOccurs when a key is released while interacting with zones.
+ +### FileExplorerAddOns + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.GcodeFileHandlerLoadedTriggered when a G-code file handler is loaded.
Microsoft.PowerToys.GcodeFilePreviewedOccurs when a G-code file is previewed in File Explorer.
Microsoft.PowerToys.GcodeFilePreviewErrorTriggered when there is an error previewing a G-code file.
Microsoft.PowerToys.MarkdownFileHandlerLoadedOccurs when a Markdown file handler is loaded.
Microsoft.PowerToys.MarkdownFilePreviewedTriggered when a Markdown file is previewed in File Explorer.
Microsoft.PowerToys.PdfFileHandlerLoadedOccurs when a PDF file handler is loaded.
Microsoft.PowerToys.PdfFilePreviewedTriggered when a PDF file is previewed in File Explorer.
Microsoft.PowerToys.PowerPreview_EnabledOccurs when preview is enabled.
Microsoft.PowerToys.PowerPreview_TweakUISettings_DestroyedTriggered when the Tweak UI settings for Power Preview are destroyed.
Microsoft.PowerToys.PowerPreview_TweakUISettings_FailedUpdatingSettingsOccurs when updating Tweak UI settings fails.
Microsoft.PowerToys.PowerPreview_TweakUISettings_InitSet__ErrorLoadingFileTriggered when there is an error loading a file during Tweak UI settings initialization.
Microsoft.PowerToys.PowerPreview_TweakUISettings_SuccessfullyUpdatedSettingsOccurs when the Tweak UI settings for Power Preview are successfully updated.
Microsoft.PowerToys.QoiFilePreviewedTriggered when a QOI file is previewed in File Explorer.
Microsoft.PowerToys.SvgFileHandlerLoadedOccurs when an SVG file handler is loaded.
Microsoft.PowerToys.SvgFilePreviewedTriggered when an SVG file is previewed in File Explorer.
Microsoft.PowerToys.SvgFilePreviewErrorOccurs when there is an error previewing an SVG file.
+ +### File Locksmith + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.FileLocksmith_EnableFileLocksmithTriggered when File Locksmith is enabled.
Microsoft.PowerToys.FileLocksmith_InvokedOccurs when File Locksmith is invoked.
Microsoft.PowerToys.FileLocksmith_InvokedRetTriggered when File Locksmith invocation returns a result.
Microsoft.PowerToys.FileLocksmith_QueryContextMenuErrorOccurs when there is an error querying the context menu for File Locksmith.
+ +### Find My Mouse + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.FindMyMouse_EnableFindMyMouseTriggered when Find My Mouse is enabled.
Microsoft.PowerToys.FindMyMouse_MousePointerFocusedOccurs when the mouse pointer is focused using Find My Mouse.
+ +### Hosts File Editor + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.HostsFileEditor_ActivateTriggered when Hosts File Editor is activated.
Microsoft.PowerToys.HostsFileEditor_EnableHostsFileEditorOccurs when Hosts File Editor is enabled.
Microsoft.PowerToys.HostsFileEditorOpenedEventFires when Hosts File Editor is opened.
+ +### Image Resizer + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.ImageResizer_EnableImageResizerTriggered when Image Resizer is enabled.
Microsoft.PowerToys.ImageResizer_InvokedOccurs when Image Resizer is invoked by the user.
Microsoft.PowerToys.ImageResizer_InvokedRetFires when the Image Resizer operation is completed and returns a result.
+ +### Keyboard Manager + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.KeyboardManager_AppSpecificShortcutRemapConfigurationLoadedIndicates that the application-specific shortcut remap configuration has been successfully loaded.
Microsoft.PowerToys.KeyboardManager_AppSpecificShortcutRemapCountLogs the number of application-specific shortcut remaps configured by the user.
Microsoft.PowerToys.KeyboardManager_AppSpecificShortcutToShortcutRemapInvokedLogs each instance when an application-specific shortcut-to-shortcut remap is used.
Microsoft.PowerToys.KeyboardManager_DailyAppSpecificShortcutToKeyRemapInvokedLogs the daily count of application-specific shortcut-to-key remaps executed by the user.
Microsoft.PowerToys.KeyboardManager_DailyAppSpecificShortcutToShortcutRemapInvokedLogs the daily count of application-specific shortcut-to-shortcut remaps executed by the user.
Microsoft.PowerToys.KeyboardManager_DailyKeyToKeyRemapInvokedLogs the daily count of key-to-key remaps used by the user.
Microsoft.PowerToys.KeyboardManager_DailyKeyToShortcutRemapInvokedLogs the daily count of key-to-shortcut remaps used by the user.
Microsoft.PowerToys.KeyboardManager_DailyShortcutToKeyRemapInvokedLogs the daily count of shortcut-to-key remaps used by the user.
Microsoft.PowerToys.KeyboardManager_DailyShortcutToShortcutRemapInvokedLogs the daily count of shortcut-to-shortcut remaps used by the user.
Microsoft.PowerToys.KeyboardManager_EnableKeyboardManagerIndicates that the Keyboard Manager has been enabled in PowerToys settings.
Microsoft.PowerToys.KeyboardManager_KeyRemapConfigurationLoadedIndicates that the key remap configuration has been successfully loaded.
Microsoft.PowerToys.KeyboardManager_KeyRemapCountLogs the number of individual key remaps configured by the user.
Microsoft.PowerToys.KeyboardManager_KeyToKeyRemapInvokedLogs each instance of a key-to-key remap being used.
Microsoft.PowerToys.KeyboardManager_KeyToShortcutRemapInvokedLogs each instance of a key-to-shortcut remap being used.
Microsoft.PowerToys.KeyboardManager_OSLevelShortcutRemapCountLogs the total number of OS-level shortcut remaps configured by the user.
Microsoft.PowerToys.KeyboardManager_OSLevelShortcutToKeyRemapInvokedLogs each instance of an OS-level shortcut-to-key remap being used.
Microsoft.PowerToys.KeyboardManager_OSLevelShortcutToShortcutRemapInvokedLogs each instance of an OS-level shortcut-to-shortcut remap being used.
Microsoft.PowerToys.KeyboardManager_ShortcutRemapConfigurationLoadedIndicates that the shortcut remap configuration has been successfully loaded.
+ +### Mouse Highlighter + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.MouseHighlighter_EnableMouseHighlighterTriggered when Mouse Highlighter is enabled.
Microsoft.PowerToys.MouseHighlighter_StartHighlightingSessionOccurs when a new highlighting session is started.
+ +### Mouse Jump + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.MouseJump_EnableJumpToolTriggered when Mouse Jump is enabled.
Microsoft.PowerToys.MouseJump_InvokeJumpToolOccurs when Mouse Jump is invoked.
Microsoft.PowerToys.MouseJumpShowEventTriggered when the Mouse Jump display is shown.
Microsoft.PowerToys.MouseJumpTeleportCursorEventOccurs when the cursor is teleported to a new location.
+ +### Mouse Pointer Crosshairs + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.MousePointerCrosshairs_EnableMousePointerCrosshairsTriggered when Mouse Pointer Crosshairs is enabled.
Microsoft.PowerToys.MousePointerCrosshairs_StartDrawingCrosshairsOccurs when the crosshairs are drawn around the mouse pointer.
+ +### Mouse Without Borders + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.MouseWithoutBorders_ActivateTriggered when Mouse Without Borders is activated.
Microsoft.PowerToys.MouseWithoutBorders_AddFirewallRuleOccurs when a firewall rule is added for Mouse Without Borders.
Microsoft.PowerToys.MouseWithoutBorders_EnableMouseWithoutBordersTriggered when Mouse Without Borders is enabled.
Microsoft.PowerToys.MouseWithoutBorders_ToggleServiceRegistrationOccurs when the service registration for Mouse Without Borders is toggled.
Microsoft.PowerToys.MouseWithoutBordersClipboardFileTransferEventTriggered during a clipboard file transfer between computers.
Microsoft.PowerToys.MouseWithoutBordersDragAndDropEventOccurs during a drag-and-drop operation between computers.
Microsoft.PowerToys.MouseWithoutBordersMultipleModeEventTriggered when multiple modes are enabled in Mouse Without Borders.
Microsoft.PowerToys.MouseWithoutBordersOldUIOpenedEventOccurs when the old user interface for Mouse Without Borders is opened.
Microsoft.PowerToys.MouseWithoutBordersOldUIQuitEventTriggered when the old user interface for Mouse Without Borders is closed.
Microsoft.PowerToys.MouseWithoutBordersOldUIReconfigureEventOccurs when the old user interface for Mouse Without Borders is reconfigured.
Microsoft.PowerToys.MouseWithoutBordersStartedEventTriggered when Mouse Without Borders is started.
+ +### New+ + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.NewPlus_EventCopyTemplateTriggered when an item from New+ is created (copied to the current directory).
Microsoft.PowerToys.NewPlus_EventCopyTemplateResultLogs the success of item creation (copying).
Microsoft.PowerToys.NewPlus_EventShowTemplateItemsTriggered when the New+ context menu flyout is displayed.
Microsoft.PowerToys.NewPlus_EventToggleOnOffTriggered when New+ is enabled or disabled.
+ +### Peek + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.Peek_ClosedTriggered when Peek is closed.
Microsoft.PowerToys.Peek_EnablePeekOccurs when Peek is enabled.
Microsoft.PowerToys.Peek_ErrorTriggered when an error occurs for Peek.
Microsoft.PowerToys.Peek_InvokePeekOccurs when Peek is invoked.
Microsoft.PowerToys.Peek_OpenedTriggered when a Peek window is opened.
Microsoft.PowerToys.Peek_OpenWithOccurs when an item is opened with Peek.
Microsoft.PowerToys.Peek_SettingsTriggered when the settings for Peek are modified.
+ +### PowerRename + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.PowerRename_EnablePowerRenameTriggered when PowerRename is enabled.
Microsoft.PowerToys.PowerRename_InvokedOccurs when PowerRename is invoked.
Microsoft.PowerToys.PowerRename_InvokedRetTriggered when the invocation of PowerRename returns a result.
Microsoft.PowerToys.PowerRename_RenameOperationTriggered during the rename operation within PowerRename.
Microsoft.PowerToys.PowerRename_SettingsChangedOccurs when the settings for PowerRename are changed.
Microsoft.PowerToys.PowerRename_UIShownRetTriggered when the PowerRename user interface is shown.
+ +### PowerToys Run + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.LauncherBootEventTriggered when PowerToys Run is initialized on boot.
Microsoft.PowerToys.LauncherColdStateHotkeyEventOccurs when the hotkey is pressed in the cold state (not yet initialized).
Microsoft.PowerToys.LauncherFirstDeleteEventTriggered when the first deletion action is performed in PowerToys Run.
Microsoft.PowerToys.LauncherHideEventOccurs when PowerToys Run is hidden.
Microsoft.PowerToys.LauncherQueryEventTriggered when a query is made in PowerToys Run.
Microsoft.PowerToys.LauncherResultActionEventOccurs when an action is taken on a result in PowerToys Run.
Microsoft.PowerToys.LauncherShowEventTriggered when PowerToys Run is shown.
Microsoft.PowerToys.LauncherWarmStateHotkeyEventOccurs when the hotkey is pressed in the warm state (initialized).
Microsoft.PowerToys.RunPluginsSettingsEventTriggered when the settings for PowerToys Run plugins are accessed or modified.
Microsoft.PowerToys.WindowWalker_EnableWindowWalkerTriggered when the Window Walker plugin is enabled.
+ +### Quick Accent + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.PowerAccent_EnablePowerAccentTriggered when Quick Accent is enabled.
Microsoft.PowerToys.PowerAccentShowAccentMenuEventOccurs when the accent menu is displayed.
+ +### Registry Preview + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.RegistryPreview_ActivateTriggered when Registry Preview is activated.
Microsoft.PowerToys.RegistryPreview_EnableRegistryPreviewOccurs when Registry Preview is enabled.
+ +### Screen Ruler + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.MeasureTool_BoundsToolActivatedTriggered when Screen Ruler's Bounds tool is activated.
Microsoft.PowerToys.MeasureTool_EnableMeasureToolOccurs when Screen Ruler is enabled.
Microsoft.PowerToys.MeasureTool_MeasureToolActivatedTriggered when Screen Ruler's Measure tool is activated.
+ +### Shortcut Guide + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.ShortcutGuide_EnableGuideTriggered when Shortcut Guide is enabled.
Microsoft.PowerToys.ShortcutGuide_HideGuideOccurs when Shortcut Guide is hidden from view.
Microsoft.PowerToys.ShortcutGuide_SettingsIndicates a change in the settings related to the Shortcut Guide.
+ +### Text Extractor + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.PowerOCR_EnablePowerOCRTriggered when the Text Extractor (OCR) feature is enabled.
Microsoft.PowerToys.PowerOCRCancelledEventOccurs when the text extraction process is cancelled.
Microsoft.PowerToys.PowerOCRCaptureEventOccurs when the user has created a capture for text extraction.
Microsoft.PowerToys.PowerOCRInvokedEventTriggered when Text Extractor is invoked.
+ +### Video Conference Mute + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.VideoConference_CameraMutedTriggered when the camera is turned off by Video Conference Mute.
Microsoft.PowerToys.VideoConference_EnableVideoConferenceOccurs when Video Conference Mute is enabled.
Microsoft.PowerToys.VideoConference_MicrophoneMutedOccurs when the microphone is muted by Video Conference Mute.
+ +### Workspaces + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Event NameDescription
Microsoft.PowerToys.Projects_CLIUsageLogs usage of command-line arguments for launching apps.
Microsoft.PowerToys.Workspaces_CreateEventTriggered when a new workspace is created.
Microsoft.PowerToys.Workspaces_DeleteEventTriggered when a workspace is deleted.
Microsoft.PowerToys.Workspaces_EditEventTriggered when a workspace is edited or modified.
Microsoft.PowerToys.Workspaces_EnableIndicates that Workspaces is enabled.
Microsoft.PowerToys.Workspaces_LaunchEventTriggered when a workspace is launched.
Microsoft.PowerToys.Workspaces_SettingsLogs changes to workspaces settings.
+ + diff --git a/Directory.Packages.props b/Directory.Packages.props index 9ec1d03bd9..1af9962224 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -6,14 +6,14 @@ - - - - - - - - + + + + + + + + @@ -24,27 +24,30 @@ - - - - - - - + + + + + + + + + + - - + + - + - + @@ -57,36 +60,34 @@ - + - + - - - + + + - - - - - - - + + + + + + + - - - - - - + + + + - + diff --git a/NOTICE.md b/NOTICE.md index ca957e45ec..9573caebb6 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -1299,14 +1299,14 @@ EXHIBIT A -Mozilla Public License. - Appium.WebDriver 4.4.5 - Azure.AI.OpenAI 1.0.0-beta.12 - CommunityToolkit.Mvvm 8.2.2 -- CommunityToolkit.WinUI.Animations 8.1.240821 -- CommunityToolkit.WinUI.Collections 8.1.240821 -- CommunityToolkit.WinUI.Controls.Primitives 8.1.240821 -- CommunityToolkit.WinUI.Controls.Segmented 8.1.240821 -- CommunityToolkit.WinUI.Controls.SettingsControls 8.1.240821 -- CommunityToolkit.WinUI.Controls.Sizers 8.1.240821 -- CommunityToolkit.WinUI.Converters 8.1.240821 -- CommunityToolkit.WinUI.Extensions 8.1.240821 +- CommunityToolkit.WinUI.Animations 8.0.240109 +- CommunityToolkit.WinUI.Collections 8.0.240109 +- CommunityToolkit.WinUI.Controls.Primitives 8.0.240109 +- CommunityToolkit.WinUI.Controls.Segmented 8.0.240109 +- CommunityToolkit.WinUI.Controls.SettingsControls 8.0.240109 +- CommunityToolkit.WinUI.Controls.Sizers 8.0.240109 +- CommunityToolkit.WinUI.Converters 8.0.240109 +- CommunityToolkit.WinUI.Extensions 8.0.240109 - CommunityToolkit.WinUI.UI.Controls.DataGrid 7.1.2 - CommunityToolkit.WinUI.UI.Controls.Markdown 7.1.2 - ControlzEx 6.0.0 @@ -1317,21 +1317,23 @@ EXHIBIT A -Mozilla Public License. - LazyCache 2.4.0 - Mages 2.0.2 - Markdig.Signed 0.34.0 -- Microsoft.CodeAnalysis.NetAnalyzers 8.0.0 -- Microsoft.Data.Sqlite 8.0.7 -- Microsoft.Extensions.DependencyInjection 8.0.0 -- Microsoft.Extensions.Hosting 8.0.0 -- Microsoft.Extensions.Hosting.WindowsServices 8.0.0 -- Microsoft.Extensions.Logging 8.0.0 -- Microsoft.Extensions.Logging.Abstractions 8.0.0 +- MessagePack 2.5.187 +- Microsoft.CodeAnalysis.NetAnalyzers 9.0.0-preview.24508.2 +- Microsoft.Data.Sqlite 9.0.0 +- Microsoft.Diagnostics.Tracing.TraceEvent 3.1.16 +- Microsoft.Extensions.DependencyInjection 9.0.0 +- Microsoft.Extensions.Hosting 9.0.0 +- Microsoft.Extensions.Hosting.WindowsServices 9.0.0 +- Microsoft.Extensions.Logging 9.0.0 +- Microsoft.Extensions.Logging.Abstractions 9.0.0 - Microsoft.Toolkit.Uwp.Notifications 7.1.2 - Microsoft.Web.WebView2 1.0.2739.15 -- Microsoft.Win32.SystemEvents 8.0.0 -- Microsoft.Windows.Compatibility 8.0.7 +- Microsoft.Win32.SystemEvents 9.0.0 +- Microsoft.Windows.Compatibility 9.0.0 - Microsoft.Windows.CsWin32 0.2.46-beta -- Microsoft.Windows.CsWinRT 2.1.1 +- Microsoft.Windows.CsWinRT 2.1.5 - Microsoft.Windows.SDK.BuildTools 10.0.22621.2428 -- Microsoft.WindowsAppSDK 1.6.240829007 +- Microsoft.WindowsAppSDK 1.6.241114003 - Microsoft.Xaml.Behaviors.WinUI.Managed 2.0.9 - Microsoft.Xaml.Behaviors.Wpf 1.1.39 - ModernWpfUI 0.9.4 @@ -1342,28 +1344,27 @@ EXHIBIT A -Mozilla Public License. - ReverseMarkdown 4.1.0 - ScipBe.Common.Office.OneNote 3.0.1 - SharpCompress 0.37.2 -- StreamJsonRpc 2.14.24 +- StreamJsonRpc 2.19.27 - StyleCop.Analyzers 1.2.0-beta.556 -- System.CodeDom 8.0.0 +- System.CodeDom 9.0.0 - System.CommandLine 2.0.0-beta4.22272.1 -- System.ComponentModel.Composition 8.0.0 -- System.Configuration.ConfigurationManager 8.0.0 -- System.Data.OleDb 8.0.0 +- System.ComponentModel.Composition 9.0.0 +- System.Configuration.ConfigurationManager 9.0.0 +- System.Data.OleDb 9.0.0 - System.Data.SqlClient 4.8.6 -- System.Diagnostics.EventLog 8.0.0 -- System.Diagnostics.PerformanceCounter 8.0.0 -- System.Drawing.Common 8.0.6 -- System.IO.Abstractions 17.2.3 -- System.IO.Abstractions.TestingHelpers 17.2.3 -- System.Management 8.0.0 +- System.Diagnostics.EventLog 9.0.0 +- System.Diagnostics.PerformanceCounter 9.0.0 +- System.Drawing.Common 9.0.0 +- System.IO.Abstractions 21.0.29 +- System.IO.Abstractions.TestingHelpers 21.0.29 +- System.Management 9.0.0 - System.Reactive 6.0.1 -- System.Runtime.Caching 8.0.0 -- System.Security.Cryptography.ProtectedData 8.0.0 -- System.ServiceProcess.ServiceController 8.0.0 -- System.Text.Encoding.CodePages 8.0.0 -- System.Text.Json 8.0.4 +- System.Runtime.Caching 9.0.0 +- System.ServiceProcess.ServiceController 9.0.0 +- System.Text.Encoding.CodePages 9.0.0 +- System.Text.Json 9.0.0 - UnicodeInformation 2.6.0 - UnitsNet 5.56.0 - UTF.Unknown 2.5.1 - WinUIEx 2.2.0 -- WPF-UI 3.0.0 +- WPF-UI 3.0.5 diff --git a/PowerToys.sln b/PowerToys.sln index e91c2e3907..28dc1853ff 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -171,12 +171,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject src\.editorconfig = src\.editorconfig .vsconfig = .vsconfig + src\Common.Dotnet.AotCompatibility.props = src\Common.Dotnet.AotCompatibility.props src\Common.Dotnet.CsWinRT.props = src\Common.Dotnet.CsWinRT.props src\Common.SelfContained.props = src\Common.SelfContained.props Cpp.Build.props = Cpp.Build.props Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets Directory.Packages.props = Directory.Packages.props + src\Monaco.props = src\Monaco.props Solution.props = Solution.props src\Version.props = src\Version.props EndProjectSection @@ -297,6 +299,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Telemetry", "Telemetry", "{ ProjectSection(SolutionItems) = preProject src\common\Telemetry\ProjectTelemetry.h = src\common\Telemetry\ProjectTelemetry.h src\common\Telemetry\TelemetryBase.cs = src\common\Telemetry\TelemetryBase.cs + src\common\Telemetry\TraceBase.h = src\common\Telemetry\TraceBase.h src\common\Telemetry\TraceLoggingDefines.h = src\common\Telemetry\TraceLoggingDefines.h EndProjectSection EndProject @@ -504,9 +507,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseWithoutBordersHelper", EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MouseJump", "src\modules\MouseUtils\MouseJump\MouseJump.vcxproj", "{8A08D663-4995-40E3-B42C-3F910625F284}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseJumpUI", "src\modules\MouseUtils\MouseJumpUI\MouseJumpUI.csproj", "{D962A009-834F-4EEC-AABB-430DF8F98E39}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseJump.Common", "src\modules\MouseUtils\MouseJump.Common\MouseJump.Common.csproj", "{923DF87C-CA99-4D1C-B1D2-959174E95BFA}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseJumpUI.UnitTests", "src\modules\MouseUtils\MouseJumpUI.UnitTests\MouseJumpUI.UnitTests.csproj", "{D9C5DE64-6849-4278-91AD-9660AECF2876}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseJump.Common.UnitTests", "src\modules\MouseUtils\MouseJump.Common.UnitTests\MouseJump.Common.UnitTests.csproj", "{D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseJumpUI", "src\modules\MouseUtils\MouseJumpUI\MouseJumpUI.csproj", "{D962A009-834F-4EEC-AABB-430DF8F98E39}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AdvancedPaste", "AdvancedPaste", "{9873BA05-4C41-4819-9283-CF45D795431B}" EndProject @@ -622,6 +627,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesLauncher", "src\m EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WorkspacesWindowArranger", "src\modules\Workspaces\WorkspacesWindowArranger\WorkspacesWindowArranger.vcxproj", "{37D07516-4185-43A4-924F-3C7A5D95ECF6}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EtwTrace", "src\common\Telemetry\EtwTrace\EtwTrace.vcxproj", "{8F021B46-362B-485C-BFBA-CCF83E820CBD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MouseWithoutBorders.UnitTests", "src\modules\MouseWithoutBorders\MouseWithoutBorders.UnitTests\MouseWithoutBorders.UnitTests.csproj", "{66614C26-314C-4B91-9071-76133422CFEF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkspacesCsharpLibrary", "src\modules\Workspaces\WorkspacesCsharpLibrary\WorkspacesCsharpLibrary.csproj", "{89D0E199-B17A-418C-B2F8-7375B6708357}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NewPlus.ShellExtension.win10", "src\modules\NewPlus\NewShellExtensionContextMenu.win10\NewPlus.ShellExtension.win10.vcxproj", "{0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -2238,6 +2251,30 @@ Global {8A08D663-4995-40E3-B42C-3F910625F284}.Release|x64.Build.0 = Release|x64 {8A08D663-4995-40E3-B42C-3F910625F284}.Release|x86.ActiveCfg = Release|x64 {8A08D663-4995-40E3-B42C-3F910625F284}.Release|x86.Build.0 = Release|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Debug|ARM64.Build.0 = Debug|ARM64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Debug|x64.ActiveCfg = Debug|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Debug|x64.Build.0 = Debug|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Debug|x86.ActiveCfg = Debug|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Debug|x86.Build.0 = Debug|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Release|ARM64.ActiveCfg = Release|ARM64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Release|ARM64.Build.0 = Release|ARM64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Release|x64.ActiveCfg = Release|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Release|x64.Build.0 = Release|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Release|x86.ActiveCfg = Release|x64 + {923DF87C-CA99-4D1C-B1D2-959174E95BFA}.Release|x86.Build.0 = Release|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Debug|ARM64.Build.0 = Debug|ARM64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Debug|x64.ActiveCfg = Debug|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Debug|x64.Build.0 = Debug|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Debug|x86.ActiveCfg = Debug|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Debug|x86.Build.0 = Debug|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Release|ARM64.ActiveCfg = Release|ARM64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Release|ARM64.Build.0 = Release|ARM64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Release|x64.ActiveCfg = Release|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Release|x64.Build.0 = Release|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Release|x86.ActiveCfg = Release|x64 + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77}.Release|x86.Build.0 = Release|x64 {D962A009-834F-4EEC-AABB-430DF8F98E39}.Debug|ARM64.ActiveCfg = Debug|ARM64 {D962A009-834F-4EEC-AABB-430DF8F98E39}.Debug|ARM64.Build.0 = Debug|ARM64 {D962A009-834F-4EEC-AABB-430DF8F98E39}.Debug|x64.ActiveCfg = Debug|x64 @@ -2250,18 +2287,6 @@ Global {D962A009-834F-4EEC-AABB-430DF8F98E39}.Release|x64.Build.0 = Release|x64 {D962A009-834F-4EEC-AABB-430DF8F98E39}.Release|x86.ActiveCfg = Release|x64 {D962A009-834F-4EEC-AABB-430DF8F98E39}.Release|x86.Build.0 = Release|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Debug|ARM64.Build.0 = Debug|ARM64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Debug|x64.ActiveCfg = Debug|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Debug|x64.Build.0 = Debug|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Debug|x86.ActiveCfg = Debug|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Debug|x86.Build.0 = Debug|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Release|ARM64.ActiveCfg = Release|ARM64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Release|ARM64.Build.0 = Release|ARM64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Release|x64.ActiveCfg = Release|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Release|x64.Build.0 = Release|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Release|x86.ActiveCfg = Release|x64 - {D9C5DE64-6849-4278-91AD-9660AECF2876}.Release|x86.Build.0 = Release|x64 {FC373B24-3293-453C-AAF5-CF2909DCEE6A}.Debug|ARM64.ActiveCfg = Debug|ARM64 {FC373B24-3293-453C-AAF5-CF2909DCEE6A}.Debug|ARM64.Build.0 = Debug|ARM64 {FC373B24-3293-453C-AAF5-CF2909DCEE6A}.Debug|x64.ActiveCfg = Debug|x64 @@ -2734,6 +2759,54 @@ Global {37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x64.Build.0 = Release|x64 {37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x86.ActiveCfg = Release|x64 {37D07516-4185-43A4-924F-3C7A5D95ECF6}.Release|x86.Build.0 = Release|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|ARM64.Build.0 = Debug|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x64.ActiveCfg = Debug|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x64.Build.0 = Debug|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x86.ActiveCfg = Debug|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x86.Build.0 = Debug|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.ActiveCfg = Release|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.Build.0 = Release|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.ActiveCfg = Release|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.Build.0 = Release|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x86.ActiveCfg = Release|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x86.Build.0 = Release|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {66614C26-314C-4B91-9071-76133422CFEF}.Debug|ARM64.Build.0 = Debug|ARM64 + {66614C26-314C-4B91-9071-76133422CFEF}.Debug|x64.ActiveCfg = Debug|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Debug|x64.Build.0 = Debug|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Debug|x86.ActiveCfg = Debug|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Debug|x86.Build.0 = Debug|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Release|ARM64.ActiveCfg = Release|ARM64 + {66614C26-314C-4B91-9071-76133422CFEF}.Release|ARM64.Build.0 = Release|ARM64 + {66614C26-314C-4B91-9071-76133422CFEF}.Release|x64.ActiveCfg = Release|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Release|x64.Build.0 = Release|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Release|x86.ActiveCfg = Release|x64 + {66614C26-314C-4B91-9071-76133422CFEF}.Release|x86.Build.0 = Release|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Debug|ARM64.Build.0 = Debug|ARM64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Debug|x64.ActiveCfg = Debug|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Debug|x64.Build.0 = Debug|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Debug|x86.ActiveCfg = Debug|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Debug|x86.Build.0 = Debug|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Release|ARM64.ActiveCfg = Release|ARM64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Release|ARM64.Build.0 = Release|ARM64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Release|x64.ActiveCfg = Release|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Release|x64.Build.0 = Release|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Release|x86.ActiveCfg = Release|x64 + {89D0E199-B17A-418C-B2F8-7375B6708357}.Release|x86.Build.0 = Release|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Debug|ARM64.Build.0 = Debug|ARM64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Debug|x64.ActiveCfg = Debug|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Debug|x64.Build.0 = Debug|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Debug|x86.ActiveCfg = Debug|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Debug|x86.Build.0 = Debug|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|ARM64.ActiveCfg = Release|ARM64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|ARM64.Build.0 = Release|ARM64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x64.ActiveCfg = Release|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x64.Build.0 = Release|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x86.ActiveCfg = Release|x64 + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E}.Release|x86.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2912,8 +2985,9 @@ Global {B5EB9FE9-37EF-47C3-B8B8-81AD3C2972C2} = {B6C42F16-73EB-477E-8B0D-4E6CF6C20AAC} {A663E672-B26D-4EC0-BEAB-FE2E424AC46F} = {B6C42F16-73EB-477E-8B0D-4E6CF6C20AAC} {8A08D663-4995-40E3-B42C-3F910625F284} = {322566EF-20DC-43A6-B9F8-616AF942579A} + {923DF87C-CA99-4D1C-B1D2-959174E95BFA} = {322566EF-20DC-43A6-B9F8-616AF942579A} + {D5E42C63-57C5-4EF6-AECE-1E2FCA725B77} = {322566EF-20DC-43A6-B9F8-616AF942579A} {D962A009-834F-4EEC-AABB-430DF8F98E39} = {322566EF-20DC-43A6-B9F8-616AF942579A} - {D9C5DE64-6849-4278-91AD-9660AECF2876} = {322566EF-20DC-43A6-B9F8-616AF942579A} {9873BA05-4C41-4819-9283-CF45D795431B} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} {FC373B24-3293-453C-AAF5-CF2909DCEE6A} = {9873BA05-4C41-4819-9283-CF45D795431B} {9CE59ED5-7087-4353-88EB-788038A73CEC} = {1AFB6476-670D-4E80-A464-657E01DFF482} @@ -2962,6 +3036,10 @@ Global {367D7543-7DBA-4381-99F1-BF6142A996C4} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF} {2CAC093E-5FCF-4102-9C2C-AC7DD5D9EB96} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF} {37D07516-4185-43A4-924F-3C7A5D95ECF6} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF} + {8F021B46-362B-485C-BFBA-CCF83E820CBD} = {8F62026A-294B-41C6-8839-87463613F216} + {66614C26-314C-4B91-9071-76133422CFEF} = {B6C42F16-73EB-477E-8B0D-4E6CF6C20AAC} + {89D0E199-B17A-418C-B2F8-7375B6708357} = {A2221D7E-55E7-4BEA-90D1-4F162D670BBF} + {0DB0F63A-D2F8-4DA3-A650-2D0B8724218E} = {CA716AE6-FE5C-40AC-BB8F-2C87912687AC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} diff --git a/README.md b/README.md index 7bdc0becf0..3369b8386a 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,9 @@ # Microsoft PowerToys -![Hero image for Microsoft PowerToys](doc/images/overview/PT_hero_image.png) +![Hero image for Microsoft PowerToys](doc/images/overview/PT_holiday_hero_image.png) [How to use PowerToys][usingPowerToys-docs-link] | [Downloads & Release notes][github-release-link] | [Contributing to PowerToys](#contributing) | [What's Happening](#whats-happening) | [Roadmap](#powertoys-roadmap) -## Build status - -| Architecture | Solution (Main) | Solution (Stable) | Installer (Main) | -|--------------|-----------------|-------------------|------------------| -| x64 | [![Build Status for Main](https://dev.azure.com/shine-oss/PowerToys/_apis/build/status%2FPowerToys%20CI?branchName=main&jobName=Build%20x64%20Release)](https://dev.azure.com/shine-oss/PowerToys/_build/latest?definitionId=3&branchName=main) | [![Build Status for Stable](https://dev.azure.com/shine-oss/PowerToys/_apis/build/status%2FPowerToys%20CI?branchName=stable&jobName=Build%20x64%20Release)](https://dev.azure.com/shine-oss/PowerToys/_build/latest?definitionId=3&branchName=stable) | [![Build Status Installer pipeline](https://dev.azure.com/microsoft/Dart/_apis/build/status/PowerToys/PowerToys%20Signed%20YAML%20Release%20Build?branchName=main&jobName=Build&configuration=Build%20Release_x64)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) | -| ARM64 | [![Build Status for Main](https://dev.azure.com/shine-oss/PowerToys/_apis/build/status%2FPowerToys%20CI?branchName=main&jobName=Build%20arm64%20Release)](https://dev.azure.com/shine-oss/PowerToys/_build/latest?definitionId=3&branchName=main) | [![Build Status for Stable](https://dev.azure.com/shine-oss/PowerToys/_apis/build/status%2FPowerToys%20CI?branchName=main&jobName=Build%20arm64%20Release)](https://dev.azure.com/shine-oss/PowerToys/_build/latest?definitionId=3&branchName=main) | [![Build Status Installer pipeline](https://dev.azure.com/microsoft/Dart/_apis/build/status/PowerToys/PowerToys%20Signed%20YAML%20Release%20Build?branchName=main&jobName=Build&configuration=Build%20Release_arm64)](https://dev.azure.com/microsoft/Dart/_build/latest?definitionId=76541&branchName=main) | - ## About Microsoft PowerToys is a set of utilities for power users to tune and streamline their Windows experience for greater productivity. For more info on [PowerToys overviews and how to use the utilities][usingPowerToys-docs-link], or any other tools and resources for [Windows development environments](https://learn.microsoft.com/windows/dev-environment/overview), head over to [learn.microsoft.com][usingPowerToys-docs-link]! @@ -22,10 +15,16 @@ 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) | -| [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) | +| [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) | + +## ๐ŸŽโญ PowerToys Advent calendar โญ๐ŸŽ + +We will be highlighting a cool utility each day for 24 days in December! To follow along, check out these threads: +- https://bsky.app/profile/kaylacinnamon.bsky.social/post/3lcb7iljxck2o +- https://x.com/cinnamon_msft/status/1863284610773246257 ## Installing and running Microsoft PowerToys @@ -41,19 +40,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. -[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 - +[github-next-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.87%22 +[github-current-release-work]: https://github.com/microsoft/PowerToys/issues?q=is%3Aissue+milestone%3A%22PowerToys+0.86%22 +[ptUserX64]: https://github.com/microsoft/PowerToys/releases/download/v0.86.0/PowerToysUserSetup-0.86.0-x64.exe +[ptUserArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.86.0/PowerToysUserSetup-0.86.0-arm64.exe +[ptMachineX64]: https://github.com/microsoft/PowerToys/releases/download/v0.86.0/PowerToysSetup-0.86.0-x64.exe +[ptMachineArm64]: https://github.com/microsoft/PowerToys/releases/download/v0.86.0/PowerToysSetup-0.86.0-arm64.exe + | Description | Filename | sha256 hash | |----------------|----------|-------------| -| 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 | +| Per user - x64 | [PowerToysUserSetup-0.86.0-x64.exe][ptUserX64] | CFB9608B28B8FF12C9A7C9814A6EF981636EB5AB261DC278C28EC93FD959CCE2 | +| Per user - ARM64 | [PowerToysUserSetup-0.86.0-arm64.exe][ptUserArm64] | 861CEDBFDCDA993D1D1056E3280319D5EA45D142CA3C737AB1FB4FABD651A5F5 | +| Machine wide - x64 | [PowerToysSetup-0.86.0-x64.exe][ptMachineX64] | 857DE9DC5938D9602F82DFD6183DB5E6823B875A412AEC59B4BE93617E27E9CD | +| Machine wide - ARM64 | [PowerToysSetup-0.86.0-arm64.exe][ptMachineArm64] | 6F37192534C195A02A80AAE1E449DF61C894C50763096A06195581801943FA31 | This is our preferred method. @@ -99,99 +98,107 @@ 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.84 - August 2024 Update +### 0.86 - October 2024 Update -In this release, we focused on adding a new utility (PowerToys Workspaces), Advanced paste custom actions feature, stability, and improvements. +In this release, we focused on new features, stability, and improvements. **Highlights** - - - 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. + + - Advanced Paste has new abilities: Image to text, and paste to file (text / png / html). + - In settings, we've adjusted the left navigation to group the utilities. As the number of utilities shipped with PowerToys keeps growing, we felt this was a needed adjustment. Thanks everyone for your feedback! + - Workspaces received many bug fixes, including the proper launching of many instances of the same application in the same workspace. Note, we are still actively looking at how to properly handle PWA detection. + - We've added a diagnostic data (telemetry) opt-in option in the Settings General tab. As it is off-by-default, we encourage users to turn it on as that helps direct our development efforts and their journeys. More information about the data we collect can be found in the [PowerToys Data and Privacy documentation](https://aka.ms/powertoys-data-and-privacy-documentation) and what each event does. ### General - - Added DSC support for ImageResizer resize sizes property. - + - Added a setting for diagnostic data (telemetry) opt-in (off by default, however, see above for why we encourage you to opt-in!) and user controls to view data. + - Improved exception logging by adding the type of Exception and InnerException. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + ### Advanced Paste - - 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. + - Added new built-in actions: Image to text, and paste txt, png or html as a file. -### Awake +### Mouse Jump - - 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)! + - Refactored the common classes into a separate project. Thanks [@mikeclayton](https://github.com/mikeclayton)! + - Brought back the telemetry events that were deleted across previous refactoring efforts. -### Hosts File Editor +### Mouse Without Borders - - Fixed save failure when the hosts file is hidden. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Refactored the Logger common classes. Thanks [@mikeclayton](https://github.com/mikeclayton)! -### File Explorer add-ons +### New+ - - Fixed multiple preview form positioning issues causing floating, detached windows, CoreWebView2 related exception and process leak. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - -### Keyboard Manager - - - 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. + - Fixed the telemetry event for when the modules is enabled or disabled. (This was a hotfix for 0.85) + - Fixed bug when creating folders or files that contain Unicode characters. Thanks [@cgaarden](https://github.com/cgaarden)! + - Fixed bug when the name of a new folder collided with an already existing folder. Thanks [@cgaarden](https://github.com/cgaarden)! + - Updated the New+ icons to the fluent style. ### Peek - - Added long paths support. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! - -### Quick Accent - - - 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)! + - Folder preview enumeration of size and number of files is now more responsive and faster. Thanks [@daverayment](https://github.com/daverayment)! ### 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. + - Handled a culture not found error when checking for right-to-left languages. + - Fixed the WebSearch plugin results title being trimmed in the UI. Thanks [@octastylos-pseudodipteros](https://github.com/octastylos-pseudodipteros)! + - The Unit Converter plugin will now show more significant digits. Thanks [@PesBandi](https://github.com/PesBandi)! + - Improved error handling when copying to the clipboard results in an error. Thanks [@PesBandi](https://github.com/PesBandi)! -### Screen Ruler +### Quick Accent - - Added multiple measurements support for all measuring tools. + - Added support for the Serbian Cyrillic character set. Thanks [@Sirozha1337](https://github.com/Sirozha1337)! + +### Registry Preview + + - Adopted the Monaco Editor as the UI text editor. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Settings - - Improved disabled animations InfoBar in Find My Mouse page. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Fixed a crash when trying to access a non-existing templates folder from the New+ page. (This was a hotfix for 0.85) + - Added a navigation tree to group utilities in the left navigation menu. + - Sorted the list of languages in the language selection combo box in the General tab. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! + - Fixed the state of the info bar about templates not being backed up to not close and react to the module's enabled state in the New+ page. Thanks [@htcfreek](https://github.com/htcfreek)! + - Fixed a crash caused by a dangling thread. + - Clicking a notification about there being an update available should now correctly open the Settings application in the General tab. + - Fixed a UI freeze when trying to access the Diagnostic Data Viewer files. Thanks [@davidegiacometti](https://github.com/davidegiacometti)! ### Workspaces - - 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. + - Fixed launching the incorrect workspace when launching many workspaces quickly through shortcuts. (This was a hotfix for 0.85) + - Fixed launching many instances of the same application in a workspace. + - Fixed a crash when a previously captured monitor ID no longer existed. + - Fixed an issue causing the wrong coordinates to be saved for minimized applications. + - Fixed an issue causing a crash when stress testing workspace launching. + - Fixed application launching when UAC is off and every application always runs elevated. ### Documentation - - Added ChatGPTPowerToys plugin mention to thirdPartyRunPlugins.md. Thanks [@ferraridavide](https://github.com/ferraridavide)! + - Added HackMD plugin mention to thirdPartyRunPlugins.md. Thanks [@8LWXpg](https://github.com/8LWXpg)! + - Added SSH plugin mention to thirdPartyRunPlugins.md. Thanks [@8LWXpg](https://github.com/8LWXpg)! + - Added the [Data and Privacy documentation](https://github.com/microsoft/PowerToys/blob/main/DATA_AND_PRIVACY.md) to the repo. ### Development - - 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. + - Fixed the CI precheck action to take into account the recent changes in CI actions. + - Added the new Microsoft org issue types to the issue templates. Thanks [@Aaron-Junker](https://github.com/Aaron-Junker)! + - Updated System.Text.Json to 8.0.5 and System.Runtime.Caching to 8.0.1 and related dependencies to the latest to address security reports. Thanks [@snickler](https://github.com/snickler)! + - Updated WinAppSDK to 1.6.1 and CsWinRT to 2.1.5. Thanks [@snickler](https://github.com/snickler)! + - Upgraded the WpfUI dependency to 3.0.5. + - Updated MessagePack to 2.5.187 and StreamJsonRpc to 2.19.27 to address security reports. + - Removed some of the hacks that are no longer needed that tried to force same dependency versions in .csproj files. + - Removed the Markdown file exclusions from the conditions that trigger a full CI test. + - CI fails again when there are XAML style errors in a PR. + - Fixed CI actions that were not failing when one of the powershell scripts they tried to run was failing. + - Fixed analyzer violations to allow fully building PowerToys on Visual Studio 17.12. Thanks [@snickler](https://github.com/snickler)! -#### What is being planned for version 0.84 +#### What is being planned for version 0.87 -For [v0.85][github-next-release-work], we'll work on the items below: +For [v0.87][github-next-release-work], we'll work on the items below: - Stability / bug fixes - - Language selection - New module: File Actions Menu - - New module: New+ + - Integrate Sysinternals ZoomIt ## PowerToys Community @@ -203,7 +210,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][oss-conduct ## Privacy Statement -The application logs basic telemetry. Our Telemetry Data page (Coming Soon) has the trends from the telemetry. Please read the [Microsoft privacy statement][privacy-link] for more information. +The application logs basic diagnostic data (telemetry). For more information on privacy and what we collect, see our [PowerToys Data and Privacy documentation](https://aka.ms/powertoys-data-and-privacy-documentation). [oss-CLA]: https://cla.opensource.microsoft.com [oss-conduct-code]: CODE_OF_CONDUCT.md diff --git a/doc/devdocs/common/FilePreviewCommon.md b/doc/devdocs/common/FilePreviewCommon.md index aee9de2b2a..33c11aad28 100644 --- a/doc/devdocs/common/FilePreviewCommon.md +++ b/doc/devdocs/common/FilePreviewCommon.md @@ -12,14 +12,14 @@ This previewer is used for the File Explorer Dev File Previewer, as well as Powe 1. Download Monaco editor with [npm](https://www.npmjs.com/): Run `npm i monaco-editor` in the command prompt. 2. Delete everything except the `min` folder (the minimised code) from the downloaded files. -3. Copy the `min` folder into the `src/common/FilePreviewCommon/Assets/Monaco/monacoSRC` folder of the PowerToys project. +3. Copy the `min` folder into the `/src/Monaco/monacoSRC` folder of the PowerToys project. 4. Generate the JSON file as described in the generate [monaco_languages.json file](#monaco_languagesjson) section. ### Add a new language definition -As an example on how to add a new language definition you can look at the one for [registry files](/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/reg.js). +As an example on how to add a new language definition you can look at the one for [registry files](/src/Monaco/customLanguages/reg.js). -1. Add the new language definition (written with [Monarch](https://microsoft.github.io/monaco-editor/monarch.html)) as a new file to the [folder containing Monaco custom languages](/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/) (Remember the file name and the string you used for "idDefinition" as you need it later.). The file should be formatted like in the example below. (Please change `idDefinition` to the name of your language.) +1. Add the new language definition (written with [Monarch](https://microsoft.github.io/monaco-editor/monarch.html)) as a new file to the [folder containing Monaco custom languages](/src/Monaco/customLanguages/) (Remember the file name and the string you used for "idDefinition" as you need it later.). The file should be formatted like in the example below. (Please change `idDefinition` to the name of your language.) ```javascript export function idDefinition() { @@ -29,7 +29,7 @@ export function idDefinition() { } ``` -2. Add the following line to the [`monacoSpecialLanguages.js`](/src/common/FilePreviewCommon/Assets/Monaco/monacoSpecialLanguages.js) file, after the other import statements: +2. Add the following line to the [`monacoSpecialLanguages.js`](/src/Monaco/monacoSpecialLanguages.js) file, after the other import statements: ```javascript import { idDefinition } from './customLanguages/file.js'; @@ -37,7 +37,7 @@ import { idDefinition } from './customLanguages/file.js'; > Replace file.js with the name of your definition file from step 1. Please replace idDefinition with the string you used in step 1. -3. In the [`monacoSpecialLanguages.js`](/src/common/FilePreviewCommon/Assets/Monaco/monacoSpecialLanguages.js) file add the following line into the `registerAdditionalLanguages` function: +3. In the [`monacoSpecialLanguages.js`](/src/Monaco/monacoSpecialLanguages.js) file add the following line into the `registerAdditionalLanguages` function: ```javascript registerAdditionalNewLanguage("id", [".fileExtension"], idDefinition(), monaco) @@ -47,7 +47,7 @@ registerAdditionalNewLanguage("id", [".fileExtension"], idDefinition(), monaco) * The id can be anything. Recommended is one of the file extensions. For example "php" or "reg". -4. In case you wish to add a custom color for a token, you can do so by adding the following line to [`customTokenColors.js`](/src/common/FilePreviewCommon/Assets/Monaco/customTokenColors.js): +4. In case you wish to add a custom color for a token, you can do so by adding the following line to [`customTokenThemeRules.js`](/src/Monaco/customTokenThemeRules.js): ```javascript {token: 'token-name', foreground: 'ff0000'} ``` @@ -60,7 +60,7 @@ registerAdditionalNewLanguage("id", [".fileExtension"], idDefinition(), monaco) ### Add a new file extension to an existing language -1. In the [`monacoSpecialLanguages.js`](/src/common/FilePreviewCommon/Assets/Monaco/monacoSpecialLanguages.js) file add the following line to the `registerAdditionalLanguages` function. (`existingId` is the id of the language you want to add the extension to. You can find these id's in the [`monaco_languages.json`](/src/common/FilePreviewCommon/Assets/Monaco/monaco_languages.json) file): +1. In the [`monacoSpecialLanguages.js`](/src/Monaco/monacoSpecialLanguages.js) file add the following line to the `registerAdditionalLanguages` function. (`existingId` is the id of the language you want to add the extension to. You can find these id's in the [`monaco_languages.json`](/src/Monaco/monaco_languages.json) file): ```javascript registerAdditionalLanguage("id", [".fileExtension"], "existingId", monaco) @@ -68,17 +68,17 @@ registerAdditionalLanguage("id", [".fileExtension"], "existingId", monaco) * If for instance you want to add more extensions to the php language set the id to `phpExt` and the existingId to `php`. -2. Copy the existing language definition into the `languageDefinitions` function in the same file. You can find the existing definitions in the following folder: [`/src/common/FilePreviewCommon/Assets/Monaco/monacoSRC/min/vs/basic-languages/`](/src/common/FilePreviewCommon/Assets/Monaco/monacoSRC/min/vs/basic-languages/). +2. Copy the existing language definition into the `languageDefinitions` function in the same file. You can find the existing definitions in the following folder: [`/src/Monaco/monacoSRC/min/vs/basic-languages/`](/src/Monaco/monacoSRC/min/vs/basic-languages/). 3. Execute the steps described in the [monaco_languages.json](#monaco_languagesjson) section. ### monaco_languages.json -[`monaco_languages.json`](/src/common/FilePreviewCommon/Assets/Monaco/monaco_languages.json) contains all extensions and IDs for the languages supported by Monaco. The [`MonacoHelper`](/src/common/FilePreviewCommon/MonacoHelper.cs) class and the installer are using this file to register preview handlers for the defined extensions. +[`monaco_languages.json`](/src/Monaco/monaco_languages.json) contains all extensions and IDs for the languages supported by Monaco. The [`MonacoHelper`](/src/common/FilePreviewCommon/MonacoHelper.cs) class and the installer are using this file to register preview handlers for the defined extensions. -After updating Monaco Editor and/or adding a new language you should update the [`monaco_languages.json`](/src/common/FilePreviewCommon/Assets/Monaco/monaco_languages.json) file. +After updating Monaco Editor and/or adding a new language you should update the [`monaco_languages.json`](/src/Monaco/monaco_languages.json) file. -1. Run the [`generateLanguagesJson.html`](/src/common/FilePreviewCommon/Assets/Monaco/generateLanguagesJson.html) file on a local webserver (as webbrowsers will block certain needed features when running the file locally.) +1. Run the [`generateLanguagesJson.html`](/src/Monaco/generateLanguagesJson.html) file on a local webserver (as webbrowsers will block certain needed features when running the file locally.) * This can for example be achieved by using the [Preview Server](https://marketplace.visualstudio.com/items?itemName=yuichinukiyama.vscode-preview-server) extension for Visual Studio Code: Open the file in Visual Studio Code, right click in the code editor and select `vscode-preview-server: Launch on browser`. The file will be opened in a browser. 2. The browser will download the new `monaco_languages.json` file 3. Replace the old file with the newly downloaded one in the source code folder. diff --git a/doc/devdocs/modules/launcher/plugins/community.valuegenerator.md b/doc/devdocs/modules/launcher/plugins/community.valuegenerator.md index 4a580f090d..9b94ae78f2 100644 --- a/doc/devdocs/modules/launcher/plugins/community.valuegenerator.md +++ b/doc/devdocs/modules/launcher/plugins/community.valuegenerator.md @@ -1,6 +1,6 @@ # Value Generator Plugin -The Value Generator plugin is used to generate hashes for strings, to calculate base64 encodings, escape and encode URLs/URIs and to generate GUIDs versions 1, 3, 4 and 5. +The Value Generator plugin is used to generate hashes for strings, to calculate base64 encodings, escape and encode URLs/URIs and to generate GUIDs of version 1, 3, 4, 5, and 7. ![Image of Value Generator plugin](/doc/images/launcher/plugin/community.valuegenerator.png) @@ -34,7 +34,10 @@ The Value Generator plugin is used to generate hashes for strings, to calculate ### [`GUIDGenerator`](/src/modules/launcher/Plugins/Community.PowerToys.Run.Plugin.ValueGenerator/Generators/GUID/GUIDGenerator.cs) - Utility class for generating or calculating GUIDs -- Generating GUID versions 1 and 4 is done using builtin APIs. [`UuidCreateSequential`](https://learn.microsoft.com/en-us/windows/win32/api/rpcdce/nf-rpcdce-uuidcreatesequential) for version 1 and `System.Guid.NewGuid()` for version 4 +- Generating GUID versions 1, 4, and 7 is done using builtin APIs: + - [`UuidCreateSequential`](https://learn.microsoft.com/en-us/windows/win32/api/rpcdce/nf-rpcdce-uuidcreatesequential) for version 1 + - `System.Guid.NewGuid()` for version 4 + - `System.Guid.CreateVersion7()` for version 7 - Versions 3 and 5 take two parameters, a namespace and a name - The namespace must be a valid GUID or one of the [predefined ones](https://datatracker.ietf.org/doc/html/rfc4122#appendix-C) - The `PredefinedNamespaces` dictionary contains aliases for the predefined namespaces diff --git a/doc/images/overview/PT_holiday_hero_image.png b/doc/images/overview/PT_holiday_hero_image.png new file mode 100644 index 0000000000..77351927fd Binary files /dev/null and b/doc/images/overview/PT_holiday_hero_image.png differ diff --git a/doc/thirdPartyRunPlugins.md b/doc/thirdPartyRunPlugins.md index 4db22a1c7e..7e59e3acd4 100644 --- a/doc/thirdPartyRunPlugins.md +++ b/doc/thirdPartyRunPlugins.md @@ -39,6 +39,9 @@ Contact the developers of a plugin directly for assistance with a specific plugi | [GitHubRepo](https://github.com/8LWXpg/PowerToysRun-GitHubRepo) | [8LWXpg](https://github.com/8LWXpg) | Search and open GitHub repositories | | [ProcessKiller](https://github.com/8LWXpg/PowerToysRun-ProcessKiller) | [8LWXpg](https://github.com/8LWXpg) | Search and kill processes | | [ChatGPT](https://github.com/ferraridavide/ChatGPTPowerToys) | [ferraridavide](https://github.com/ferraridavide) | Ask a question to ChatGPT | +| [CanIUse](https://github.com/skttl/ptrun-caniuse) | [skttl](https://github.com/skttl) | Look up browser feature support with caniuse.com | +| [TailwindCSS](https://github.com/skttl/ptrun-tailwindcss) | [skttl](https://github.com/skttl) | Search the documentation of TailwindCSS | +| [HttpStatusCodes](https://github.com/grzhan/HttpStatusCodePowerToys) | [grzhan](https://github.com/grzhan) | Search for http status codes | ## Extending software plugins @@ -56,3 +59,6 @@ Below are community created plugins that target a website or software. They are | [Scoop](https://github.com/Quriz/PowerToysRunScoop) | [Quriz](https://github.com/Quriz) | Search and install packages from Scoop | | [Spotify](https://github.com/waaverecords/PowerToys-Run-Spotify) | [waaverecords](https://github.com/waaverecords) | Search Spotify and control its player | | [PowerSearch for 1Password](https://github.com/KairuDeibisu/PowerToysRunPlugin1Password) | [KairuDeibisu](https://github.com/KairuDeibisu) | An unofficial plugin for searching 1Password for usernames and passwords | +| [HackMD](https://github.com/8LWXpg/PowerToysRun-HackMD) | [8LWXpg](https://github.com/8LWXpg) | Open HackMD notes | +| [SSH](https://github.com/8LWXpg/PowerToysRun-SSH) | [8LWXpg](https://github.com/8LWXpg) | Connect to ssh clients | +| [Bilibili](https://github.com/Whuihuan/PowerToysRun-Bilibili) | [Whuihuan](https://github.com/Whuihuan) | Use AVID or BVID to parse and jump to Bilibili | diff --git a/installer/PowerToysSetup.sln b/installer/PowerToysSetup.sln index cdcef54079..540ef43d23 100644 --- a/installer/PowerToysSetup.sln +++ b/installer/PowerToysSetup.sln @@ -15,6 +15,8 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "PowerToysBootstrapper", "Po EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Version", "..\src\common\version\version.vcxproj", "{CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EtwTrace", "..\src\common\Telemetry\EtwTrace\EtwTrace.vcxproj", "{8F021B46-362B-485C-BFBA-CCF83E820CBD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -68,6 +70,14 @@ Global {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|ARM64.Build.0 = Release|ARM64 {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|x64.ActiveCfg = Release|x64 {CC6E41AC-8174-4E8A-8D22-85DD7F4851DF}.Release|x64.Build.0 = Release|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|ARM64.Build.0 = Debug|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x64.ActiveCfg = Debug|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Debug|x64.Build.0 = Debug|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.ActiveCfg = Release|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|ARM64.Build.0 = Release|ARM64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.ActiveCfg = Release|x64 + {8F021B46-362B-485C-BFBA-CCF83E820CBD}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/installer/PowerToysSetup/NewPlus.wxs b/installer/PowerToysSetup/NewPlus.wxs index 80fd5a94f4..4dd1c67701 100644 --- a/installer/PowerToysSetup/NewPlus.wxs +++ b/installer/PowerToysSetup/NewPlus.wxs @@ -18,6 +18,19 @@ + + + + + + + + + + + + + @@ -27,6 +40,7 @@ + diff --git a/installer/PowerToysSetup/PowerToysInstaller.wixproj b/installer/PowerToysSetup/PowerToysInstaller.wixproj index 6d9ca4a6c5..8771920c3c 100644 --- a/installer/PowerToysSetup/PowerToysInstaller.wixproj +++ b/installer/PowerToysSetup/PowerToysInstaller.wixproj @@ -54,6 +54,7 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil call move /Y ..\..\..\VideoConference.wxs.bk ..\..\..\VideoConference.wxs call move /Y ..\..\..\WinAppSDK.wxs.bk ..\..\..\WinAppSDK.wxs call move /Y ..\..\..\WinUI3Applications.wxs.bk ..\..\..\WinUI3Applications.wxs + call move /Y ..\..\..\Workspaces.wxs.bk ..\..\..\Workspaces.wxs @@ -125,6 +126,7 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil + @@ -179,7 +181,7 @@ call powershell.exe -NonInteractive -executionpolicy Unrestricted -File $(MSBuil --> - + diff --git a/installer/PowerToysSetup/Product.wxs b/installer/PowerToysSetup/Product.wxs index 3a30002a37..7a3a6ee697 100644 --- a/installer/PowerToysSetup/Product.wxs +++ b/installer/PowerToysSetup/Product.wxs @@ -79,6 +79,7 @@ + diff --git a/installer/PowerToysSetup/Workspaces.wxs b/installer/PowerToysSetup/Workspaces.wxs new file mode 100644 index 0000000000..4237aab945 --- /dev/null +++ b/installer/PowerToysSetup/Workspaces.wxs @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installer/PowerToysSetup/generateAllFileComponents.ps1 b/installer/PowerToysSetup/generateAllFileComponents.ps1 index 42864c392c..3592b14362 100644 --- a/installer/PowerToysSetup/generateAllFileComponents.ps1 +++ b/installer/PowerToysSetup/generateAllFileComponents.ps1 @@ -30,7 +30,7 @@ Function Generate-FileList() { $fileExclusionList = @("*.pdb", "*.lastcodeanalysissucceeded", "createdump.exe", "powertoys.exe") - $fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "monacoSpecialLanguages.js", "customTokenColors.js", "*.pri") + $fileInclusionList = @("*.dll", "*.exe", "*.json", "*.msix", "*.png", "*.gif", "*.ico", "*.cur", "*.svg", "index.html", "reg.js", "gitignore.js", "srt.js", "monacoSpecialLanguages.js", "customTokenThemeRules.js", "*.pri") $dllsToIgnore = @("System.CodeDom.dll", "WindowsBase.dll") @@ -317,3 +317,7 @@ Generate-FileComponents -fileListName "SettingsV2AssetsFiles" -wxsFilePath $PSSc Generate-FileComponents -fileListName "SettingsV2AssetsModulesFiles" -wxsFilePath $PSScriptRoot\Settings.wxs -regroot $registryroot Generate-FileComponents -fileListName "SettingsV2OOBEAssetsModulesFiles" -wxsFilePath $PSScriptRoot\Settings.wxs -regroot $registryroot Generate-FileComponents -fileListName "SettingsV2OOBEAssetsFluentIconsFiles" -wxsFilePath $PSScriptRoot\Settings.wxs -regroot $registryroot + +#Workspaces +Generate-FileList -fileDepsJson "" -fileListName WorkspacesImagesComponentFiles -wxsFilePath $PSScriptRoot\Workspaces.wxs -depsPath "$PSScriptRoot..\..\..\$platform\Release\Assets\Workspaces\" +Generate-FileComponents -fileListName "WorkspacesImagesComponentFiles" -wxsFilePath $PSScriptRoot\Workspaces.wxs -regroot $registryroot diff --git a/installer/PowerToysSetupCustomActions/CustomAction.cpp b/installer/PowerToysSetupCustomActions/CustomAction.cpp index 8845208200..8995d2f9b6 100644 --- a/installer/PowerToysSetupCustomActions/CustomAction.cpp +++ b/installer/PowerToysSetupCustomActions/CustomAction.cpp @@ -10,6 +10,7 @@ #include "../../src/common/utils/modulesRegistry.h" #include "../../src/common/updating/installer.h" #include "../../src/common/version/version.h" +#include "../../src/common/Telemetry/EtwTrace/EtwTrace.h" #include #include @@ -27,9 +28,9 @@ HINSTANCE DLL_HANDLE = nullptr; TRACELOGGING_DEFINE_PROVIDER( g_hProvider, - "Microsoft.PowerToysInstaller", - // {e1d8165d-5cb6-5c74-3b51-bdfbfe4f7a3b} - (0xe1d8165d, 0x5cb6, 0x5c74, 0x3b, 0x51, 0xbd, 0xfb, 0xfe, 0x4f, 0x7a, 0x3b), + "Microsoft.PowerToys", + // {38e8889b-9731-53f5-e901-e8a7c1753074} + (0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74), TraceLoggingOptionProjectTelemetry()); const DWORD USERNAME_DOMAIN_LEN = DNLEN + UNLEN + 2; // Domain Name + '\' + User Name + '\0' @@ -38,6 +39,53 @@ const DWORD USERNAME_LEN = UNLEN + 1; // User Name + '\0' static const wchar_t* POWERTOYS_EXE_COMPONENT = L"{A2C66D91-3485-4D00-B04D-91844E6B345B}"; static const wchar_t* POWERTOYS_UPGRADE_CODE = L"{42B84BF7-5FBF-473B-9C8B-049DC16F7708}"; +constexpr inline const wchar_t* DataDiagnosticsRegKey = L"Software\\Classes\\PowerToys"; +constexpr inline const wchar_t* DataDiagnosticsRegValueName = L"AllowDataDiagnostics"; + +#define TraceLoggingWriteWrapper(provider, eventName, ...) \ + if (isDataDiagnosticEnabled()) \ + { \ + trace.UpdateState(true); \ + TraceLoggingWrite(provider, eventName, __VA_ARGS__); \ + trace.Flush(); \ + trace.UpdateState(false); \ + } + +static Shared::Trace::ETWTrace trace{ L"PowerToys_Installer" }; + +inline bool isDataDiagnosticEnabled() +{ + HKEY key{}; + if (RegOpenKeyExW(HKEY_CURRENT_USER, + DataDiagnosticsRegKey, + 0, + KEY_READ, + &key) != ERROR_SUCCESS) + { + return false; + } + + DWORD isDataDiagnosticsEnabled = 0; + DWORD size = sizeof(isDataDiagnosticsEnabled); + + if (RegGetValueW( + HKEY_CURRENT_USER, + DataDiagnosticsRegKey, + DataDiagnosticsRegValueName, + RRF_RT_REG_DWORD, + nullptr, + &isDataDiagnosticsEnabled, + &size) != ERROR_SUCCESS) + { + RegCloseKey(key); + return false; + } + RegCloseKey(key); + + return isDataDiagnosticsEnabled == 1; +} + + HRESULT getInstallFolder(MSIHANDLE hInstall, std::wstring& installationDir) { DWORD len = 0; @@ -793,13 +841,14 @@ UINT __stdcall TelemetryLogInstallSuccessCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogInstallSuccessCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "Install_Success", TraceLoggingWideString(get_product_version().c_str(), "Version"), ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), TraceLoggingBoolean(TRUE, "UTCReplace_AppSessionGuid"), - TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE)); + TraceLoggingKeyword(PROJECT_KEYWORD_MEASURE) + ); LExit: er = SUCCEEDED(hr) ? ERROR_SUCCESS : ERROR_INSTALL_FAILURE; @@ -814,7 +863,7 @@ UINT __stdcall TelemetryLogInstallCancelCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogInstallCancelCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "Install_Cancel", TraceLoggingWideString(get_product_version().c_str(), "Version"), @@ -835,7 +884,7 @@ UINT __stdcall TelemetryLogInstallFailCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogInstallFailCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "Install_Fail", TraceLoggingWideString(get_product_version().c_str(), "Version"), @@ -856,7 +905,7 @@ UINT __stdcall TelemetryLogUninstallSuccessCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogUninstallSuccessCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "UnInstall_Success", TraceLoggingWideString(get_product_version().c_str(), "Version"), @@ -877,7 +926,7 @@ UINT __stdcall TelemetryLogUninstallCancelCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogUninstallCancelCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "UnInstall_Cancel", TraceLoggingWideString(get_product_version().c_str(), "Version"), @@ -898,7 +947,7 @@ UINT __stdcall TelemetryLogUninstallFailCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogUninstallFailCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "UnInstall_Fail", TraceLoggingWideString(get_product_version().c_str(), "Version"), @@ -919,7 +968,7 @@ UINT __stdcall TelemetryLogRepairCancelCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogRepairCancelCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "Repair_Cancel", TraceLoggingWideString(get_product_version().c_str(), "Version"), @@ -940,7 +989,7 @@ UINT __stdcall TelemetryLogRepairFailCA(MSIHANDLE hInstall) hr = WcaInitialize(hInstall, "TelemetryLogRepairFailCA"); ExitOnFailure(hr, "Failed to initialize"); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "Repair_Fail", TraceLoggingWideString(get_product_version().c_str(), "Version"), diff --git a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj index af6a0f184b..dee9f63e2b 100644 --- a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj +++ b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj @@ -76,6 +76,7 @@ call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\VideoConference.wxs"" ""$(ProjectDir)..\PowerToysSetup\VideoConference.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\WinAppSDK.wxs"" ""$(ProjectDir)..\PowerToysSetup\WinAppSDK.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\WinUI3Applications.wxs"" ""$(ProjectDir)..\PowerToysSetup\WinUI3Applications.wxs.bk"""" + call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\Workspaces.wxs"" ""$(ProjectDir)..\PowerToysSetup\Workspaces.wxs.bk"""" if not "$(NormalizedPerUserValue)" == "true" call powershell.exe -NonInteractive -executionpolicy Unrestricted -File ..\PowerToysSetup\generateAllFileComponents.ps1 -platform $(Platform) if "$(NormalizedPerUserValue)" == "true" call powershell.exe -NonInteractive -executionpolicy Unrestricted -File ..\PowerToysSetup\generateAllFileComponents.ps1 -platform $(Platform) -installscopeperuser $(NormalizedPerUserValue) @@ -160,6 +161,9 @@ {d9b8fc84-322a-4f9f-bbb9-20915c47ddfd} + + {8f021b46-362b-485c-bfba-ccf83e820cbd} + diff --git a/src/Common.Dotnet.AotCompatibility.props b/src/Common.Dotnet.AotCompatibility.props new file mode 100644 index 0000000000..9c9b3faa25 --- /dev/null +++ b/src/Common.Dotnet.AotCompatibility.props @@ -0,0 +1,9 @@ + + + + + true + true + 2 + + diff --git a/src/Common.Dotnet.CsWinRT.props b/src/Common.Dotnet.CsWinRT.props index 514997e71b..41e1bcfcbf 100644 --- a/src/Common.Dotnet.CsWinRT.props +++ b/src/Common.Dotnet.CsWinRT.props @@ -2,8 +2,8 @@ - 10.0.22621.38 - net8.0-windows10.0.22621.0 + 10.0.22621.48 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 win-x64;win-arm64 @@ -14,7 +14,7 @@ 4 True - CA1720 + CA1720;CA1859;CA2263;CA2022 diff --git a/src/Monaco.props b/src/Monaco.props new file mode 100644 index 0000000000..471772823d --- /dev/null +++ b/src/Monaco.props @@ -0,0 +1,30 @@ + + + + + + Assets\Monaco\customTokenThemeRules.js + Always + + + Assets\Monaco\monacoSpecialLanguages.js + Always + + + Assets\Monaco\index.html + Always + + + Assets\Monaco\monaco_languages.json + Always + + + Assets\Monaco\monacoSRC\%(RecursiveDir)%(FileName)%(Extension) + Always + + + Assets\Monaco\customLanguages\%(RecursiveDir)%(FileName)%(Extension) + Always + + + \ No newline at end of file diff --git a/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js b/src/Monaco/customLanguages/gitignore.js similarity index 81% rename from src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js rename to src/Monaco/customLanguages/gitignore.js index e4539dd50a..8b5d393993 100644 --- a/src/common/FilePreviewCommon/Assets/Monaco/customLanguages/gitignore.js +++ b/src/Monaco/customLanguages/gitignore.js @@ -6,7 +6,7 @@ root: [ [/^#.*$/, 'comment'], [/.*((? \d{2}:\d{2}:\d{2},\d{3}/, { + cases: { + '@eos': {token: 'type.identifier', next: '@subtitle'}, + '@default': {token: 'type.identifier', next: '@ignore'} + } + }], + [/^$/, 'string', '@pop'] + ], + + ignore: [ + [/.+$/, '', '@subtitle'] + ], + + subtitle: [ + [/^$/, 'string', '@popall'], + [/<\/?(?:[ibu]|font(?:\s+color="[^"]+"\s*)?)>/, 'tag'], + [/./, 'string'] + ] + } + }; +} \ No newline at end of file diff --git a/src/Monaco/customTokenThemeRules.js b/src/Monaco/customTokenThemeRules.js new file mode 100644 index 0000000000..cbba1b1f39 --- /dev/null +++ b/src/Monaco/customTokenThemeRules.js @@ -0,0 +1,3 @@ +export const customTokenThemeRules = [ + {token: 'custom-negation.gitignore', foreground: 'c00ce0'} +]; \ No newline at end of file diff --git a/src/common/FilePreviewCommon/Assets/Monaco/generateLanguagesJson.html b/src/Monaco/generateLanguagesJson.html similarity index 100% rename from src/common/FilePreviewCommon/Assets/Monaco/generateLanguagesJson.html rename to src/Monaco/generateLanguagesJson.html diff --git a/src/common/FilePreviewCommon/Assets/Monaco/index.html b/src/Monaco/index.html similarity index 97% rename from src/common/FilePreviewCommon/Assets/Monaco/index.html rename to src/Monaco/index.html index 1888cdac39..020c4c3c33 100644 --- a/src/common/FilePreviewCommon/Assets/Monaco/index.html +++ b/src/Monaco/index.html @@ -79,7 +79,7 @@ + + + diff --git a/src/modules/registrypreview/RegistryPreviewUILib/MonacoEditorControl.xaml b/src/modules/registrypreview/RegistryPreviewUILib/MonacoEditorControl.xaml new file mode 100644 index 0000000000..9635708343 --- /dev/null +++ b/src/modules/registrypreview/RegistryPreviewUILib/MonacoEditorControl.xaml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + diff --git a/src/modules/registrypreview/RegistryPreviewUILib/MonacoEditorControl.xaml.cs b/src/modules/registrypreview/RegistryPreviewUILib/MonacoEditorControl.xaml.cs new file mode 100644 index 0000000000..eeddfcb0f4 --- /dev/null +++ b/src/modules/registrypreview/RegistryPreviewUILib/MonacoEditorControl.xaml.cs @@ -0,0 +1,169 @@ +// 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.IO; +using System.Reflection; +using System.Text.Json.Nodes; +using System.Threading.Tasks; +using System.Timers; +using System.Web; +using CommunityToolkit.Mvvm.ComponentModel; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.Web.WebView2.Core; +using Windows.UI; + +namespace RegistryPreviewUILib +{ + [INotifyPropertyChanged] + public sealed partial class MonacoEditorControl : UserControl, IDisposable + { + private readonly Timer _textChangedThrottle; + private bool _textChangedThrottled; + + public string Text { get; private set; } + + [ObservableProperty] + private bool _isLoading; + + public event EventHandler TextChanged; + + public MonacoEditorControl() + { + InitializeComponent(); + Environment.SetEnvironmentVariable("WEBVIEW2_USER_DATA_FOLDER", MonacoHelper.TempFolderPath, EnvironmentVariableTarget.Process); + + _textChangedThrottle = new Timer(250); + _textChangedThrottle.Elapsed += OnTextChangedThrottleElapsed; + _textChangedThrottle.AutoReset = false; + + ActualThemeChanged += OnActualThemeChanged; + } + + public async Task SetTextAsync(string text) + { + Text = text; + + if (!IsLoading) + { + var encodedText = HttpUtility.JavaScriptStringEncode(text); + await Browser.CoreWebView2.ExecuteScriptAsync($"editor.setValue('{encodedText}')"); + } + } + + private async void OnActualThemeChanged(FrameworkElement sender, object args) + { + await SetThemeAsync(); + } + + private async void Browser_Loaded(object sender, RoutedEventArgs e) + { + IsLoading = true; + + await Browser.EnsureCoreWebView2Async(); + Browser.DefaultBackgroundColor = Color.FromArgb(0, 0, 0, 0); + Browser.CoreWebView2.NavigationCompleted += CoreWebView2_NavigationCompleted; + Browser.CoreWebView2.PermissionRequested += CoreWebView2_PermissionRequested; + Browser.CoreWebView2.Settings.AreDefaultScriptDialogsEnabled = false; + Browser.CoreWebView2.Settings.AreDefaultContextMenusEnabled = false; + Browser.CoreWebView2.Settings.AreHostObjectsAllowed = false; + Browser.CoreWebView2.Settings.IsGeneralAutofillEnabled = false; + Browser.CoreWebView2.Settings.IsPasswordAutosaveEnabled = false; + Browser.CoreWebView2.Settings.IsScriptEnabled = true; + Browser.CoreWebView2.Settings.IsWebMessageEnabled = true; +#if DEBUG + Browser.CoreWebView2.Settings.AreDevToolsEnabled = true; +#else + Browser.CoreWebView2.Settings.AreDevToolsEnabled = false; +#endif + + Browser.CoreWebView2.SetVirtualHostNameToFolderMapping( + MonacoHelper.VirtualHostName, + MonacoHelper.MonacoDirectory, + CoreWebView2HostResourceAccessKind.Allow); + + var assemblyDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; + var index = Path.GetFullPath(Path.Combine(assemblyDir, "Assets", "RegistryPreview", "index.html")); + Browser.CoreWebView2.Navigate(index); + } + + private void CoreWebView2_PermissionRequested(CoreWebView2 sender, CoreWebView2PermissionRequestedEventArgs args) + { + if (args.PermissionKind == CoreWebView2PermissionKind.ClipboardRead) + { + // Hide the permission request dialog + args.State = CoreWebView2PermissionState.Allow; + args.Handled = true; + } + } + + private async void CoreWebView2_NavigationCompleted(CoreWebView2 sender, CoreWebView2NavigationCompletedEventArgs args) + { + await SetThemeAsync(); + IsLoading = false; + await SetTextAsync(Text); + + Browser.CoreWebView2.WebMessageReceived += CoreWebView2_WebMessageReceived; + Browser.Focus(FocusState.Programmatic); + } + + private void CoreWebView2_WebMessageReceived(CoreWebView2 sender, CoreWebView2WebMessageReceivedEventArgs args) + { + var json = JsonNode.Parse(args.WebMessageAsJson); + if (json == null) + { + return; + } + + var id = json["id"]; + if (id == null || !id.ToString().Equals("contentChanged", StringComparison.OrdinalIgnoreCase)) + { + return; + } + + var content = json["content"].ToString(); + if (content == null) + { + return; + } + + Text = content; + ThrottleTextChanged(); + } + + private async Task SetThemeAsync() + { + var theme = Application.Current.RequestedTheme == ApplicationTheme.Light ? "vs" : "vs-dark"; + await Browser.CoreWebView2.ExecuteScriptAsync($"monaco.editor.setTheme('{theme}')"); + } + + private void OnTextChangedThrottleElapsed(object sender, ElapsedEventArgs e) + { + if (_textChangedThrottled) + { + _textChangedThrottled = false; + TextChanged?.Invoke(this, EventArgs.Empty); + _textChangedThrottle.Start(); + } + } + + private void ThrottleTextChanged() + { + if (_textChangedThrottle.Enabled) + { + _textChangedThrottled = true; + return; + } + + TextChanged?.Invoke(this, EventArgs.Empty); + _textChangedThrottle.Start(); + } + + public void Dispose() + { + _textChangedThrottle?.Dispose(); + } + } +} diff --git a/src/modules/registrypreview/RegistryPreviewUILib/MonacoHelper.cs b/src/modules/registrypreview/RegistryPreviewUILib/MonacoHelper.cs new file mode 100644 index 0000000000..95305ff2ba --- /dev/null +++ b/src/modules/registrypreview/RegistryPreviewUILib/MonacoHelper.cs @@ -0,0 +1,50 @@ +๏ปฟ// 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.IO; +using System.Reflection; + +namespace RegistryPreviewUILib +{ + public static class MonacoHelper + { + /// + /// Name of the virtual host + /// + public const string VirtualHostName = "PowerToysLocalMonaco"; + + public static string TempFolderPath { get; } = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), @"AppData\LocalLow\Microsoft\PowerToys\RegistryPreview-Temp"); + + private static string _monacoDirectory; + + public static string GetRuntimeMonacoDirectory() + { + string codeBase = Assembly.GetExecutingAssembly().Location; + string path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(codeBase) ?? string.Empty, "Assets", "Monaco")); + if (Path.Exists(path)) + { + return path; + } + else + { + // We're likely in WinUI3Apps directory and need to go back to the base directory. + return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(codeBase) ?? string.Empty, "..", "Assets", "Monaco")); + } + } + + public static string MonacoDirectory + { + get + { + if (string.IsNullOrEmpty(_monacoDirectory)) + { + _monacoDirectory = GetRuntimeMonacoDirectory(); + } + + return _monacoDirectory; + } + } + } +} diff --git a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Events.cs b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Events.cs index 624b104a01..0df3a5c0f5 100644 --- a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Events.cs +++ b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Events.cs @@ -8,9 +8,9 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; -using System.Threading.Tasks; using CommunityToolkit.WinUI.UI.Controls; +using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Data; @@ -21,6 +21,8 @@ namespace RegistryPreviewUILib { public sealed partial class RegistryPreviewMainPage : Page { + private readonly DispatcherQueue _dispatcherQueue = DispatcherQueue.GetForCurrentThread(); + /// /// Event that is will prevent the app from closing if the "save file" flag is active /// @@ -40,43 +42,25 @@ namespace RegistryPreviewUILib resourceLoader.GetString("YesNoCancelDialogSecondaryButtonText"), resourceLoader.GetString("YesNoCancelDialogCloseButtonText")); } - - // Check to see if the textbox's context menu is open - if (textBox.ContextFlyout != null && textBox.ContextFlyout.IsOpen) - { - textBox.ContextFlyout.Hide(); - - // if true, the app will not close yet - args.Handled = true; - - // HACK: To fix https://github.com/microsoft/PowerToys/issues/28820, wait a bit for the close animation of the flyout to run before closing the application. - // This might be called many times if the flyout still hasn't been closed, as Window_Closed will be called again by App.Current.Exit - DispatcherQueue.TryEnqueue(async () => - { - await Task.Delay(100); - Application.Current.Exit(); - }); - return; - } } /// /// Event that gets fired after the visual tree has been fully loaded; the app opens the reg file from here so it can show a message box successfully /// - private void GridPreview_Loaded(object sender, RoutedEventArgs e) + private async void GridPreview_Loaded(object sender, RoutedEventArgs e) { // static flag to track whether the Visual Tree is ready - if the main Grid has been loaded, the tree is ready. visualTreeReady = true; // Check to see if the REG file was opened and parsed successfully - if (OpenRegistryFile(_appFileName) == false) + if (await OpenRegistryFile(_appFileName) == false) { if (File.Exists(_appFileName)) { // Allow Refresh and Edit to be enabled because a broken Reg file might be fixable UpdateToolBarAndUI(false, true, true); _updateWindowTitleFunction(resourceLoader.GetString("InvalidRegistryFileTitle")); - textBox.TextChanged += TextBox_TextChanged; + MonacoEditor.TextChanged += MonacoEditor_TextChanged; return; } else @@ -87,10 +71,10 @@ namespace RegistryPreviewUILib } else { - textBox.TextChanged += TextBox_TextChanged; + MonacoEditor.TextChanged += MonacoEditor_TextChanged; } - textBox.Focus(FocusState.Programmatic); + MonacoEditor.Focus(FocusState.Programmatic); } /// @@ -153,16 +137,15 @@ namespace RegistryPreviewUILib if (storageFile != null) { // mute the TextChanged handler to make for clean UI - textBox.TextChanged -= TextBox_TextChanged; - + MonacoEditor.TextChanged -= MonacoEditor_TextChanged; _appFileName = storageFile.Path; - UpdateToolBarAndUI(OpenRegistryFile(_appFileName)); + UpdateToolBarAndUI(await OpenRegistryFile(_appFileName)); // disable the Save button as it's a new file saveButton.IsEnabled = false; // Restore the event handler as we're loaded - textBox.TextChanged += TextBox_TextChanged; + MonacoEditor.TextChanged += MonacoEditor_TextChanged; } } @@ -177,7 +160,7 @@ namespace RegistryPreviewUILib /// /// Uses a picker to save out a copy of the current reg file /// - private void SaveAsButton_Click(object sender, RoutedEventArgs e) + private async void SaveAsButton_Click(object sender, RoutedEventArgs e) { // 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 @@ -195,24 +178,24 @@ namespace RegistryPreviewUILib _appFileName = filename; SaveFile(); - UpdateToolBarAndUI(OpenRegistryFile(_appFileName)); + UpdateToolBarAndUI(await OpenRegistryFile(_appFileName)); } /// /// Reloads the current REG file from storage /// - private void RefreshButton_Click(object sender, RoutedEventArgs e) + private async void RefreshButton_Click(object sender, RoutedEventArgs e) { // mute the TextChanged handler to make for clean UI - textBox.TextChanged -= TextBox_TextChanged; + MonacoEditor.TextChanged -= MonacoEditor_TextChanged; // reload the current Registry file and update the toolbar accordingly. - UpdateToolBarAndUI(OpenRegistryFile(_appFileName), true, true); + UpdateToolBarAndUI(await OpenRegistryFile(_appFileName), true, true); saveButton.IsEnabled = false; // restore the TextChanged handler - textBox.TextChanged += TextBox_TextChanged; + MonacoEditor.TextChanged += MonacoEditor_TextChanged; } /// @@ -364,12 +347,15 @@ namespace RegistryPreviewUILib } /// - /// When the text in textBox changes, reload treeView and possibly dataGrid and reset the save button + /// When the text in editor changes, reload treeView and possibly dataGrid and reset the save button /// - private void TextBox_TextChanged(object sender, TextChangedEventArgs e) + private void MonacoEditor_TextChanged(object sender, EventArgs e) { - RefreshRegistryFile(); - saveButton.IsEnabled = true; + _dispatcherQueue.TryEnqueue(() => + { + RefreshRegistryFile(); + saveButton.IsEnabled = true; + }); } } } diff --git a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs index 6c85c08ddf..daae306006 100644 --- a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs +++ b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs @@ -11,7 +11,8 @@ using System.IO; using System.Linq; using System.Reflection; using System.Text; - +using System.Threading; +using System.Threading.Tasks; using Microsoft.UI.Input; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; @@ -21,12 +22,14 @@ namespace RegistryPreviewUILib { public sealed partial class RegistryPreviewMainPage : Page { + private static SemaphoreSlim _dialogSemaphore = new(1); + public delegate void UpdateWindowTitleFunction(string title); /// /// Method that opens and processes the passed in file name; expected to be an absolute path and a first time open /// - private bool OpenRegistryFile(string filename) + private async Task OpenRegistryFile(string filename) { // clamp to prevent attempts to open a file larger than 10MB try @@ -46,7 +49,7 @@ namespace RegistryPreviewUILib // Disable parts of the UI that can cause trouble when loading ChangeCursor(gridPreview, true); - textBox.Text = string.Empty; + await MonacoEditor.SetTextAsync(string.Empty); // clear the treeView and dataGrid no matter what treeView.RootNodes.Clear(); @@ -55,7 +58,7 @@ namespace RegistryPreviewUILib // update the current window's title with the current filename _updateWindowTitleFunction(filename); - // Load in the whole file in one call and plop it all into textBox + // Load in the whole file in one call and plop it all into editor FileStream fileStream = null; try { @@ -68,15 +71,15 @@ namespace RegistryPreviewUILib StreamReader streamReader = new StreamReader(fileStream); string filenameText = streamReader.ReadToEnd(); - textBox.Text = filenameText; + await MonacoEditor.SetTextAsync(filenameText); streamReader.Close(); } catch { // restore TextChanged handler to make for clean UI - textBox.TextChanged += TextBox_TextChanged; + MonacoEditor.TextChanged += MonacoEditor_TextChanged; - // Reset the cursor but leave textBox disabled as no content got loaded + // Reset the cursor but leave editor disabled as no content got loaded ChangeCursor(gridPreview, false); return false; } @@ -89,8 +92,8 @@ namespace RegistryPreviewUILib } } - // now that the file is loaded and in textBox, parse the data - ParseRegistryFile(textBox.Text); + // now that the file is loaded and in editor, parse the data + ParseRegistryFile(MonacoEditor.Text); // Getting here means that the entire REG file was parsed without incident // so select the root of the tree and celebrate @@ -120,8 +123,8 @@ namespace RegistryPreviewUILib treeView.RootNodes.Clear(); ClearTable(); - // the existing text is still in textBox so parse the data again - ParseRegistryFile(textBox.Text); + // the existing text is still in editor so parse the data again + ParseRegistryFile(MonacoEditor.Text); // check to see if there was a key in treeView before the refresh happened if (currentNode != null) @@ -164,7 +167,7 @@ namespace RegistryPreviewUILib } /// - /// Parses the text that is passed in, which should be the same text that's in textBox + /// Parses the text that is passed in, which should be the same text that's in editor /// private bool ParseRegistryFile(string filenameText) { @@ -181,10 +184,10 @@ namespace RegistryPreviewUILib // As we'll be processing the text one line at a time, this string will be the current line string registryLine; - // Brute force editing: for textBox to show Cr-Lf corrected, we need to strip out the \n's + // Brute force editing: for editor to show Cr-Lf corrected, we need to strip out the \n's filenameText = filenameText.Replace("\r\n", "\r"); - // split apart all of the text in textBox, where one element in the array represents one line + // split apart all of the text in editor, where one element in the array represents one line string[] registryLines = filenameText.Split("\r"); if (registryLines.Length <= 1) { @@ -655,8 +658,8 @@ namespace RegistryPreviewUILib } /// - /// Enable command bar buttons and textBox. - /// Note that writeButton and textBox all update with the same value on purpose + /// Enable command bar buttons + /// Note that writeButton and editor all update with the same value on purpose /// private void UpdateToolBarAndUI(bool enableWrite, bool enableRefresh, bool enableEdit) { @@ -776,21 +779,34 @@ namespace RegistryPreviewUILib /// private async void ShowMessageBox(string title, string content, string closeButtonText) { - ContentDialog contentDialog = new ContentDialog() + if (_dialogSemaphore.CurrentCount == 0) { - Title = title, - Content = content, - CloseButtonText = closeButtonText, - }; - - // Use this code to associate the dialog to the appropriate AppWindow by setting - // the dialog's XamlRoot to the same XamlRoot as an element that is already present in the AppWindow. - if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) - { - contentDialog.XamlRoot = this.Content.XamlRoot; + return; } - await contentDialog.ShowAsync(); + try + { + await _dialogSemaphore.WaitAsync(); + ContentDialog contentDialog = new ContentDialog() + { + Title = title, + Content = content, + CloseButtonText = closeButtonText, + }; + + // Use this code to associate the dialog to the appropriate AppWindow by setting + // the dialog's XamlRoot to the same XamlRoot as an element that is already present in the AppWindow. + if (ApiInformation.IsApiContractPresent("Windows.Foundation.UniversalApiContract", 8)) + { + contentDialog.XamlRoot = this.Content.XamlRoot; + } + + await contentDialog.ShowAsync(); + } + finally + { + _dialogSemaphore.Release(); + } } /// @@ -894,7 +910,7 @@ namespace RegistryPreviewUILib } /// - /// Wrapper method that saves the current file in place, using the current text in textBox. + /// Wrapper method that saves the current file in place, using the current text in editor. /// private void SaveFile() { @@ -914,8 +930,8 @@ namespace RegistryPreviewUILib fileStream = new FileStream(_appFileName, fileStreamOptions); StreamWriter streamWriter = new StreamWriter(fileStream, System.Text.Encoding.Unicode); - // if we get here, the file is open and writable so dump the whole contents of textBox - string filenameText = textBox.Text; + // if we get here, the file is open and writable so dump the whole contents of editor + string filenameText = MonacoEditor.Text; streamWriter.Write(filenameText); streamWriter.Flush(); streamWriter.Close(); diff --git a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.xaml b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.xaml index f5e0c6ee1a..058663459e 100644 --- a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.xaml +++ b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.xaml @@ -3,6 +3,7 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:local="using:RegistryPreviewUILib" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls" xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls" @@ -133,28 +134,12 @@ - + IsTabStop="True" /> + Library @@ -39,6 +40,12 @@ + + + + + + @@ -52,4 +59,10 @@ Always + + + + MSBuild:Compile + + diff --git a/src/modules/registrypreview/RegistryPreviewUILib/Strings/en-US/Resources.resw b/src/modules/registrypreview/RegistryPreviewUILib/Strings/en-US/Resources.resw index d637b2e187..580d108d9a 100644 --- a/src/modules/registrypreview/RegistryPreviewUILib/Strings/en-US/Resources.resw +++ b/src/modules/registrypreview/RegistryPreviewUILib/Strings/en-US/Resources.resw @@ -199,9 +199,6 @@ New Registry file - - Registry file text will appear here - Registry Preview diff --git a/src/modules/videoconference/VideoConferenceModule/pch.h b/src/modules/videoconference/VideoConferenceModule/pch.h index 3f4849aa44..7c614d9a5c 100644 --- a/src/modules/videoconference/VideoConferenceModule/pch.h +++ b/src/modules/videoconference/VideoConferenceModule/pch.h @@ -21,5 +21,3 @@ #include #include - -#include diff --git a/src/modules/videoconference/VideoConferenceModule/trace.cpp b/src/modules/videoconference/VideoConferenceModule/trace.cpp index 889cca2a15..043c6b30e7 100644 --- a/src/modules/videoconference/VideoConferenceModule/trace.cpp +++ b/src/modules/videoconference/VideoConferenceModule/trace.cpp @@ -2,6 +2,8 @@ #include "trace.h" +#include + TRACELOGGING_DEFINE_PROVIDER( g_hProvider, "Microsoft.PowerToys", @@ -9,20 +11,10 @@ TRACELOGGING_DEFINE_PROVIDER( (0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74), TraceLoggingOptionProjectTelemetry()); -void Trace::RegisterProvider() noexcept -{ - TraceLoggingRegister(g_hProvider); -} - -void Trace::UnregisterProvider() noexcept -{ - TraceLoggingUnregister(g_hProvider); -} - // Log if the user has VCM enabled or disabled void Trace::EnableVideoConference(const bool enabled) noexcept { - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "VideoConference_EnableVideoConference", ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), @@ -34,7 +26,7 @@ void Trace::SettingsChanged(const struct VideoConferenceSettings& settings) noex { bool CustomOverlayImage = (settings.imageOverlayPath.length() > 0); - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "VideoConference_SettingsChanged", TraceLoggingWideString(settings.toolbarPositionString.c_str(), "ToolbarPosition"), @@ -47,7 +39,7 @@ void Trace::SettingsChanged(const struct VideoConferenceSettings& settings) noex void Trace::MicrophoneMuted() noexcept { - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "VideoConference_MicrophoneMuted", TraceLoggingBoolean(true, "MicrophoneMuted"), @@ -58,7 +50,7 @@ void Trace::MicrophoneMuted() noexcept void Trace::CameraMuted() noexcept { - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "VideoConference_CameraMuted", TraceLoggingBoolean(true, "CameraMuted"), diff --git a/src/modules/videoconference/VideoConferenceModule/trace.h b/src/modules/videoconference/VideoConferenceModule/trace.h index 5d42709be2..0a9f193e69 100644 --- a/src/modules/videoconference/VideoConferenceModule/trace.h +++ b/src/modules/videoconference/VideoConferenceModule/trace.h @@ -1,11 +1,11 @@ #pragma once #include "VideoConferenceModule.h" -class Trace +#include + +class Trace : public telemetry::TraceBase { public: - static void RegisterProvider() noexcept; - static void UnregisterProvider() noexcept; static void EnableVideoConference(const bool enabled) noexcept; static void SettingsChanged(const struct VideoConferenceSettings &settings) noexcept; static void MicrophoneMuted() noexcept; diff --git a/src/runner/UpdateUtils.cpp b/src/runner/UpdateUtils.cpp index 4558b37cb3..23743d2001 100644 --- a/src/runner/UpdateUtils.cpp +++ b/src/runner/UpdateUtils.cpp @@ -53,8 +53,9 @@ void ShowNewVersionAvailable(const new_version_download_info& info) { link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_UPDATE_NOW), L"powertoys://update_now/" }, link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO), - L"powertoys://open_settings/" } }, - std::move(toast_params)); + L"powertoys://open_overview/" } }, + std::move(toast_params), + L"powertoys://open_overview/"); } void ShowOpenSettingsForUpdate() @@ -65,13 +66,14 @@ void ShowOpenSettingsForUpdate() std::vector actions = { link_button{ GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_MORE_INFO), - L"powertoys://open_settings/" }, + L"powertoys://open_overview/" }, }; show_toast_with_activations(GET_RESOURCE_STRING(IDS_GITHUB_NEW_VERSION_AVAILABLE), GET_RESOURCE_STRING(IDS_TOAST_TITLE), {}, std::move(actions), - std::move(toast_params)); + std::move(toast_params), + L"powertoys://open_overview/"); } SHELLEXECUTEINFOW LaunchPowerToysUpdate(const wchar_t* cmdline) diff --git a/src/runner/general_settings.cpp b/src/runner/general_settings.cpp index 9925308507..9e3b170feb 100644 --- a/src/runner/general_settings.cpp +++ b/src/runner/general_settings.cpp @@ -65,7 +65,7 @@ json::JsonObject load_general_settings() show_new_updates_toast_notification = loaded.GetNamedBoolean(L"show_new_updates_toast_notification", true); download_updates_automatically = loaded.GetNamedBoolean(L"download_updates_automatically", true) && check_user_is_admin(); show_whats_new_after_updates = loaded.GetNamedBoolean(L"show_whats_new_after_updates", true); - enable_experimentation = loaded.GetNamedBoolean(L"enable_experimentation",true); + enable_experimentation = loaded.GetNamedBoolean(L"enable_experimentation", true); enable_warnings_elevated_apps = loaded.GetNamedBoolean(L"enable_warnings_elevated_apps", true); return loaded; @@ -241,8 +241,7 @@ void start_enabled_powertoys() { std::wstring disable_module_name{ static_cast(disabled_element.Key()) }; - if (powertoys_gpo_configuration.find(disable_module_name)!=powertoys_gpo_configuration.end() - && (powertoys_gpo_configuration[disable_module_name]==powertoys_gpo::gpo_rule_configured_enabled || powertoys_gpo_configuration[disable_module_name]==powertoys_gpo::gpo_rule_configured_disabled)) + if (powertoys_gpo_configuration.find(disable_module_name) != powertoys_gpo_configuration.end() && (powertoys_gpo_configuration[disable_module_name] == powertoys_gpo::gpo_rule_configured_enabled || powertoys_gpo_configuration[disable_module_name] == powertoys_gpo::gpo_rule_configured_disabled)) { // If gpo forces the enabled setting, no need to check the setting for this PowerToy. It will be applied later on this function. continue; diff --git a/src/runner/main.cpp b/src/runner/main.cpp index dd35697e09..c2f45868f6 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -274,6 +275,7 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_ const std::wstring_view cant_drag_elevated_disable = L"cant_drag_elevated_disable/"; const std::wstring_view couldnt_toggle_powerpreview_modules_disable = L"couldnt_toggle_powerpreview_modules_disable/"; const std::wstring_view open_settings = L"open_settings/"; + const std::wstring_view open_overview = L"open_overview/"; const std::wstring_view update_now = L"update_now/"; if (param == cant_drag_elevated_disable) @@ -295,6 +297,11 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_ open_menu_from_another_instance(std::nullopt); return toast_notification_handler_result::exit_success; } + else if (param == open_overview) + { + open_menu_from_another_instance("Overview"); + return toast_notification_handler_result::exit_success; + } else { return toast_notification_handler_result::exit_error; @@ -303,6 +310,9 @@ toast_notification_handler_result toast_notification_handler(const std::wstring_ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR lpCmdLine, int /*nCmdShow*/) { + Shared::Trace::ETWTrace trace{}; + trace.UpdateState(true); + Gdiplus::GdiplusStartupInput gpStartupInput; ULONG_PTR gpToken; GdiplusStartup(&gpToken, &gpStartupInput, NULL); @@ -437,6 +447,13 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR l openScoobe = false; } + bool dataDiagnosticsDisabledByGpo = powertoys_gpo::getAllowDataDiagnosticsValue() == powertoys_gpo::gpo_rule_configured_disabled; + if (dataDiagnosticsDisabledByGpo) + { + Logger::info(L"Data diagnostics: Data diagnostics is disabled by GPO."); + PTSettingsHelper::save_data_diagnostics(false); + } + if (elevated && with_dont_elevate_arg && !run_elevated_setting) { Logger::info("Scheduling restart as non elevated"); @@ -473,6 +490,9 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR l result = -1; } + trace.Flush(); + trace.UpdateState(false); + // We need to release the mutexes to be able to restart the application if (msi_mutex) { @@ -481,6 +501,7 @@ int WINAPI WinMain(HINSTANCE /*hInstance*/, HINSTANCE /*hPrevInstance*/, LPSTR l if (is_restart_scheduled()) { + modules().clear(); if (!restart_if_scheduled()) { // If it's not possible to restart non-elevated due to some condition in the user's configuration, user should start PowerToys manually. diff --git a/src/runner/pch.h b/src/runner/pch.h index a01e93cc17..537bef12d6 100644 --- a/src/runner/pch.h +++ b/src/runner/pch.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include diff --git a/src/runner/runner.vcxproj b/src/runner/runner.vcxproj index 90129f37f2..a55396a71a 100644 --- a/src/runner/runner.vcxproj +++ b/src/runner/runner.vcxproj @@ -107,6 +107,9 @@ {1d5be09d-78c0-4fd7-af00-ae7c1af7c525} + + {8f021b46-362b-485c-bfba-ccf83e820cbd} + {98537082-0fdb-40de-abd8-0dc5a4269bab} diff --git a/src/runner/settings_window.cpp b/src/runner/settings_window.cpp index 6430824bb1..6127eb2c60 100644 --- a/src/runner/settings_window.cpp +++ b/src/runner/settings_window.cpp @@ -6,6 +6,7 @@ #include "powertoy_module.h" #include +#include #include "tray_icon.h" #include "general_settings.h" #include "restart_elevated.h" @@ -34,6 +35,7 @@ TwoWayPipeMessageIPC* current_settings_ipc = NULL; std::mutex ipc_mutex; std::atomic_bool g_isLaunchInProgress = false; std::atomic_bool isUpdateCheckThreadRunning = false; +HANDLE g_terminateSettingsEvent = CreateEventW(nullptr, false, false, CommonSharedConstants::TERMINATE_SETTINGS_SHARED_EVENT); json::JsonObject get_power_toys_settings() { @@ -622,9 +624,11 @@ void close_settings_window() { if (g_settings_process_id != 0) { - wil::unique_handle proc{ OpenProcess(PROCESS_TERMINATE, false, g_settings_process_id) }; + SetEvent(g_terminateSettingsEvent); + wil::unique_handle proc{ OpenProcess(PROCESS_ALL_ACCESS, false, g_settings_process_id) }; if (proc) { + WaitForSingleObject(proc.get(), 1500); TerminateProcess(proc.get(), 0); } } diff --git a/src/runner/trace.cpp b/src/runner/trace.cpp index 8c0dd74b50..1c15092679 100644 --- a/src/runner/trace.cpp +++ b/src/runner/trace.cpp @@ -3,6 +3,8 @@ #include "general_settings.h" +#include + TRACELOGGING_DEFINE_PROVIDER( g_hProvider, "Microsoft.PowerToys", @@ -10,19 +12,9 @@ TRACELOGGING_DEFINE_PROVIDER( (0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74), TraceLoggingOptionProjectTelemetry()); -void Trace::RegisterProvider() -{ - TraceLoggingRegister(g_hProvider); -} - -void Trace::UnregisterProvider() -{ - TraceLoggingUnregister(g_hProvider); -} - void Trace::EventLaunch(const std::wstring& versionNumber, bool isProcessElevated) { - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "Runner_Launch", TraceLoggingWideString(versionNumber.c_str(), "Version"), @@ -48,7 +40,7 @@ void Trace::SettingsChanged(const GeneralSettings& settings) } } - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "GeneralSettingsChanged", TraceLoggingBoolean(settings.isStartupEnabled, "RunAtStartup"), diff --git a/src/runner/trace.h b/src/runner/trace.h index fe337723d7..3170fa665a 100644 --- a/src/runner/trace.h +++ b/src/runner/trace.h @@ -1,12 +1,12 @@ #pragma once +#include + struct GeneralSettings; -class Trace +class Trace : public telemetry::TraceBase { public: - static void RegisterProvider(); - static void UnregisterProvider(); static void EventLaunch(const std::wstring& versionNumber, bool isProcessElevated); static void SettingsChanged(const GeneralSettings& settings); }; diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteAdditionalAction.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteAdditionalAction.cs new file mode 100644 index 0000000000..7a6fd3081a --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteAdditionalAction.cs @@ -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.Text.Json.Serialization; + +using Microsoft.PowerToys.Settings.UI.Library.Helpers; + +namespace Microsoft.PowerToys.Settings.UI.Library; + +public sealed partial class AdvancedPasteAdditionalAction : Observable, IAdvancedPasteAction +{ + private HotkeySettings _shortcut = new(); + private bool _isShown = true; + + [JsonPropertyName("shortcut")] + public HotkeySettings Shortcut + { + get => _shortcut; + set + { + if (_shortcut != value) + { + // We null-coalesce here rather than outside this branch as we want to raise PropertyChanged when the setter is called + // with null; the ShortcutControl depends on this. + _shortcut = value ?? new(); + + OnPropertyChanged(); + } + } + } + + [JsonPropertyName("isShown")] + public bool IsShown + { + get => _isShown; + set => Set(ref _isShown, value); + } +} diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteAdditionalActions.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteAdditionalActions.cs new file mode 100644 index 0000000000..ce26962b02 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteAdditionalActions.cs @@ -0,0 +1,27 @@ +๏ปฟ// 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.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; + +namespace Microsoft.PowerToys.Settings.UI.Library; + +public sealed class AdvancedPasteAdditionalActions +{ + public static class PropertyNames + { + public const string ImageToText = "image-to-text"; + public const string PasteAsFile = "paste-as-file"; + } + + [JsonPropertyName(PropertyNames.ImageToText)] + public AdvancedPasteAdditionalAction ImageToText { get; init; } = new(); + + [JsonPropertyName(PropertyNames.PasteAsFile)] + public AdvancedPastePasteAsFileAction PasteAsFile { get; init; } = new(); + + [JsonIgnore] + public IEnumerable AllActions => new IAdvancedPasteAction[] { ImageToText, PasteAsFile }.Concat(PasteAsFile.SubActions); +} diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteCustomAction.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteCustomAction.cs index 585663026b..f3bb4431ca 100644 --- a/src/settings-ui/Settings.UI.Library/AdvancedPasteCustomAction.cs +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteCustomAction.cs @@ -3,14 +3,13 @@ // See the LICENSE file in the project root for more information. using System; -using System.ComponentModel; -using System.Runtime.CompilerServices; -using System.Text.Json; using System.Text.Json.Serialization; +using Microsoft.PowerToys.Settings.UI.Library.Helpers; + namespace Microsoft.PowerToys.Settings.UI.Library; -public sealed class AdvancedPasteCustomAction : INotifyPropertyChanged, ICloneable +public sealed class AdvancedPasteCustomAction : Observable, IAdvancedPasteAction, ICloneable { private int _id; private string _name = string.Empty; @@ -25,14 +24,7 @@ public sealed class AdvancedPasteCustomAction : INotifyPropertyChanged, ICloneab public int Id { get => _id; - set - { - if (_id != value) - { - _id = value; - OnPropertyChanged(); - } - } + set => Set(ref _id, value); } [JsonPropertyName("name")] @@ -41,10 +33,8 @@ public sealed class AdvancedPasteCustomAction : INotifyPropertyChanged, ICloneab get => _name; set { - if (_name != value) + if (Set(ref _name, value)) { - _name = value; - OnPropertyChanged(); UpdateIsValid(); } } @@ -56,10 +46,8 @@ public sealed class AdvancedPasteCustomAction : INotifyPropertyChanged, ICloneab get => _prompt; set { - if (_prompt != value) + if (Set(ref _prompt, value)) { - _prompt = value; - OnPropertyChanged(); UpdateIsValid(); } } @@ -86,62 +74,30 @@ public sealed class AdvancedPasteCustomAction : INotifyPropertyChanged, ICloneab public bool IsShown { get => _isShown; - set - { - if (_isShown != value) - { - _isShown = value; - OnPropertyChanged(); - } - } + set => Set(ref _isShown, value); } [JsonIgnore] public bool CanMoveUp { get => _canMoveUp; - set - { - if (_canMoveUp != value) - { - _canMoveUp = value; - OnPropertyChanged(); - } - } + set => Set(ref _canMoveUp, value); } [JsonIgnore] public bool CanMoveDown { get => _canMoveDown; - set - { - if (_canMoveDown != value) - { - _canMoveDown = value; - OnPropertyChanged(); - } - } + set => Set(ref _canMoveDown, value); } [JsonIgnore] public bool IsValid { get => _isValid; - private set - { - if (_isValid != value) - { - _isValid = value; - OnPropertyChanged(); - } - } + private set => Set(ref _isValid, value); } - public event PropertyChangedEventHandler PropertyChanged; - - public string ToJsonString() => JsonSerializer.Serialize(this); - public object Clone() { AdvancedPasteCustomAction clone = new(); @@ -160,11 +116,6 @@ public sealed class AdvancedPasteCustomAction : INotifyPropertyChanged, ICloneab CanMoveDown = other.CanMoveDown; } - private void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - private HotkeySettings GetShortcutClone() { object shortcut = null; diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPastePasteAsFileAction.cs b/src/settings-ui/Settings.UI.Library/AdvancedPastePasteAsFileAction.cs new file mode 100644 index 0000000000..979e967d4a --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/AdvancedPastePasteAsFileAction.cs @@ -0,0 +1,56 @@ +๏ปฟ// 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.Collections.Generic; +using System.Text.Json.Serialization; + +using Microsoft.PowerToys.Settings.UI.Library.Helpers; + +namespace Microsoft.PowerToys.Settings.UI.Library; + +public sealed class AdvancedPastePasteAsFileAction : Observable, IAdvancedPasteAction +{ + public static class PropertyNames + { + public const string PasteAsTxtFile = "paste-as-txt-file"; + public const string PasteAsPngFile = "paste-as-png-file"; + public const string PasteAsHtmlFile = "paste-as-html-file"; + } + + private AdvancedPasteAdditionalAction _pasteAsTxtFile = new(); + private AdvancedPasteAdditionalAction _pasteAsPngFile = new(); + private AdvancedPasteAdditionalAction _pasteAsHtmlFile = new(); + private bool _isShown = true; + + [JsonPropertyName("isShown")] + public bool IsShown + { + get => _isShown; + set => Set(ref _isShown, value); + } + + [JsonPropertyName(PropertyNames.PasteAsTxtFile)] + public AdvancedPasteAdditionalAction PasteAsTxtFile + { + get => _pasteAsTxtFile; + init => Set(ref _pasteAsTxtFile, value); + } + + [JsonPropertyName(PropertyNames.PasteAsPngFile)] + public AdvancedPasteAdditionalAction PasteAsPngFile + { + get => _pasteAsPngFile; + init => Set(ref _pasteAsPngFile, value); + } + + [JsonPropertyName(PropertyNames.PasteAsHtmlFile)] + public AdvancedPasteAdditionalAction PasteAsHtmlFile + { + get => _pasteAsHtmlFile; + init => Set(ref _pasteAsHtmlFile, value); + } + + [JsonIgnore] + public IEnumerable SubActions => [PasteAsTxtFile, PasteAsPngFile, PasteAsHtmlFile]; +} diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs index 8e6ebb8238..8322302ddf 100644 --- a/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs @@ -22,6 +22,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library PasteAsMarkdownShortcut = new(); PasteAsJsonShortcut = new(); CustomActions = new(); + AdditionalActions = new(); ShowCustomPreview = true; SendPasteKeyCombination = true; CloseAfterLosingFocus = false; @@ -51,7 +52,11 @@ namespace Microsoft.PowerToys.Settings.UI.Library [JsonPropertyName("custom-actions")] [CmdConfigureIgnoreAttribute] - public AdvancedPasteCustomActions CustomActions { get; set; } + public AdvancedPasteCustomActions CustomActions { get; init; } + + [JsonPropertyName("additional-actions")] + [CmdConfigureIgnoreAttribute] + public AdvancedPasteAdditionalActions AdditionalActions { get; init; } public override string ToString() => JsonSerializer.Serialize(this); diff --git a/src/settings-ui/Settings.UI.Library/EnabledModules.cs b/src/settings-ui/Settings.UI.Library/EnabledModules.cs index ebf70464d5..604b4c46ab 100644 --- a/src/settings-ui/Settings.UI.Library/EnabledModules.cs +++ b/src/settings-ui/Settings.UI.Library/EnabledModules.cs @@ -6,6 +6,7 @@ using System; using System.Runtime.CompilerServices; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.Telemetry; using Microsoft.PowerToys.Telemetry; diff --git a/src/settings-ui/Settings.UI.Library/EnvironmentVariablesProperties.cs b/src/settings-ui/Settings.UI.Library/EnvironmentVariablesProperties.cs index 2d2b93d95f..9319741de0 100644 --- a/src/settings-ui/Settings.UI.Library/EnvironmentVariablesProperties.cs +++ b/src/settings-ui/Settings.UI.Library/EnvironmentVariablesProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Enumerations; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs b/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs index dfa79a537b..d54641e977 100644 --- a/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs +++ b/src/settings-ui/Settings.UI.Library/EnvironmentVariablesSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/FZConfigProperties.cs b/src/settings-ui/Settings.UI.Library/FZConfigProperties.cs index 51a0269523..9150cdbe90 100644 --- a/src/settings-ui/Settings.UI.Library/FZConfigProperties.cs +++ b/src/settings-ui/Settings.UI.Library/FZConfigProperties.cs @@ -4,6 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/FancyZonesSettings.cs b/src/settings-ui/Settings.UI.Library/FancyZonesSettings.cs index bff72a5984..817b128aa4 100644 --- a/src/settings-ui/Settings.UI.Library/FancyZonesSettings.cs +++ b/src/settings-ui/Settings.UI.Library/FancyZonesSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs b/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs index f998e5b4dd..747baf6dff 100644 --- a/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs +++ b/src/settings-ui/Settings.UI.Library/FileLocksmithLocalProperties.cs @@ -4,6 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs b/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs index 683746392f..30ee899173 100644 --- a/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs +++ b/src/settings-ui/Settings.UI.Library/FileLocksmithSettings.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs b/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs index 64ca0457aa..a028eb9e43 100644 --- a/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs +++ b/src/settings-ui/Settings.UI.Library/FindMyMouseProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs b/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs index 921bd62992..aca45d0b01 100644 --- a/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs +++ b/src/settings-ui/Settings.UI.Library/FindMyMouseSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/GeneralSettings.cs b/src/settings-ui/Settings.UI.Library/GeneralSettings.cs index 6873b1962a..ed7b503150 100644 --- a/src/settings-ui/Settings.UI.Library/GeneralSettings.cs +++ b/src/settings-ui/Settings.UI.Library/GeneralSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.PowerToys.Settings.UI.Library.Utilities; diff --git a/src/settings-ui/Settings.UI.Library/Helpers/ColorNameHelper.cs b/src/settings-ui/Settings.UI.Library/Helpers/ColorNameHelper.cs index 02c944385f..6d00db0b28 100644 --- a/src/settings-ui/Settings.UI.Library/Helpers/ColorNameHelper.cs +++ b/src/settings-ui/Settings.UI.Library/Helpers/ColorNameHelper.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Drawing; + using global::Settings.UI.Library.Resources; using ManagedCommon; diff --git a/src/settings-ui/Settings.UI.Library/Helpers/Observable.cs b/src/settings-ui/Settings.UI.Library/Helpers/Observable.cs index a77099b4b8..79b4e9d2ee 100644 --- a/src/settings-ui/Settings.UI.Library/Helpers/Observable.cs +++ b/src/settings-ui/Settings.UI.Library/Helpers/Observable.cs @@ -11,17 +11,19 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Helpers { public event PropertyChangedEventHandler PropertyChanged; - protected void Set(ref T storage, T value, [CallerMemberName] string propertyName = null) + protected bool Set(ref T storage, T value, [CallerMemberName] string propertyName = null) { if (Equals(storage, value)) { - return; + return false; } storage = value; OnPropertyChanged(propertyName); + + return true; } - protected void OnPropertyChanged(string propertyName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + protected void OnPropertyChanged([CallerMemberName] string propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } diff --git a/src/settings-ui/Settings.UI.Library/HostsProperties.cs b/src/settings-ui/Settings.UI.Library/HostsProperties.cs index ea05a34400..90a576601d 100644 --- a/src/settings-ui/Settings.UI.Library/HostsProperties.cs +++ b/src/settings-ui/Settings.UI.Library/HostsProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; using Settings.UI.Library.Enumerations; diff --git a/src/settings-ui/Settings.UI.Library/HostsSettings.cs b/src/settings-ui/Settings.UI.Library/HostsSettings.cs index 5e15a7e664..bb339f178c 100644 --- a/src/settings-ui/Settings.UI.Library/HostsSettings.cs +++ b/src/settings-ui/Settings.UI.Library/HostsSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/HotkeySettings.cs b/src/settings-ui/Settings.UI.Library/HotkeySettings.cs index 38018f59d1..ff588eafbd 100644 --- a/src/settings-ui/Settings.UI.Library/HotkeySettings.cs +++ b/src/settings-ui/Settings.UI.Library/HotkeySettings.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Globalization; using System.Text; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Utilities; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/HotkeySettingsControlHook.cs b/src/settings-ui/Settings.UI.Library/HotkeySettingsControlHook.cs index cc932b3584..0ff67df638 100644 --- a/src/settings-ui/Settings.UI.Library/HotkeySettingsControlHook.cs +++ b/src/settings-ui/Settings.UI.Library/HotkeySettingsControlHook.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using PowerToys.Interop; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/IAdvancedPasteAction.cs b/src/settings-ui/Settings.UI.Library/IAdvancedPasteAction.cs new file mode 100644 index 0000000000..4c31557010 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/IAdvancedPasteAction.cs @@ -0,0 +1,12 @@ +๏ปฟ// 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.ComponentModel; + +namespace Microsoft.PowerToys.Settings.UI.Library; + +public interface IAdvancedPasteAction : INotifyPropertyChanged +{ + public bool IsShown { get; } +} diff --git a/src/settings-ui/Settings.UI.Library/ISettingsUtils.cs b/src/settings-ui/Settings.UI.Library/ISettingsUtils.cs index a6f340e83c..10e8bf26ac 100644 --- a/src/settings-ui/Settings.UI.Library/ISettingsUtils.cs +++ b/src/settings-ui/Settings.UI.Library/ISettingsUtils.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/ImageResizerProperties.cs b/src/settings-ui/Settings.UI.Library/ImageResizerProperties.cs index 8d57055881..acef5a2f4d 100644 --- a/src/settings-ui/Settings.UI.Library/ImageResizerProperties.cs +++ b/src/settings-ui/Settings.UI.Library/ImageResizerProperties.cs @@ -6,6 +6,7 @@ using System; using System.Collections.ObjectModel; using System.Text.Json; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/ImageResizerSettings.cs b/src/settings-ui/Settings.UI.Library/ImageResizerSettings.cs index f43c76ba70..97f785d6c2 100644 --- a/src/settings-ui/Settings.UI.Library/ImageResizerSettings.cs +++ b/src/settings-ui/Settings.UI.Library/ImageResizerSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/KeyboardManagerProfile.cs b/src/settings-ui/Settings.UI.Library/KeyboardManagerProfile.cs index f47b1f0ded..983f9a1f6a 100644 --- a/src/settings-ui/Settings.UI.Library/KeyboardManagerProfile.cs +++ b/src/settings-ui/Settings.UI.Library/KeyboardManagerProfile.cs @@ -4,6 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/KeyboardManagerProperties.cs b/src/settings-ui/Settings.UI.Library/KeyboardManagerProperties.cs index 86ab049f7c..25a84dbb2c 100644 --- a/src/settings-ui/Settings.UI.Library/KeyboardManagerProperties.cs +++ b/src/settings-ui/Settings.UI.Library/KeyboardManagerProperties.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/KeyboardManagerSettings.cs b/src/settings-ui/Settings.UI.Library/KeyboardManagerSettings.cs index a52fdceea2..5682d6d865 100644 --- a/src/settings-ui/Settings.UI.Library/KeyboardManagerSettings.cs +++ b/src/settings-ui/Settings.UI.Library/KeyboardManagerSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/KeysDataModel.cs b/src/settings-ui/Settings.UI.Library/KeysDataModel.cs index 5788aad96b..1232d384b8 100644 --- a/src/settings-ui/Settings.UI.Library/KeysDataModel.cs +++ b/src/settings-ui/Settings.UI.Library/KeysDataModel.cs @@ -14,6 +14,7 @@ using System.Text.Json; using System.Text.Json.Serialization; using System.Threading; using System.Windows.Input; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands; diff --git a/src/settings-ui/Settings.UI.Library/LanguageModel.cs b/src/settings-ui/Settings.UI.Library/LanguageModel.cs index 1e9ef82ec6..63652aba73 100644 --- a/src/settings-ui/Settings.UI.Library/LanguageModel.cs +++ b/src/settings-ui/Settings.UI.Library/LanguageModel.cs @@ -30,7 +30,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library { try { - Stream inputStream = fileSystem.File.Open(file, FileMode.Open); + FileSystemStream inputStream = fileSystem.File.Open(file, FileMode.Open); StreamReader reader = new StreamReader(inputStream); string data = reader.ReadToEnd(); inputStream.Close(); diff --git a/src/settings-ui/Settings.UI.Library/MeasureToolProperties.cs b/src/settings-ui/Settings.UI.Library/MeasureToolProperties.cs index 97a0c3219a..ebda5953d0 100644 --- a/src/settings-ui/Settings.UI.Library/MeasureToolProperties.cs +++ b/src/settings-ui/Settings.UI.Library/MeasureToolProperties.cs @@ -4,6 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; using Settings.UI.Library.Enumerations; diff --git a/src/settings-ui/Settings.UI.Library/MeasureToolSettings.cs b/src/settings-ui/Settings.UI.Library/MeasureToolSettings.cs index 65275ba6ce..5720c70ca5 100644 --- a/src/settings-ui/Settings.UI.Library/MeasureToolSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MeasureToolSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/MouseHighlighterProperties.cs b/src/settings-ui/Settings.UI.Library/MouseHighlighterProperties.cs index bb847c2e30..298b0d9230 100644 --- a/src/settings-ui/Settings.UI.Library/MouseHighlighterProperties.cs +++ b/src/settings-ui/Settings.UI.Library/MouseHighlighterProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/MouseHighlighterSettings.cs b/src/settings-ui/Settings.UI.Library/MouseHighlighterSettings.cs index b677ee2175..e23a7fe288 100644 --- a/src/settings-ui/Settings.UI.Library/MouseHighlighterSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MouseHighlighterSettings.cs @@ -5,6 +5,7 @@ using System.Globalization; using System.Runtime.InteropServices; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/MouseJumpProperties.cs b/src/settings-ui/Settings.UI.Library/MouseJumpProperties.cs index c24d949dc1..33bad29bd9 100644 --- a/src/settings-ui/Settings.UI.Library/MouseJumpProperties.cs +++ b/src/settings-ui/Settings.UI.Library/MouseJumpProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library @@ -13,10 +14,113 @@ namespace Microsoft.PowerToys.Settings.UI.Library public HotkeySettings DefaultActivationShortcut => new HotkeySettings(true, false, false, true, 0x44); [JsonPropertyName("activation_shortcut")] - public HotkeySettings ActivationShortcut { get; set; } + public HotkeySettings ActivationShortcut + { + get; + set; + } [JsonPropertyName("thumbnail_size")] - public MouseJumpThumbnailSize ThumbnailSize { get; set; } + public MouseJumpThumbnailSize ThumbnailSize + { + get; + set; + } + + /// + /// Gets or sets the preview type. + /// Allowed values are "compact", "bezelled", "custom" + /// + [JsonPropertyName("preview_type")] + public string PreviewType + { + get; + set; + } + + [JsonPropertyName("background_color_1")] + public string BackgroundColor1 + { + get; + set; + } + + [JsonPropertyName("background_color_2")] + public string BackgroundColor2 + { + get; + set; + } + + [JsonPropertyName("border_thickness")] + public int BorderThickness + { + get; + set; + } + + [JsonPropertyName("border_color")] + public string BorderColor + { + get; + set; + } + + [JsonPropertyName("border_3d_depth")] + public int Border3dDepth + { + get; + set; + } + + [JsonPropertyName("border_padding")] + public int BorderPadding + { + get; + set; + } + + [JsonPropertyName("bezel_thickness")] + public int BezelThickness + { + get; + set; + } + + [JsonPropertyName("bezel_color")] + public string BezelColor + { + get; + set; + } + + [JsonPropertyName("bezel_3d_depth")] + public int Bezel3dDepth + { + get; + set; + } + + [JsonPropertyName("screen_margin")] + public int ScreenMargin + { + get; + set; + } + + [JsonPropertyName("screen_color_1")] + public string ScreenColor1 + { + get; + set; + } + + [JsonPropertyName("screen_color_2")] + public string ScreenColor2 + { + get; + set; + } public MouseJumpProperties() { diff --git a/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs b/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs index 596e6cd91b..450e6aec93 100644 --- a/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MouseJumpSettings.cs @@ -5,7 +5,10 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; +using MouseJump.Common.Helpers; +using MouseJump.Common.Models.Settings; namespace Microsoft.PowerToys.Settings.UI.Library { @@ -25,7 +28,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library { Name = ModuleName; Properties = new MouseJumpProperties(); - Version = "1.0"; + Version = "1.1"; } public void Save(ISettingsUtils settingsUtils) @@ -46,7 +49,74 @@ namespace Microsoft.PowerToys.Settings.UI.Library // This can be utilized in the future if the settings.json file is to be modified/deleted. public bool UpgradeSettingsConfiguration() { - return false; + /* + v1.0 - initial version + + * DefaultActivationShortcut + * activation_shortcut + * thumbnail_size + * name + * version + */ + var upgraded = false; + + if (this.Version == "1.0") + { + /* + v1.1 - added preview style settings + + * preview_type + * background_color_1 + * background_color_2 + * border_thickness + * border_color + * border_3d_depth + * border_padding + * bezel_thickness + * bezel_color + * bezel_3d_depth + * screen_margin + * screen_color_1 + * screen_color_2 + */ + this.Version = "1.1"; + + // note - there's an issue where ITwoWayPipeMessageIPCManagedMethods.Send overwrites + // the settings file version as "1.0" regardless of the actual version. as a result, + // the UpgradeSettingsConfiguration can get triggered even if the config has already + // been upgraded, so we need to do an additional check to make sure values haven't + // already been upgraded before we overwrite them with default values. + if (string.IsNullOrEmpty(this.Properties.PreviewType)) + { + // set default values for custom preview style + var previewStyle = StyleHelper.BezelledPreviewStyle; + this.Properties.PreviewType = PreviewType.Bezelled.ToString(); + this.Properties.BackgroundColor1 = ConfigHelper.SerializeToConfigColorString( + ConfigHelper.ToUnnamedColor(previewStyle.CanvasStyle.BackgroundStyle.Color1)); + this.Properties.BackgroundColor2 = ConfigHelper.SerializeToConfigColorString( + ConfigHelper.ToUnnamedColor(previewStyle.CanvasStyle.BackgroundStyle.Color2)); + this.Properties.BorderThickness = (int)previewStyle.CanvasStyle.BorderStyle.Top; + this.Properties.BorderColor = ConfigHelper.SerializeToConfigColorString( + ConfigHelper.ToUnnamedColor(previewStyle.CanvasStyle.BorderStyle.Color)); + this.Properties.Border3dDepth = (int)previewStyle.CanvasStyle.BorderStyle.Depth; + this.Properties.BorderPadding = (int)previewStyle.CanvasStyle.PaddingStyle.Top; + this.Properties.BezelThickness = (int)previewStyle.ScreenStyle.BorderStyle.Top; + this.Properties.BezelColor = ConfigHelper.SerializeToConfigColorString( + ConfigHelper.ToUnnamedColor(previewStyle.ScreenStyle.BorderStyle.Color)); + this.Properties.Bezel3dDepth = (int)previewStyle.ScreenStyle.BorderStyle.Depth; + this.Properties.ScreenMargin = (int)previewStyle.ScreenStyle.MarginStyle.Top; + this.Properties.ScreenColor1 = ConfigHelper.SerializeToConfigColorString( + ConfigHelper.ToUnnamedColor(previewStyle.ScreenStyle.BackgroundStyle.Color1)); + this.Properties.ScreenColor2 = ConfigHelper.SerializeToConfigColorString( + ConfigHelper.ToUnnamedColor(previewStyle.ScreenStyle.BackgroundStyle.Color2)); + } + + // we still need to flag the settings as "upgraded" so that the new version gets written + // back to the config file, even if we didn't actually change and setting values + upgraded = true; + } + + return upgraded; } } } diff --git a/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsProperties.cs b/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsProperties.cs index 46c9e4fe03..9b0e530a2a 100644 --- a/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsProperties.cs +++ b/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsSettings.cs b/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsSettings.cs index 7c1f253271..2658a2adec 100644 --- a/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MousePointerCrosshairsSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs index 5bf4ae53de..265b8a1e2d 100644 --- a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs +++ b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersProperties.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs index f030d98bf1..6a51a150e5 100644 --- a/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs +++ b/src/settings-ui/Settings.UI.Library/MouseWithoutBordersSettings.cs @@ -6,6 +6,7 @@ using System; using System.Diagnostics; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/NewPlusProperties.cs b/src/settings-ui/Settings.UI.Library/NewPlusProperties.cs new file mode 100644 index 0000000000..2a4970c690 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/NewPlusProperties.cs @@ -0,0 +1,34 @@ +๏ปฟ// 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.IO; +using System.Text.Json; +using System.Text.Json.Serialization; + +namespace Microsoft.PowerToys.Settings.UI.Library +{ + public class NewPlusProperties + { + public const string ModuleName = "NewPlus"; + + public NewPlusProperties() + { + HideFileExtension = new BoolProperty(true); + HideStartingDigits = new BoolProperty(true); + TemplateLocation = new StringProperty(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "NewPlus", "Templates")); + } + + [JsonPropertyName("HideFileExtension")] + public BoolProperty HideFileExtension { get; set; } + + [JsonPropertyName("HideStartingDigits")] + public BoolProperty HideStartingDigits { get; set; } + + [JsonPropertyName("TemplateLocation")] + public StringProperty TemplateLocation { get; set; } + + public override string ToString() => JsonSerializer.Serialize(this); + } +} diff --git a/src/settings-ui/Settings.UI.Library/NewPlusSettings.cs b/src/settings-ui/Settings.UI.Library/NewPlusSettings.cs index 6010185f8c..7a37c72a84 100644 --- a/src/settings-ui/Settings.UI.Library/NewPlusSettings.cs +++ b/src/settings-ui/Settings.UI.Library/NewPlusSettings.cs @@ -7,39 +7,33 @@ using System.Globalization; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Settings.UI.Library.Resources; namespace Microsoft.PowerToys.Settings.UI.Library { - public class NewPlusSettings : ISettingsConfig + public class NewPlusSettings : BasePTModuleSettings, ISettingsConfig { public const string ModuleName = "NewPlus"; + public const string ModuleVersion = "1.0"; - public void InitializeWithDefaultSettings() + [JsonPropertyName("properties")] + public NewPlusProperties Properties { get; set; } + + public NewPlusSettings() { - // This code path should never happen + Name = ModuleName; + Version = ModuleVersion; + Properties = new NewPlusProperties(); } - public string ToJsonString() - { - return JsonSerializer.Serialize(this); - } - - [JsonPropertyName("HideFileExtension")] - public bool HideFileExtension { get; set; } - - [JsonPropertyName("HideStartingDigits")] - public bool HideStartingDigits { get; set; } - - [JsonPropertyName("TemplateLocation")] - public string TemplateLocation { get; set; } - public string GetModuleName() { - return ModuleName; + return Name; } + // This can be utilized in the future if the settings.json file is to be modified/deleted. public bool UpgradeSettingsConfiguration() { return false; diff --git a/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs b/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs index 75562ca9a2..f098b18052 100644 --- a/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PeekPreviewSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; diff --git a/src/settings-ui/Settings.UI.Library/PeekProperties.cs b/src/settings-ui/Settings.UI.Library/PeekProperties.cs index 6932177df1..1e4514d866 100644 --- a/src/settings-ui/Settings.UI.Library/PeekProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PeekProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PeekSettings.cs b/src/settings-ui/Settings.UI.Library/PeekSettings.cs index 3302f15c64..f5ad2a0e26 100644 --- a/src/settings-ui/Settings.UI.Library/PeekSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PeekSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerAccentLanguageGroupModel.cs b/src/settings-ui/Settings.UI.Library/PowerAccentLanguageGroupModel.cs new file mode 100644 index 0000000000..8033782bd7 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/PowerAccentLanguageGroupModel.cs @@ -0,0 +1,19 @@ +๏ปฟ// 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.Collections.Generic; + +namespace Microsoft.PowerToys.Settings.UI.Library +{ + public class PowerAccentLanguageGroupModel : List + { + public PowerAccentLanguageGroupModel(List languages, string group) + : base(languages) + { + this.Group = group; + } + + public string Group { get; init; } + } +} diff --git a/src/settings-ui/Settings.UI.Library/PowerAccentLanguageModel.cs b/src/settings-ui/Settings.UI.Library/PowerAccentLanguageModel.cs new file mode 100644 index 0000000000..13de2ac653 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/PowerAccentLanguageModel.cs @@ -0,0 +1,11 @@ +๏ปฟ// 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. + +namespace Microsoft.PowerToys.Settings.UI.Library +{ + public record PowerAccentLanguageModel(string LanguageCode, string LanguageResourceID, string GroupResourceID) + { + public string Language { get; set; } + } +} diff --git a/src/settings-ui/Settings.UI.Library/PowerAccentProperties.cs b/src/settings-ui/Settings.UI.Library/PowerAccentProperties.cs index f471f51c13..4ab0b955c7 100644 --- a/src/settings-ui/Settings.UI.Library/PowerAccentProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerAccentProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Enumerations; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerAccentSettings.cs b/src/settings-ui/Settings.UI.Library/PowerAccentSettings.cs index 6302fd5058..f080dcb093 100644 --- a/src/settings-ui/Settings.UI.Library/PowerAccentSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerAccentSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerLauncherProperties.cs b/src/settings-ui/Settings.UI.Library/PowerLauncherProperties.cs index efe7e1e446..590fb2e290 100644 --- a/src/settings-ui/Settings.UI.Library/PowerLauncherProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerLauncherProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using ManagedCommon; using Settings.UI.Library.Attributes; diff --git a/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs b/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs index 4c7ad70e0c..c21ce67df5 100644 --- a/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerLauncherSettings.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerOcrProperties.cs b/src/settings-ui/Settings.UI.Library/PowerOcrProperties.cs index 0ea4fcca54..5cba3cfb3e 100644 --- a/src/settings-ui/Settings.UI.Library/PowerOcrProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerOcrProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs b/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs index 9bf9db87d6..46d176d2b0 100644 --- a/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerOcrSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs index 1c09438b61..28d76dd067 100644 --- a/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerPreviewProperties.cs @@ -5,6 +5,7 @@ using System.Runtime.CompilerServices; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.Telemetry; using Microsoft.PowerToys.Telemetry; using Settings.UI.Library.Enumerations; diff --git a/src/settings-ui/Settings.UI.Library/PowerPreviewSettings.cs b/src/settings-ui/Settings.UI.Library/PowerPreviewSettings.cs index 5cdb94b923..ba0ac30bb3 100644 --- a/src/settings-ui/Settings.UI.Library/PowerPreviewSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerPreviewSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerRenameLocalProperties.cs b/src/settings-ui/Settings.UI.Library/PowerRenameLocalProperties.cs index 5812b2a082..726faf2bc0 100644 --- a/src/settings-ui/Settings.UI.Library/PowerRenameLocalProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerRenameLocalProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerRenameProperties.cs b/src/settings-ui/Settings.UI.Library/PowerRenameProperties.cs index dfe27855ec..dcc10a7bdc 100644 --- a/src/settings-ui/Settings.UI.Library/PowerRenameProperties.cs +++ b/src/settings-ui/Settings.UI.Library/PowerRenameProperties.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs b/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs index 39c20a3af1..50bc8cdfe3 100644 --- a/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs +++ b/src/settings-ui/Settings.UI.Library/PowerRenameSettings.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/RegistryPreviewSettings.cs b/src/settings-ui/Settings.UI.Library/RegistryPreviewSettings.cs index d7dab39ef5..6d9179aba7 100644 --- a/src/settings-ui/Settings.UI.Library/RegistryPreviewSettings.cs +++ b/src/settings-ui/Settings.UI.Library/RegistryPreviewSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/SettingPath.cs b/src/settings-ui/Settings.UI.Library/SettingPath.cs index 3768db9976..94c5d83ca1 100644 --- a/src/settings-ui/Settings.UI.Library/SettingPath.cs +++ b/src/settings-ui/Settings.UI.Library/SettingPath.cs @@ -4,6 +4,7 @@ using System; using System.IO.Abstractions; + using Microsoft.PowerToys.Settings.UI.Library.Utilities; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj index 37e239ed3b..a967dd28a7 100644 --- a/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj +++ b/src/settings-ui/Settings.UI.Library/Settings.UI.Library.csproj @@ -21,6 +21,7 @@ + diff --git a/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs b/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs index 98be5a6288..4b79045483 100644 --- a/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs +++ b/src/settings-ui/Settings.UI.Library/SettingsBackupAndRestoreUtils.cs @@ -15,6 +15,7 @@ using System.Text.Json; using System.Text.Json.Nodes; using System.Text.RegularExpressions; using System.Threading; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library.Utilities; @@ -24,8 +25,8 @@ namespace Microsoft.PowerToys.Settings.UI.Library { private static SettingsBackupAndRestoreUtils instance; private (bool Success, string Severity, bool LastBackupExists, DateTime? LastRan) lastBackupSettingsResults; - private static object backupSettingsInternalLock = new object(); - private static object removeOldBackupsLock = new object(); + private static Lock backupSettingsInternalLock = new Lock(); + private static Lock removeOldBackupsLock = new Lock(); public DateTime LastBackupStartTime { get; set; } @@ -932,7 +933,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library /// private static void RemoveOldBackups(string location, int minNumberToKeep, TimeSpan deleteIfOlderThanTs) { - if (!Monitor.TryEnter(removeOldBackupsLock, 1000)) + if (!removeOldBackupsLock.TryEnter(1000)) { return; } @@ -1001,7 +1002,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library } finally { - Monitor.Exit(removeOldBackupsLock); + removeOldBackupsLock.Exit(); } } diff --git a/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs b/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs index b9d27dedb9..136b92b63a 100644 --- a/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs +++ b/src/settings-ui/Settings.UI.Library/SettingsRepository`1.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System; +using System.Threading; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library @@ -12,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library public class SettingsRepository : ISettingsRepository where T : class, ISettingsConfig, new() { - private static readonly object _SettingsRepoLock = new object(); + private static readonly Lock _SettingsRepoLock = new Lock(); private static ISettingsUtils _settingsUtils; diff --git a/src/settings-ui/Settings.UI.Library/SettingsUtils.cs b/src/settings-ui/Settings.UI.Library/SettingsUtils.cs index 30002d956e..2c41850201 100644 --- a/src/settings-ui/Settings.UI.Library/SettingsUtils.cs +++ b/src/settings-ui/Settings.UI.Library/SettingsUtils.cs @@ -6,6 +6,7 @@ using System; using System.IO; using System.IO.Abstractions; using System.Text.Json; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; @@ -13,7 +14,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library { public class SettingsUtils : ISettingsUtils { - private const string DefaultFileName = "settings.json"; + public const string DefaultFileName = "settings.json"; private const string DefaultModuleName = ""; private readonly IFile _file; private readonly ISettingsPath _settingsPath; diff --git a/src/settings-ui/Settings.UI.Library/ShortcutGuideProperties.cs b/src/settings-ui/Settings.UI.Library/ShortcutGuideProperties.cs index b84fe8b0ae..d34a2f748a 100644 --- a/src/settings-ui/Settings.UI.Library/ShortcutGuideProperties.cs +++ b/src/settings-ui/Settings.UI.Library/ShortcutGuideProperties.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/ShortcutGuideSettings.cs b/src/settings-ui/Settings.UI.Library/ShortcutGuideSettings.cs index 174aa4e217..c39e757fe3 100644 --- a/src/settings-ui/Settings.UI.Library/ShortcutGuideSettings.cs +++ b/src/settings-ui/Settings.UI.Library/ShortcutGuideSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundInstallEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundInstallEvent.cs index 97d700a8e5..6af5444174 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundInstallEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundInstallEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundUninstallEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundUninstallEvent.cs index ae469903ee..36f90bcfd7 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundUninstallEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/CmdNotFoundUninstallEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeModuleRunEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeModuleRunEvent.cs index 4b0721d410..b6316cd2db 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeModuleRunEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeModuleRunEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSectionEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSectionEvent.cs index bb3265773d..4d762220c3 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSectionEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSectionEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSettingsEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSettingsEvent.cs index f0e7293ed3..499a1b98b3 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSettingsEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeSettingsEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeStartedEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeStartedEvent.cs index 771cdfc402..8912ea3156 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeStartedEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeStartedEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeVariantAssignmentEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeVariantAssignmentEvent.cs index 8f17b58dc3..d4a30550eb 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeVariantAssignmentEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/OobeVariantAssignmentEvent.cs @@ -4,6 +4,7 @@ using System; using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/ScoobeStartedEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/ScoobeStartedEvent.cs index 63b1bf48e2..f8f6c10c41 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/ScoobeStartedEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/ScoobeStartedEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsBootEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsBootEvent.cs index 376ae6f16a..edb989199f 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsBootEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsBootEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsEnabledEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsEnabledEvent.cs index 5cf0ea697a..7abfc8e2c2 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsEnabledEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/SettingsEnabledEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutActivatedEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutActivatedEvent.cs index 8e075aea0c..91600660e4 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutActivatedEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutActivatedEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutModuleRunEvent.cs b/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutModuleRunEvent.cs index c1813e9adb..167cf48dfb 100644 --- a/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutModuleRunEvent.cs +++ b/src/settings-ui/Settings.UI.Library/Telemetry/Events/TrayFlyoutModuleRunEvent.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics.Tracing; + using Microsoft.PowerToys.Telemetry; using Microsoft.PowerToys.Telemetry.Events; diff --git a/src/settings-ui/Settings.UI.Library/UpdatingSettings.cs b/src/settings-ui/Settings.UI.Library/UpdatingSettings.cs index 16e9e50ab7..b5244bbc00 100644 --- a/src/settings-ui/Settings.UI.Library/UpdatingSettings.cs +++ b/src/settings-ui/Settings.UI.Library/UpdatingSettings.cs @@ -102,7 +102,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library { try { - Stream inputStream = fileSystem.File.Open(file, FileMode.Open); + FileSystemStream inputStream = fileSystem.File.Open(file, FileMode.Open); StreamReader reader = new StreamReader(inputStream); string data = reader.ReadToEnd(); inputStream.Close(); diff --git a/src/settings-ui/Settings.UI.Library/Utilities/CommandLineUtils.cs b/src/settings-ui/Settings.UI.Library/Utilities/CommandLineUtils.cs index 91703a69c6..a7702e17a2 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/CommandLineUtils.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/CommandLineUtils.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using System.Reflection; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI.Library/Utilities/GetSettingCommandLineCommand.cs b/src/settings-ui/Settings.UI.Library/Utilities/GetSettingCommandLineCommand.cs index e74469795e..a4ad1d1862 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/GetSettingCommandLineCommand.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/GetSettingCommandLineCommand.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Globalization; using System.Text.Json; using System.Xml; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Settings.UI.Library.Attributes; diff --git a/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs b/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs index 3b0f377810..58d1f5f469 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/Helper.cs @@ -7,8 +7,8 @@ using System.Diagnostics; using System.IO; using System.IO.Abstractions; using System.Linq; -using System.Net.NetworkInformation; using System.Security.Principal; + using Microsoft.PowerToys.Settings.UI.Library.CustomAction; namespace Microsoft.PowerToys.Settings.UI.Library.Utilities @@ -62,7 +62,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities FileSystem.Directory.CreateDirectory(path); } - var watcher = FileSystem.FileSystemWatcher.CreateNew(); + var watcher = FileSystem.FileSystemWatcher.New(); watcher.Path = path; watcher.Filter = fileName; watcher.NotifyFilter = NotifyFilters.LastWrite; diff --git a/src/settings-ui/Settings.UI.Library/Utilities/SetAdditionalSettingsCommandLineCommand.cs b/src/settings-ui/Settings.UI.Library/Utilities/SetAdditionalSettingsCommandLineCommand.cs index 122dccfd4b..29f47a4347 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/SetAdditionalSettingsCommandLineCommand.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/SetAdditionalSettingsCommandLineCommand.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Reflection; using System.Text.Json; using System.Text.Json.Nodes; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI.Library/Utilities/SetSettingCommandLineCommand.cs b/src/settings-ui/Settings.UI.Library/Utilities/SetSettingCommandLineCommand.cs index 1e839a17c8..ab5a88c5d8 100644 --- a/src/settings-ui/Settings.UI.Library/Utilities/SetSettingCommandLineCommand.cs +++ b/src/settings-ui/Settings.UI.Library/Utilities/SetSettingCommandLineCommand.cs @@ -4,6 +4,7 @@ using System; using System.Reflection; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI.Library/VideoConferenceConfigProperties.cs b/src/settings-ui/Settings.UI.Library/VideoConferenceConfigProperties.cs index c1df38908e..9c7b33f804 100644 --- a/src/settings-ui/Settings.UI.Library/VideoConferenceConfigProperties.cs +++ b/src/settings-ui/Settings.UI.Library/VideoConferenceConfigProperties.cs @@ -4,6 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; + using Settings.UI.Library.Attributes; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/VideoConferenceSettings.cs b/src/settings-ui/Settings.UI.Library/VideoConferenceSettings.cs index 80ead8732e..c33bcdaaa6 100644 --- a/src/settings-ui/Settings.UI.Library/VideoConferenceSettings.cs +++ b/src/settings-ui/Settings.UI.Library/VideoConferenceSettings.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.Library/WorkspacesSettings.cs b/src/settings-ui/Settings.UI.Library/WorkspacesSettings.cs index 00709e418c..1e3ce2261e 100644 --- a/src/settings-ui/Settings.UI.Library/WorkspacesSettings.cs +++ b/src/settings-ui/Settings.UI.Library/WorkspacesSettings.cs @@ -5,6 +5,7 @@ using System; using System.Text.Json; using System.Text.Json.Serialization; + using Microsoft.PowerToys.Settings.UI.Library.Interfaces; namespace Microsoft.PowerToys.Settings.UI.Library diff --git a/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs b/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs index b1c03a5d89..b2048fa573 100644 --- a/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs +++ b/src/settings-ui/Settings.UI.UnitTests/BackwardsCompatibility/BackCompatTestProperties.cs @@ -7,6 +7,7 @@ using System.Globalization; using System.IO.Abstractions; using System.Linq.Expressions; using System.Text; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI.UnitTests/Cmd/SetSettingCommandTests.cs b/src/settings-ui/Settings.UI.UnitTests/Cmd/SetSettingCommandTests.cs index 572682854e..4c6d1babfd 100644 --- a/src/settings-ui/Settings.UI.UnitTests/Cmd/SetSettingCommandTests.cs +++ b/src/settings-ui/Settings.UI.UnitTests/Cmd/SetSettingCommandTests.cs @@ -4,6 +4,7 @@ using System; using System.IO.Abstractions.TestingHelpers; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/settings-ui/Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs b/src/settings-ui/Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs index 647e3670f3..b5e531d742 100644 --- a/src/settings-ui/Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs +++ b/src/settings-ui/Settings.UI.UnitTests/Mocks/IIOProviderMocks.cs @@ -5,6 +5,7 @@ using System; using System.IO.Abstractions; using System.Linq.Expressions; + using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Moq; diff --git a/src/settings-ui/Settings.UI.UnitTests/ModelsTests/HelperTest.cs b/src/settings-ui/Settings.UI.UnitTests/ModelsTests/HelperTest.cs index dd362e38da..aaa6e87d18 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ModelsTests/HelperTest.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ModelsTests/HelperTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/settings-ui/Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs b/src/settings-ui/Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs index 62e7f7b9af..9b75925cb8 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ModelsTests/SettingsUtilsTests.cs @@ -6,6 +6,7 @@ using System; using System.IO.Abstractions.TestingHelpers; using System.Linq; using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.PowerToys.Settings.UnitTest; diff --git a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj index 950cced18b..d3709d8fca 100644 --- a/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj +++ b/src/settings-ui/Settings.UI.UnitTests/Settings.UI.UnitTests.csproj @@ -16,14 +16,6 @@ - - - runtime - - - - runtime - diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ColorPicker.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ColorPicker.cs index 5fe20f3cda..baf46827c4 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ColorPicker.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ColorPicker.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/FancyZones.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/FancyZones.cs index 0239fbfd71..ef230bde0a 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/FancyZones.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/FancyZones.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/General.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/General.cs index 56da0a21bb..70bfbe4fba 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/General.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/General.cs @@ -3,12 +3,14 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; using Microsoft.PowerToys.Settings.UI.ViewModels; using Microsoft.VisualStudio.TestTools.UnitTesting; using Moq; + using JsonSerializer = System.Text.Json.JsonSerializer; namespace ViewModelTests diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs index 4bd392008c..1d2c62daec 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ImageResizer.cs @@ -6,6 +6,7 @@ using System; using System.IO.Abstractions.TestingHelpers; using System.Linq; using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/KeyboardManager.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/KeyboardManager.cs index 2234540f4f..89491b2b99 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/KeyboardManager.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/KeyboardManager.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; using Microsoft.VisualStudio.TestTools.UnitTesting; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerLauncherViewModelTest.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerLauncherViewModelTest.cs index a5d09f61b2..f1084d498a 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerLauncherViewModelTest.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerLauncherViewModelTest.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.ViewModels; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerPreview.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerPreview.cs index f70357293e..373b9a3580 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerPreview.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerPreview.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerRename.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerRename.cs index 441fd906e7..278975183b 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerRename.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/PowerRename.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs index b162ecc713..3613d0cfa3 100644 --- a/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs +++ b/src/settings-ui/Settings.UI.UnitTests/ViewModelTests/ShortcutGuide.cs @@ -4,6 +4,7 @@ using System; using System.Text.Json; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.UnitTests.BackwardsCompatibility; using Microsoft.PowerToys.Settings.UI.UnitTests.Mocks; diff --git a/src/settings-ui/Settings.UI/Activation/DefaultActivationHandler.cs b/src/settings-ui/Settings.UI/Activation/DefaultActivationHandler.cs index c501a23e6b..946fab205c 100644 --- a/src/settings-ui/Settings.UI/Activation/DefaultActivationHandler.cs +++ b/src/settings-ui/Settings.UI/Activation/DefaultActivationHandler.cs @@ -4,6 +4,7 @@ using System; using System.Threading.Tasks; + using Microsoft.PowerToys.Settings.UI.Services; using Windows.ApplicationModel.Activation; diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/Advanced.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/Advanced.png new file mode 100644 index 0000000000..da8abaded6 Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Settings/Icons/Advanced.png differ diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/FileManagement.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/FileManagement.png new file mode 100644 index 0000000000..22ad25a090 Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Settings/Icons/FileManagement.png differ diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/InputOutput.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/InputOutput.png new file mode 100644 index 0000000000..07fb177d14 Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Settings/Icons/InputOutput.png differ diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/NewPlus.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/NewPlus.png index 1c35c610c8..98f72d1672 100644 Binary files a/src/settings-ui/Settings.UI/Assets/Settings/Icons/NewPlus.png and b/src/settings-ui/Settings.UI/Assets/Settings/Icons/NewPlus.png differ diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/SystemTools.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/SystemTools.png new file mode 100644 index 0000000000..2db25f1278 Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Settings/Icons/SystemTools.png differ diff --git a/src/settings-ui/Settings.UI/Assets/Settings/Icons/WindowingAndLayouts.png b/src/settings-ui/Settings.UI/Assets/Settings/Icons/WindowingAndLayouts.png new file mode 100644 index 0000000000..9e0bd706f9 Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Settings/Icons/WindowingAndLayouts.png differ diff --git a/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs b/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs index 1bbae1f8c2..1119b91154 100644 --- a/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/AwakeModeToIntConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.UI.Xaml.Data; diff --git a/src/settings-ui/Settings.UI/Converters/ColorFormatConverter.cs b/src/settings-ui/Settings.UI/Converters/ColorFormatConverter.cs index 8b81200d64..428b5d60a5 100644 --- a/src/settings-ui/Settings.UI/Converters/ColorFormatConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/ColorFormatConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using ManagedCommon; using Microsoft.UI.Xaml.Data; diff --git a/src/settings-ui/Settings.UI/Converters/ImageResizerFitToIntConverter.cs b/src/settings-ui/Settings.UI/Converters/ImageResizerFitToIntConverter.cs index 8a68025197..1439e97e7f 100644 --- a/src/settings-ui/Settings.UI/Converters/ImageResizerFitToIntConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/ImageResizerFitToIntConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.UI.Xaml.Data; diff --git a/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs b/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs index d9a740db95..bfc991c070 100644 --- a/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/ImageResizerFitToStringConverter.cs @@ -4,6 +4,7 @@ using System; using System.Globalization; + using Microsoft.UI.Xaml.Data; namespace Microsoft.PowerToys.Settings.UI.Converters diff --git a/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToIntConverter.cs b/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToIntConverter.cs index 0132b86241..0a5087778e 100644 --- a/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToIntConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToIntConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.UI.Xaml.Data; diff --git a/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs b/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs index 6dc89e65fb..ab4aec8195 100644 --- a/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/ImageResizerUnitToStringConverter.cs @@ -4,6 +4,7 @@ using System; using System.Globalization; + using Microsoft.UI.Xaml.Data; namespace Microsoft.PowerToys.Settings.UI.Converters diff --git a/src/settings-ui/Settings.UI/Converters/IndexBitFieldToVisibilityConverter.cs b/src/settings-ui/Settings.UI/Converters/IndexBitFieldToVisibilityConverter.cs index 3295294550..fadefcbfaa 100644 --- a/src/settings-ui/Settings.UI/Converters/IndexBitFieldToVisibilityConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/IndexBitFieldToVisibilityConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Data; diff --git a/src/settings-ui/Settings.UI/Converters/MouseJumpPreviewTypeConverter.cs b/src/settings-ui/Settings.UI/Converters/MouseJumpPreviewTypeConverter.cs new file mode 100644 index 0000000000..cfc980a8ce --- /dev/null +++ b/src/settings-ui/Settings.UI/Converters/MouseJumpPreviewTypeConverter.cs @@ -0,0 +1,69 @@ +๏ปฟ// 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 Microsoft.UI.Xaml.Data; +using MouseJump.Common.Models.Settings; + +namespace Microsoft.PowerToys.Settings.UI.Converters +{ + public sealed partial class MouseJumpPreviewTypeConverter : IValueConverter + { + private static readonly PreviewType[] PreviewTypeOrder = + [ + PreviewType.Compact, PreviewType.Bezelled, PreviewType.Custom, + ]; + + private static readonly PreviewType DefaultPreviewType = PreviewType.Bezelled; + + // Receives a string as a parameter and returns an int representing the index + // to select in the Segmented control on the Mouse Jump settings page + public object Convert(object value, Type targetType, object parameter, string language) + { + var previewType = MouseJumpPreviewTypeConverter.DefaultPreviewType; + + if (value is not string previewTypeName) + { + // the value isn't a string so just use the default preview type + } + else if (Enum.IsDefined(typeof(PreviewType), previewTypeName)) + { + // there's a case-sensitive match for the value + previewType = Enum.Parse(previewTypeName); + } + else if (Enum.TryParse(previewTypeName, true, out var previewTypeResult)) + { + // there's a case-insensitive match for the value + previewType = previewTypeResult; + } + + return Array.IndexOf( + MouseJumpPreviewTypeConverter.PreviewTypeOrder, + previewType); + } + + // Receives an int as a parameter that represents the selected index in the Segmented + // control on the Mouse Jump settings page, and returns the name of the PreviewType enum + // for that index. + public object ConvertBack(object value, Type targetType, object parameter, string language) + { + var previewType = MouseJumpPreviewTypeConverter.DefaultPreviewType; + + if (value is not int segmentedIndex) + { + // the value isn't an int so just use the default preview type + } + else if ((segmentedIndex < 0) || (segmentedIndex > MouseJumpPreviewTypeConverter.PreviewTypeOrder.Length)) + { + // not a valid selected index so just use the default preview type + } + else + { + previewType = MouseJumpPreviewTypeConverter.PreviewTypeOrder[segmentedIndex]; + } + + return previewType.ToString(); + } + } +} diff --git a/src/settings-ui/Settings.UI/Converters/RunOptionTemplateSelector.cs b/src/settings-ui/Settings.UI/Converters/RunOptionTemplateSelector.cs index 0e742e855a..0093f5f28f 100644 --- a/src/settings-ui/Settings.UI/Converters/RunOptionTemplateSelector.cs +++ b/src/settings-ui/Settings.UI/Converters/RunOptionTemplateSelector.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; using Microsoft.UI.Xaml; diff --git a/src/settings-ui/Settings.UI/Converters/StringToInfoBarSeverityConverter.cs b/src/settings-ui/Settings.UI/Converters/StringToInfoBarSeverityConverter.cs index 548b68889b..af64f9e42f 100644 --- a/src/settings-ui/Settings.UI/Converters/StringToInfoBarSeverityConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/StringToInfoBarSeverityConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.UI.Xaml.Data; namespace Microsoft.PowerToys.Settings.UI.Converters diff --git a/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs b/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs index ecc19dbd7c..15d874a430 100644 --- a/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs +++ b/src/settings-ui/Settings.UI/Converters/UpdateStateToBoolConverter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.UI.Xaml.Data; namespace Microsoft.PowerToys.Settings.UI.Converters diff --git a/src/settings-ui/Settings.UI/Helpers/ETLConverter.cs b/src/settings-ui/Settings.UI/Helpers/ETLConverter.cs new file mode 100644 index 0000000000..a4b8b57ae8 --- /dev/null +++ b/src/settings-ui/Settings.UI/Helpers/ETLConverter.cs @@ -0,0 +1,102 @@ +๏ปฟ// 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.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using ManagedCommon; + +namespace Microsoft.PowerToys.Settings.UI.Helpers +{ + public class ETLConverter + { + private const int TracerptConversionTimeout = 60000; // 60 seconds in milliseconds + private const string ETLConversionOutputFormat = "xml"; // Assuming XML output format + + private readonly string etwDirPath; + + private readonly string tracerptPath; + + public ETLConverter(string etwDirPath, string tracerptPath) + { + this.etwDirPath = etwDirPath; + this.tracerptPath = tracerptPath; + } + + private bool ETLConversionsFailed { get; set; } + + public async Task ConvertDiagnosticsETLsAsync(CancellationToken cancellationToken = default) + { + var etlConversionTasks = new List(); + var directoryInfo = new DirectoryInfo(etwDirPath); + + foreach (var fileInfo in directoryInfo.GetFiles("*.etl", SearchOption.AllDirectories)) + { + var task = Task.Run(() => ConvertETLAsync(fileInfo.FullName, cancellationToken), cancellationToken); + etlConversionTasks.Add(task); + } + + try + { + await Task.WhenAll(etlConversionTasks); + } + catch (Exception) + { + ETLConversionsFailed = true; + } + + if (ETLConversionsFailed) + { + throw new InvalidOperationException("One or more ETL conversions failed."); + } + } + + private void ConvertETLAsync(string etlFilePathToConvert, CancellationToken cancellationToken) + { + var outputFilePath = Path.ChangeExtension(etlFilePathToConvert, $".{ETLConversionOutputFormat}"); + + if (File.Exists(outputFilePath)) + { + File.Delete(outputFilePath); + } + + var tracerPtArguments = $"\"{etlFilePathToConvert}\" -o \"{outputFilePath}\" -lr -y -of {ETLConversionOutputFormat}"; + + var startInfo = new ProcessStartInfo + { + FileName = tracerptPath + "\\tracerpt.exe", + Arguments = tracerPtArguments, + RedirectStandardOutput = true, + RedirectStandardError = true, + UseShellExecute = false, + CreateNoWindow = true, + }; + + using (var process = Process.Start(startInfo)) + { + if (process == null) + { + Logger.LogError("Failed to start tracerpt process."); + } + + var processExited = process.WaitForExit(TracerptConversionTimeout); + + if (!processExited) + { + process.Kill(); + Logger.LogError("ETL conversion process timed out."); + } + + var exitCode = process.ExitCode; + if (exitCode != 0) + { + Logger.LogError($"ETL conversion failed with exit code {exitCode}."); + } + } + } + } +} diff --git a/src/settings-ui/Settings.UI/Helpers/NativeEventWaiter.cs b/src/settings-ui/Settings.UI/Helpers/NativeEventWaiter.cs new file mode 100644 index 0000000000..de6707dd38 --- /dev/null +++ b/src/settings-ui/Settings.UI/Helpers/NativeEventWaiter.cs @@ -0,0 +1,33 @@ +๏ปฟ// 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.Threading; + +using Microsoft.UI.Dispatching; + +namespace Microsoft.PowerToys.Settings.UI.Helpers +{ + public static class NativeEventWaiter + { + public static void WaitForEventLoop(string eventName, Action callback) + { + var dispatcherQueue = DispatcherQueue.GetForCurrentThread(); + var t = new Thread(() => + { + var eventHandle = new EventWaitHandle(false, EventResetMode.AutoReset, eventName); + while (true) + { + if (eventHandle.WaitOne()) + { + dispatcherQueue.TryEnqueue(() => callback()); + } + } + }); + + t.IsBackground = true; + t.Start(); + } + } +} diff --git a/src/settings-ui/Settings.UI/Helpers/NavHelper.cs b/src/settings-ui/Settings.UI/Helpers/NavHelper.cs index 12375832da..52fd7a753f 100644 --- a/src/settings-ui/Settings.UI/Helpers/NavHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/NavHelper.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/Helpers/StartProcessHelper.cs b/src/settings-ui/Settings.UI/Helpers/StartProcessHelper.cs index b4a2e6b6d5..70157075ac 100644 --- a/src/settings-ui/Settings.UI/Helpers/StartProcessHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/StartProcessHelper.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Diagnostics; + using Common.UI; namespace Microsoft.PowerToys.Settings.UI.Helpers @@ -10,6 +11,7 @@ namespace Microsoft.PowerToys.Settings.UI.Helpers public static class StartProcessHelper { public const string ColorsSettings = "ms-settings:colors"; + public const string DiagnosticsAndFeedback = "ms-settings:privacy-feedback"; public static string AnimationsSettings => OSVersionHelper.IsWindows11() ? "ms-settings:easeofaccess-visualeffects" diff --git a/src/settings-ui/Settings.UI/Helpers/WindowHelper.cs b/src/settings-ui/Settings.UI/Helpers/WindowHelper.cs index 440d6cf902..489e2b9a4a 100644 --- a/src/settings-ui/Settings.UI/Helpers/WindowHelper.cs +++ b/src/settings-ui/Settings.UI/Helpers/WindowHelper.cs @@ -6,6 +6,7 @@ using System; using System.IO; using System.Runtime.InteropServices; using System.Text.Json; + using Microsoft.UI.Xaml; namespace Microsoft.PowerToys.Settings.UI.Helpers diff --git a/src/settings-ui/Settings.UI/Images/MouseJump-Desktop.png b/src/settings-ui/Settings.UI/Images/MouseJump-Desktop.png new file mode 100644 index 0000000000..d3ae47b2d4 Binary files /dev/null and b/src/settings-ui/Settings.UI/Images/MouseJump-Desktop.png differ diff --git a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj index 179fd04286..7a465fbd01 100644 --- a/src/settings-ui/Settings.UI/PowerToys.Settings.csproj +++ b/src/settings-ui/Settings.UI/PowerToys.Settings.csproj @@ -49,6 +49,11 @@ + + + + + @@ -56,6 +61,8 @@ + + @@ -82,6 +89,7 @@ + @@ -120,6 +128,9 @@ $(DefaultXamlRuntime) + + $(DefaultXamlRuntime) + $(DefaultXamlRuntime) diff --git a/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml b/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml index dc3af21cea..cff222baf4 100644 --- a/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml +++ b/src/settings-ui/Settings.UI/Properties/PublishProfiles/InstallationPublishProfile.pubxml @@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. FileSystem - net8.0-windows10.0.22621.0 + net9.0-windows10.0.22621.0 10.0.19041.0 10.0.19041.0 $(PowerToysRoot)\$(Platform)\$(Configuration)\WinUI3Apps diff --git a/src/settings-ui/Settings.UI/Services/ActivationService.cs b/src/settings-ui/Settings.UI/Services/ActivationService.cs index 0d6d241631..86ad2e4d7c 100644 --- a/src/settings-ui/Settings.UI/Services/ActivationService.cs +++ b/src/settings-ui/Settings.UI/Services/ActivationService.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; + using Microsoft.PowerToys.Settings.UI.Activation; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/Services/NavigationService.cs b/src/settings-ui/Settings.UI/Services/NavigationService.cs index be720e2ec6..b70976bd01 100644 --- a/src/settings-ui/Settings.UI/Services/NavigationService.cs +++ b/src/settings-ui/Settings.UI/Services/NavigationService.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Media.Animation; diff --git a/src/settings-ui/Settings.UI/Services/ThemeService.cs b/src/settings-ui/Settings.UI/Services/ThemeService.cs index e817c275e4..8df79eca8f 100644 --- a/src/settings-ui/Settings.UI/Services/ThemeService.cs +++ b/src/settings-ui/Settings.UI/Services/ThemeService.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.UI.Xaml; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs index a820502dcd..85f64f62cc 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/App.xaml.cs @@ -9,6 +9,7 @@ using System.IO; using System.Linq; using System.Text.Json; using System.Threading.Tasks; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; @@ -69,6 +70,8 @@ namespace Microsoft.PowerToys.Settings.UI public static Action IPCMessageReceivedCallback { get; set; } + public ETWTrace EtwTrace { get; private set; } = new ETWTrace(); + /// /// Initializes a new instance of the class. /// Initializes the singleton application object. This is the first line of authored code @@ -87,6 +90,13 @@ namespace Microsoft.PowerToys.Settings.UI InitializeComponent(); UnhandledException += App_UnhandledException; + + NativeEventWaiter.WaitForEventLoop( + Constants.PowerToysRunnerTerminateSettingsEvent(), () => + { + EtwTrace?.Dispose(); + Environment.Exit(0); + }); } private void App_UnhandledException(object sender, Microsoft.UI.Xaml.UnhandledExceptionEventArgs e) diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/CheckBoxWithDescriptionControl.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/CheckBoxWithDescriptionControl.cs index 9345f442f2..d8b5b6e31a 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/CheckBoxWithDescriptionControl.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/CheckBoxWithDescriptionControl.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.ComponentModel; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Automation; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs index 9ed817d697..76681d8b46 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ColorFormatEditor.xaml.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Security.Cryptography; using System.Windows.Input; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/FancyZonesPreviewControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/FancyZonesPreviewControl.xaml.cs index 405d5d6e7d..de05fe790d 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/FancyZonesPreviewControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/FancyZonesPreviewControl.xaml.cs @@ -5,6 +5,7 @@ using System.ComponentModel; using System.IO; using System.Text; + using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs index c013a87f40..82c6b3a986 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/IsEnabledTextBlock/IsEnabledTextBlock.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.ComponentModel; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml.cs index d746f738ce..24fa76619b 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/PowerAccentShortcutControl.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.cs index 8b19fbf3ba..b863900fe3 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsGroup/SettingsGroup.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.ComponentModel; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Automation.Peers; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsPageControl/SettingsPageControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsPageControl/SettingsPageControl.xaml.cs index 6124356fc7..dca1fbae8e 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsPageControl/SettingsPageControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/SettingsPageControl/SettingsPageControl.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.ObjectModel; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs index 3fbcdeef21..e33127572d 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutControl.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using CommunityToolkit.WinUI; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml.cs index 79059e8aa8..5d44f7c451 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutDialogContentControl.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs index 66e052da37..ed18669eba 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Controls/ShortcutControl/ShortcutWithTextLabelControl.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; + using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/AppsListPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/AppsListPage.xaml.cs index cc952772a9..b58636f41b 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/AppsListPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/AppsListPage.xaml.cs @@ -4,6 +4,7 @@ using System; using System.Collections.ObjectModel; using System.Threading; + using global::Windows.System; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml.cs index 5c778fbbdd..a2a8b313ac 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Flyout/LaunchPage.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; using System.Threading; + using global::Windows.System; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Controls; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs index c665e3a21a..e85d377da2 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/MainWindow.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; + using ManagedCommon; using Microsoft.PowerLauncher.Telemetry; using Microsoft.PowerToys.Settings.UI.Helpers; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeColorPicker.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeColorPicker.xaml.cs index 3ed13e6e84..444b2d7295 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeColorPicker.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeColorPicker.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Threading; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeEnvironmentVariables.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeEnvironmentVariables.xaml.cs index d02a2f8e1b..af20978b42 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeEnvironmentVariables.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeEnvironmentVariables.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Threading; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeHosts.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeHosts.xaml.cs index 25dc699889..d47af96c7f 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeHosts.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeHosts.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Threading; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml index b6456d5eb0..b04c800bca 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml @@ -5,6 +5,8 @@ xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls" + xmlns:ui="using:CommunityToolkit.WinUI" mc:Ignorable="d"> @@ -17,6 +19,35 @@ + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs index d43bda83bf..ba4595ea06 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverview.xaml.cs @@ -2,9 +2,11 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; using Microsoft.PowerToys.Settings.UI.Views; +using Microsoft.PowerToys.Telemetry; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; @@ -14,9 +16,46 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views { public OobePowerToysModule ViewModel { get; set; } + private bool _enableDataDiagnostics; + + public bool EnableDataDiagnostics + { + get + { + return _enableDataDiagnostics; + } + + set + { + if (_enableDataDiagnostics != value) + { + _enableDataDiagnostics = value; + + DataDiagnosticsSettings.SetEnabledValue(_enableDataDiagnostics); + + this.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.Normal, () => + { + ShellPage.ShellHandler?.SignalGeneralDataUpdate(); + }); + } + } + } + + public bool ShowDataDiagnosticsSetting => GetIsDataDiagnosticsInfoBarEnabled(); + + private bool GetIsDataDiagnosticsInfoBarEnabled() + { + var isDataDiagnosticsGpoDisallowed = GPOWrapper.GetAllowDataDiagnosticsValue() == GpoRuleConfigured.Disabled; + + return !isDataDiagnosticsGpoDisallowed; + } + public OobeOverview() { this.InitializeComponent(); + + _enableDataDiagnostics = DataDiagnosticsSettings.GetEnabledValue(); + ViewModel = new OobePowerToysModule(OobeShellPage.OobeShellHandler.Modules[(int)PowerToysModules.Overview]); DataContext = ViewModel; } @@ -31,6 +70,16 @@ namespace Microsoft.PowerToys.Settings.UI.OOBE.Views ViewModel.LogOpeningSettingsEvent(); } + private void GeneralSettingsLaunchButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) + { + if (OobeShellPage.OpenMainWindowCallback != null) + { + OobeShellPage.OpenMainWindowCallback(typeof(GeneralPage)); + } + + ViewModel.LogOpeningSettingsEvent(); + } + protected override void OnNavigatedTo(NavigationEventArgs e) { ViewModel.LogOpeningModuleEvent(); diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs index 18a18189ab..c7767e2424 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeOverviewPlaceholder.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Threading.Tasks; + using AllExperiments; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeRun.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeRun.xaml.cs index 29ed8b72d4..3cb8593922 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeRun.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeRun.xaml.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Threading; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShellPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShellPage.xaml.cs index 09186b4634..02df4de735 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShellPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShellPage.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.ObjectModel; using System.Globalization; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShortcutGuide.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShortcutGuide.xaml.cs index 11b8b678f9..5702ddcb9f 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShortcutGuide.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeShortcutGuide.xaml.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.OOBE.Enums; using Microsoft.PowerToys.Settings.UI.OOBE.ViewModel; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml index 06c3b29067..6cdf8a72cc 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/OOBE/Views/OobeWhatsNew.xaml @@ -6,19 +6,67 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:tk7controls="using:CommunityToolkit.WinUI.UI.Controls" + xmlns:tkcontrols="using:CommunityToolkit.WinUI.Controls" + xmlns:ui="using:CommunityToolkit.WinUI" Loaded="Page_Loaded" mc:Ignorable="d"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + - - diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/NewPlusPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/NewPlusPage.xaml.cs index f33e7b0d4a..78e2fa948f 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/NewPlusPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/NewPlusPage.xaml.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using System.Windows; + using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml index 0c75c60c92..790d8182b3 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml @@ -2,6 +2,7 @@ x:Class="Microsoft.PowerToys.Settings.UI.Views.PowerAccentPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:Lib="using:Microsoft.PowerToys.Settings.UI.Library" xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -9,6 +10,15 @@ xmlns:ui="using:CommunityToolkit.WinUI" AutomationProperties.LandmarkType="Main" mc:Ignorable="d"> + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml.cs index 91e57b8105..c0e78d3e87 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerAccentPage.xaml.cs @@ -1,10 +1,12 @@ ๏ปฟ// 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.Linq; +using CommunityToolkit.WinUI; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; namespace Microsoft.PowerToys.Settings.UI.Views @@ -19,11 +21,65 @@ namespace Microsoft.PowerToys.Settings.UI.Views ViewModel = new PowerAccentViewModel(settingsUtils, SettingsRepository.GetInstance(settingsUtils), ShellPage.SendDefaultIPCMessage); DataContext = ViewModel; this.InitializeComponent(); + this.InitializeControlsStates(); } public void RefreshEnabledState() { ViewModel.RefreshEnabledState(); } + + private void InitializeControlsStates() + { + SetCheckBoxStatus(); + } + + private void SetCheckBoxStatus() + { + if (ViewModel.SelectedLanguageOptions.Length == 0) + { + this.QuickAccent_SelectedLanguage_All.IsChecked = false; + this.QuickAccent_SelectedLanguage_All.IsThreeState = false; + } + else if (ViewModel.AllSelected) + { + this.QuickAccent_SelectedLanguage_All.IsChecked = true; + this.QuickAccent_SelectedLanguage_All.IsThreeState = false; + } + else + { + this.QuickAccent_SelectedLanguage_All.IsThreeState = true; + this.QuickAccent_SelectedLanguage_All.IsChecked = null; + } + } + + private void QuickAccent_SelectedLanguage_SelectAll(object sender, RoutedEventArgs e) + { + this.QuickAccent_Language_Select.SelectAllSafe(); + } + + private void QuickAccent_SelectedLanguage_UnselectAll(object sender, RoutedEventArgs e) + { + this.QuickAccent_Language_Select.DeselectAll(); + } + + private void QuickAccent_SelectedLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + var listView = sender as ListView; + + ViewModel.SelectedLanguageOptions = listView.SelectedItems + .Select(item => item as PowerAccentLanguageModel) + .ToArray(); + + SetCheckBoxStatus(); + } + + private void QuickAccent_Language_Select_Loaded(object sender, RoutedEventArgs e) + { + foreach (var languageOption in ViewModel.SelectedLanguageOptions) + { + this.QuickAccent_Language_Select.SelectedItems.Add(languageOption); + } + } } } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml.cs index 81ba63fcd1..3e272e0eb6 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/PowerLauncherPage.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Collections.ObjectModel; using System.IO; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml index 4a3735c7cf..16cc46bf4f 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml @@ -105,135 +105,159 @@ + + x:Uid="Shell_TopLevelSystemTools" + Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/SystemTools.png}" + SelectsOnInvoked="False"> + + + + + + + + + + + + x:Uid="Shell_TopLevelWindowsAndLayouts " + Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/WindowingAndLayouts.png}" + SelectsOnInvoked="False"> + + + + + + + + + x:Uid="Shell_TopLevelInputOutput" + Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/InputOutput.png}" + SelectsOnInvoked="False"> + + + + + + + + + + + + + x:Uid="Shell_TopLevelFileManagement" + Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileManagement.png}" + SelectsOnInvoked="False"> + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + x:Uid="Shell_TopLevelAdvanced" + Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Advanced.png}" + SelectsOnInvoked="False"> + + + + + + + diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml.cs index 4a5f66c11a..9ff088b787 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Linq; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Services; @@ -121,6 +122,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views public static bool IsUserAnAdmin { get; set; } + private Dictionary _navViewParentLookup = new Dictionary(); + /// /// Initializes a new instance of the class. /// Shell page constructor. @@ -137,6 +140,21 @@ namespace Microsoft.PowerToys.Settings.UI.Views // shellFrame.Navigate(typeof(GeneralPage)); IPCResponseHandleList.Add(ReceiveMessage); SetTitleBar(); + + if (_navViewParentLookup.Count > 0) + { + _navViewParentLookup.Clear(); + } + + var topLevelItems = navigationView.MenuItems.OfType().ToArray(); + + foreach (var parent in topLevelItems) + { + foreach (var child in parent.MenuItems.OfType()) + { + _navViewParentLookup.TryAdd(child.GetValue(NavHelper.NavigateToProperty) as Type, parent); + } + } } public static int SendDefaultIPCMessage(string msg) @@ -276,7 +294,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views private bool navigationViewInitialStateProcessed; // avoid announcing initial state of the navigation pane. - private void NavigationView_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView sender, object args) + private void NavigationView_PaneOpened(NavigationView sender, object args) { if (!navigationViewInitialStateProcessed) { @@ -292,7 +310,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened)) { - var loader = Helpers.ResourceLoaderInstance.ResourceLoader; + var loader = ResourceLoaderInstance.ResourceLoader; peer.RaiseNotificationEvent( AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, @@ -301,7 +319,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views } } - private void NavigationView_PaneClosed(Microsoft.UI.Xaml.Controls.NavigationView sender, object args) + private void NavigationView_PaneClosed(NavigationView sender, object args) { if (!navigationViewInitialStateProcessed) { @@ -317,7 +335,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (AutomationPeer.ListenerExists(AutomationEvents.MenuClosed)) { - var loader = Helpers.ResourceLoaderInstance.ResourceLoader; + var loader = ResourceLoaderInstance.ResourceLoader; peer.RaiseNotificationEvent( AutomationNotificationKind.ActionCompleted, AutomationNotificationProcessing.ImportantMostRecent, @@ -347,6 +365,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views if (selectedItem != null) { Type pageType = selectedItem.GetValue(NavHelper.NavigateToProperty) as Type; + + if (_navViewParentLookup.TryGetValue(pageType, out var parentItem) && !parentItem.IsExpanded) + { + parentItem.IsExpanded = true; + } + NavigationService.Navigate(pageType); } } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/VideoConference.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/VideoConference.xaml.cs index 9cf7b71cd7..2768994933 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/VideoConference.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/VideoConference.xaml.cs @@ -5,6 +5,7 @@ using System; using System.Runtime.InteropServices; using System.Threading.Tasks; + using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.ViewModels; diff --git a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw index afd694d95f..57f6468b0a 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -59,10 +59,7 @@ : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> - + @@ -725,6 +722,9 @@ Actions + + Additional actions + Current Key Remappings @@ -2046,6 +2046,21 @@ Made with ๐Ÿ’— by Microsoft and the PowerToys community. Paste as Custom with AI directly + + Image to text + + + Paste as file + + + Paste as .txt file + + + Paste as .png file + + + Paste as .html file + OpenAI API key: @@ -2125,6 +2140,51 @@ Take a moment to preview the various utilities listed or view our comprehensive Documentation on Microsoft Learn + + Help us make PowerToys better + + + Diagnostics & feedback helps us to improve PowerToys and keep it secure, up to date, and working as expected. + + + View more diagnostic data settings + + + Learn more about the information PowerToys logs & how it gets used + + + Diagnostic data + + + Helps inform bug fixes, performance, and product decisions + + + Turn on diagnostic data to help us improve PowerToys? + + + PowerToys diagnostic data is completely optional. + + + Enable + + + Thank you for helping to make PowerToys better! + + + Preference updated. + + + You can change this at any time from + + + settings. + + + Yes + + + No + Release notes @@ -3525,121 +3585,133 @@ Activate by holding the key for the character you want to add an accent to, then All available - + + Special sets + + + Language sets + + + Special Characters + + Bulgarian - + Catalan - + Crimean Tatar - + Currency - + Croatian - + Czech - + Danish - + Gaeilge Gaelic language spoken in Ireland - + Gร idhlig Scottish Gaelic - + German - + Greek - + Hebrew - + French - + Finnish - + Estonian - + Esperanto - + IPA International Phonetic Alphabet - + Lithuanian - + Macedonian - + Maori - + Middle Eastern Romanization - + Dutch - + Norwegian - + Pinyin - + Polish - + Portuguese - + Slovak - + Slovenian - + Spanish - + Swedish - + Turkish - + Icelandic - + Romanian - + Serbian - + + Serbian Cyrillic + + Hungarian - + Italian - + Kurdish - + Welsh @@ -3831,6 +3903,33 @@ Activate by holding the key for the character you want to add an accent to, then Allow experimentation with new features + + Diagnostics & feedback + + + Learn more about the information we log & how it gets used + + + Diagnostic data + + + Helps inform bug fixes, performance, and improvements + + + View diagnostic data + + + Enable viewing + + + Uses up to 1GB (or more) of hard drive space on your PC + + + Diagnostic data viewer + + + Generate .xml files containing readable diagnostic data. Folder may include .xml and .etl files + Advanced Paste Product name: Navigation view item name for Advanced Paste @@ -4034,13 +4133,17 @@ Activate by holding the key for the character you want to add an accent to, then Launch Registry Preview "Registry Preview" is the name of the utility + + Mouse Jump + Refers to the utility name + Quickly move the mouse pointer long distances. "Mouse Jump" is the name of the utility. Mouse is the hardware mouse. - - Mouse Jump - Refers to the utility name + + Enable Mouse Jump + "Mouse Jump" is the name of the utility. Customize the shortcut to turn on or off this mode @@ -4048,9 +4151,124 @@ Activate by holding the key for the character you want to add an accent to, then Activation shortcut - - Enable Mouse Jump - "Mouse Jump" is the name of the utility. + + Thumbnail Size + + + Constrain thumbnail image size to a maximum of + + + pixels + + + Maximum height (px) + px = pixels + + + Maximum width (px) + px = pixels + + + Appearance + + + Preview style + + + Select a predefined style, or apply a custom one + + + Compact + + + Bezelled + + + Custom + + + Copy to Custom preview style + + + Background color 1 + + + The start color for the background gradient fill on the preview image + + + Background color 2 + + + The end color for the background gradient fill on the preview image + + + Border thickness + + + The thickness (in pixels) of the border that surrounds the preview image + + + Border color + + + The color of the border that surrounds the preview image + + + Border 3D depth + + + The width (in pixels) of the 3d effect on the border that surrounds the preview image + + + Border padding + + + The amount of padding to draw between the border that surrounds the main preview image and the screen images + + + Bezel thickness + + + The thickness (in pixels) of the border that surrounds the individual screen images + + + Bezel color + + + The color of the border that surrounds the individual screen images + + + Bezel 3D depth + + + The width (in pixels) of the 3d effect on the border that surrounds individual screen images + + + Screen spacing + + + The width (in pixels) of the margin drawn between individual screen images + + + Screen color 1 + + + The start color for the background gradient fill on individual screen images + + + Screen color 2 + + + The end color for the background gradient fill on individual screen images + + + Copy to Custom preview style + + + This will replace the current settings in the Custom preview style. + + + Copy 127.0.0.1, ::1, ... @@ -4078,23 +4296,6 @@ Activate by holding the key for the character you want to add an accent to, then Using this shortcut may prevent non-text paste actions (e.g. images, files) or built-in paste plain text actions in other applications from functioning. - - Thumbnail Size - - - Constrain thumbnail image size to a maximum of - - - pixels - - - Maximum height (px) - px = pixels - - - Maximum width (px) - px = pixels - A lightning fast file preview feature for Windows. {Locked="Windows"} @@ -4306,9 +4507,6 @@ Activate by holding the key for the character you want to add an accent to, then Enable New+ Localize product name in accordance with Windows New - - New+ is not supported in Windows 10 and is not expected to work. - PowerToys "Backup and Restore" feature doesn't take templates into account at this moment. If you use that feature, templates will have to be copied manually. @@ -4364,7 +4562,7 @@ Activate by holding the key for the character you want to add an accent to, then You can have multiple templates of the same file type, and you can even template folders! - + Workspaces is a quick and easy way to launch a set of applications to custom positions and configurations with one-click. @@ -4464,4 +4662,25 @@ Activate by holding the key for the character you want to add an accent to, then Chinese (Traditional) - + + Restart PowerToys for enable viewing change to take effect. + + + Restart + + + Advanced + + + File Management + + + Input / Output + + + Windowing & Layouts + + + System Tools + + \ No newline at end of file diff --git a/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs index 7790460bb5..f5639dba14 100644 --- a/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/AdvancedPasteViewModel.cs @@ -13,6 +13,7 @@ using System.Reflection; using System.Text.Json; using System.Text.Json.Serialization; using System.Timers; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; @@ -34,9 +35,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private GeneralSettings GeneralSettingsConfig { get; set; } private readonly ISettingsUtils _settingsUtils; - private readonly object _delayedActionLock = new object(); + private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock(); private readonly AdvancedPasteSettings _advancedPasteSettings; + private readonly AdvancedPasteAdditionalActions _additionalActions; private readonly ObservableCollection _customActions; private Timer _delayedTimer; @@ -68,6 +70,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _advancedPasteSettings = advancedPasteSettingsRepository.SettingsConfig; + _additionalActions = _advancedPasteSettings.Properties.AdditionalActions; _customActions = _advancedPasteSettings.Properties.CustomActions.Value; InitializeEnabledValue(); @@ -80,6 +83,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _delayedTimer.Elapsed += DelayedTimer_Tick; _delayedTimer.AutoReset = false; + foreach (var action in _additionalActions.AllActions) + { + action.PropertyChanged += OnAdditionalActionPropertyChanged; + } + foreach (var customAction in _customActions) { customAction.PropertyChanged += OnCustomActionPropertyChanged; @@ -142,6 +150,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels public ObservableCollection CustomActions => _customActions; + public AdvancedPasteAdditionalActions AdditionalActions => _additionalActions; + private bool OpenAIKeyExists() { PasswordVault vault = new PasswordVault(); @@ -335,12 +345,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } } - public bool IsConflictingCopyShortcut - { - get => _customActions.Select(customAction => customAction.Shortcut) - .Concat([PasteAsPlainTextShortcut, AdvancedPasteUIShortcut, PasteAsMarkdownShortcut, PasteAsJsonShortcut]) - .Any(hotkey => WarnHotkeys.Contains(hotkey.ToString())); - } + public bool IsConflictingCopyShortcut => + _customActions.Select(customAction => customAction.Shortcut) + .Concat([PasteAsPlainTextShortcut, AdvancedPasteUIShortcut, PasteAsMarkdownShortcut, PasteAsJsonShortcut]) + .Any(hotkey => WarnHotkeys.Contains(hotkey.ToString())); + + public bool IsAdditionalActionConflictingCopyShortcut => + _additionalActions.AllActions + .OfType() + .Select(additionalAction => additionalAction.Shortcut) + .Any(hotkey => WarnHotkeys.Contains(hotkey.ToString())); private void DelayedTimer_Tick(object sender, EventArgs e) { @@ -460,6 +474,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels NotifySettingsChanged(); } + private void OnAdditionalActionPropertyChanged(object sender, PropertyChangedEventArgs e) + { + SaveAndNotifySettings(); + + if (e.PropertyName == nameof(AdvancedPasteAdditionalAction.Shortcut)) + { + OnPropertyChanged(nameof(IsAdditionalActionConflictingCopyShortcut)); + } + } + private void OnCustomActionPropertyChanged(object sender, PropertyChangedEventArgs e) { if (typeof(AdvancedPasteCustomAction).GetProperty(e.PropertyName).GetCustomAttribute() == null) diff --git a/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs index 97409f376c..a45c66a1ef 100644 --- a/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/AlwaysOnTopViewModel.cs @@ -6,6 +6,7 @@ using System; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.Json; + using Common.UI; using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/AwakeViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/AwakeViewModel.cs index 7d9a48c628..2042015717 100644 --- a/src/settings-ui/Settings.UI/ViewModels/AwakeViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/AwakeViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.CompilerServices; + using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/CmdNotFoundViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/CmdNotFoundViewModel.cs index 458ed443d6..f0fd6a4ab8 100644 --- a/src/settings-ui/Settings.UI/ViewModels/CmdNotFoundViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/CmdNotFoundViewModel.cs @@ -9,6 +9,7 @@ using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs index a1f57d4fc3..bf20e551f2 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ColorPickerViewModel.cs @@ -9,6 +9,7 @@ using System.Globalization; using System.Linq; using System.Text.Json; using System.Timers; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; @@ -28,7 +29,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private GeneralSettings GeneralSettingsConfig { get; set; } private readonly ISettingsUtils _settingsUtils; - private readonly object _delayedActionLock = new object(); + private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock(); private readonly ColorPickerSettings _colorPickerSettings; private Timer _delayedTimer; diff --git a/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs index e855174e25..9064cd9058 100644 --- a/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/CropAndLockViewModel.cs @@ -6,6 +6,7 @@ using System; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.Json; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardListItem.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardListItem.cs index c7c304388f..03843a8d8c 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardListItem.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardListItem.cs @@ -6,6 +6,7 @@ using System; using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; + using ManagedCommon; using Microsoft.UI; using Windows.UI; diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardModuleItem.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardModuleItem.cs index 5032abe999..fe029e6619 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardModuleItem.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardModuleItem.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; + using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.UI.Xaml; using Windows.UI; diff --git a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs index c72a52c7f7..6b5640a8c5 100644 --- a/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/DashboardViewModel.cs @@ -8,6 +8,7 @@ using System.Collections.ObjectModel; using System.IO.Abstractions; using System.Linq; using System.Windows.Threading; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; @@ -130,30 +131,38 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { var settingsUtils = new SettingsUtils(); var settings = NewPlusViewModel.LoadSettings(settingsUtils); - NewPlusViewModel.CopyTemplateExamples(settings.TemplateLocation); + NewPlusViewModel.CopyTemplateExamples(settings.Properties.TemplateLocation.Value); } } public void ModuleEnabledChangedOnSettingsPage() { - ActiveModules.Clear(); - DisabledModules.Clear(); - generalSettingsConfig = _settingsRepository.SettingsConfig; - foreach (DashboardListItem item in _allModules) + try { - item.IsEnabled = ModuleHelper.GetIsModuleEnabled(generalSettingsConfig, item.Tag); - if (item.IsEnabled) - { - ActiveModules.Add(item); - } - else - { - DisabledModules.Add(item); - } - } + ActiveModules.Clear(); + DisabledModules.Clear(); - OnPropertyChanged(nameof(ActiveModules)); - OnPropertyChanged(nameof(DisabledModules)); + generalSettingsConfig = _settingsRepository.SettingsConfig; + foreach (DashboardListItem item in _allModules) + { + item.IsEnabled = ModuleHelper.GetIsModuleEnabled(generalSettingsConfig, item.Tag); + if (item.IsEnabled) + { + ActiveModules.Add(item); + } + else + { + DisabledModules.Add(item); + } + } + + OnPropertyChanged(nameof(ActiveModules)); + OnPropertyChanged(nameof(DisabledModules)); + } + catch (Exception ex) + { + Logger.LogError($"Updating active/disabled modules list failed: {ex.Message}"); + } } private ObservableCollection GetModuleItems(ModuleType moduleType) diff --git a/src/settings-ui/Settings.UI/ViewModels/EnvironmentVariablesViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/EnvironmentVariablesViewModel.cs index 7a7960cff7..636d88d1ca 100644 --- a/src/settings-ui/Settings.UI/ViewModels/EnvironmentVariablesViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/EnvironmentVariablesViewModel.cs @@ -5,6 +5,7 @@ using System; using System.Runtime.CompilerServices; using System.Threading; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs index 89d1c95ff3..2b01dc3cec 100644 --- a/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/FancyZonesViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.CompilerServices; + using Common.UI; using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs index c79a42d83c..19175dba9a 100644 --- a/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/FileLocksmithViewModel.cs @@ -5,6 +5,7 @@ using System; using System.Globalization; using System.Text.Json; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/Flyout/AllAppsViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/Flyout/AllAppsViewModel.cs index a0cefee149..58d1f4f9ce 100644 --- a/src/settings-ui/Settings.UI/ViewModels/Flyout/AllAppsViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/Flyout/AllAppsViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Collections.ObjectModel; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutMenuItem.cs b/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutMenuItem.cs index 8bf4482e78..8493834f0f 100644 --- a/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutMenuItem.cs +++ b/src/settings-ui/Settings.UI/ViewModels/Flyout/FlyoutMenuItem.cs @@ -5,6 +5,7 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; + using ManagedCommon; namespace Microsoft.PowerToys.Settings.UI.ViewModels diff --git a/src/settings-ui/Settings.UI/ViewModels/Flyout/LauncherViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/Flyout/LauncherViewModel.cs index ad24c17428..c1d820c0d7 100644 --- a/src/settings-ui/Settings.UI/ViewModels/Flyout/LauncherViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/Flyout/LauncherViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Collections.ObjectModel; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs index 4f6ff3cb38..6a2340f8c6 100644 --- a/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/GeneralViewModel.cs @@ -9,18 +9,20 @@ using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Abstractions; -using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Text.Json; using System.Threading.Tasks; + using global::PowerToys.GPOWrapper; using ManagedCommon; +using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; using Microsoft.PowerToys.Settings.UI.Library.Interfaces; using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands; +using Microsoft.PowerToys.Telemetry; namespace Microsoft.PowerToys.Settings.UI.ViewModels { @@ -143,12 +145,32 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _autoDownloadUpdatesIsGpoDisabled = GPOWrapper.GetDisableAutomaticUpdateDownloadValue() == GpoRuleConfigured.Enabled; _experimentationIsGpoDisallowed = GPOWrapper.GetAllowExperimentationValue() == GpoRuleConfigured.Disabled; _showWhatsNewAfterUpdatesIsGpoDisabled = GPOWrapper.GetDisableShowWhatsNewAfterUpdatesValue() == GpoRuleConfigured.Enabled; + _enableDataDiagnosticsIsGpoDisallowed = GPOWrapper.GetAllowDataDiagnosticsValue() == GpoRuleConfigured.Disabled; + + if (_enableDataDiagnosticsIsGpoDisallowed) + { + _enableDataDiagnostics = false; + } + else + { + _enableDataDiagnostics = DataDiagnosticsSettings.GetEnabledValue(); + } + + _enableViewDataDiagnostics = DataDiagnosticsSettings.GetViewEnabledValue(); + _enableViewDataDiagnosticsOnLoad = _enableViewDataDiagnostics; if (dispatcherAction != null) { _fileWatcher = Helper.GetFileWatcher(string.Empty, UpdatingSettings.SettingsFile, dispatcherAction); } + // Diagnostic data retention policy + string etwDirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\etw"); + DeleteDiagnosticDataOlderThan28Days(etwDirPath); + + string localLowEtwDirPath = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"); + DeleteDiagnosticDataOlderThan28Days(localLowEtwDirPath); + InitializeLanguages(); } @@ -196,6 +218,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private bool _showWhatsNewAfterUpdatesIsGpoDisabled; private bool _enableExperimentation; private bool _experimentationIsGpoDisallowed; + private bool _enableDataDiagnostics; + private bool _enableDataDiagnosticsIsGpoDisallowed; + private bool _enableViewDataDiagnostics; + private bool _enableViewDataDiagnosticsOnLoad; + private bool _viewDiagnosticDataViewerChanged; private UpdatingSettings.UpdatingState _updatingState = UpdatingSettings.UpdatingState.UpToDate; private string _newAvailableVersion = string.Empty; @@ -429,11 +456,74 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } } + public bool EnableDataDiagnostics + { + get + { + return _enableDataDiagnostics; + } + + set + { + if (_enableDataDiagnostics != value) + { + _enableDataDiagnostics = value; + + if (_enableDataDiagnostics == false) + { + EnableViewDataDiagnostics = false; + } + + DataDiagnosticsSettings.SetEnabledValue(_enableDataDiagnostics); + NotifyPropertyChanged(); + } + } + } + + public bool ViewDiagnosticDataViewerChanged + { + get => _viewDiagnosticDataViewerChanged; + } + + public bool EnableViewDataDiagnostics + { + get + { + return _enableViewDataDiagnostics; + } + + set + { + if (_enableViewDataDiagnostics != value) + { + _enableViewDataDiagnostics = value; + + if (_enableViewDataDiagnostics != _enableViewDataDiagnosticsOnLoad) + { + _viewDiagnosticDataViewerChanged = true; + } + else + { + _viewDiagnosticDataViewerChanged = false; + } + + DataDiagnosticsSettings.SetViewEnabledValue(_enableViewDataDiagnostics); + OnPropertyChanged(nameof(EnableViewDataDiagnostics)); + OnPropertyChanged(nameof(ViewDiagnosticDataViewerChanged)); + } + } + } + public bool IsExperimentationGpoDisallowed { get => _experimentationIsGpoDisallowed; } + public bool IsDataDiagnosticsGPOManaged + { + get => _enableDataDiagnosticsIsGpoDisallowed; + } + public string SettingsBackupAndRestoreDir { get @@ -1082,27 +1172,128 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void InitializeLanguages() { var lang = LanguageModel.LoadSetting(); - int i = 0; + var selectedLanguageIndex = 0; foreach (var item in langTagsAndIds) { - Languages.Add(new LanguageModel { Tag = item.Key, ResourceID = item.Value, Language = GetResourceString(item.Value) }); + var language = new LanguageModel { Tag = item.Key, ResourceID = item.Value, Language = GetResourceString(item.Value) }; + var index = GetLanguageIndex(language.Language, item.Key == string.Empty); + Languages.Insert(index, language); if (item.Key.Equals(lang, StringComparison.Ordinal)) { - _initLanguagesIndex = i; - LanguagesIndex = i; + selectedLanguageIndex = index; + } + else if (index <= selectedLanguageIndex) + { + selectedLanguageIndex++; } - - i++; } + + _initLanguagesIndex = selectedLanguageIndex; + LanguagesIndex = selectedLanguageIndex; + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1309:Use ordinal string comparison", Justification = "Building a user facing list")] + private int GetLanguageIndex(string language, bool isDefault) + { + if (Languages.Count == 0 || isDefault) + { + return 0; + } + + for (var i = 1; i < Languages.Count; i++) + { + if (string.Compare(Languages[i].Language, language, StringComparison.CurrentCultureIgnoreCase) > 0) + { + return i; + } + } + + return Languages.Count; } private void NotifyLanguageChanged() { - OutGoingLanguageSettings outsettings = new OutGoingLanguageSettings(langTagsAndIds.ElementAt(LanguagesIndex).Key); + OutGoingLanguageSettings outsettings = new OutGoingLanguageSettings(Languages[_languagesIndex].Tag); SendConfigMSG(outsettings.ToString()); } + + internal void RefreshSettingsOnExternalChange() + { + EnableDataDiagnostics = DataDiagnosticsSettings.GetEnabledValue(); + + NotifyPropertyChanged(nameof(EnableDataDiagnostics)); + } + + // Per retention policy + private void DeleteDiagnosticDataOlderThan28Days(string etwDirPath) + { + if (!Directory.Exists(etwDirPath)) + { + return; + } + + var directoryInfo = new DirectoryInfo(etwDirPath); + var cutoffDate = DateTime.Now.AddDays(-28); + + foreach (var file in directoryInfo.GetFiles()) + { + if (file.LastWriteTime < cutoffDate) + { + try + { + file.Delete(); + } + catch (Exception ex) + { + Logger.LogError($"Failed to delete file: {file.FullName}. Error: {ex.Message}"); + } + } + } + } + + internal void ViewDiagnosticData() + { + string localLowEtwDirPath = Path.Combine(Environment.GetEnvironmentVariable("USERPROFILE"), "AppData", "LocalLow", "Microsoft", "PowerToys", "etw"); + string etwDirPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft\\PowerToys\\etw"); + + if (Directory.Exists(localLowEtwDirPath)) + { + if (!Directory.Exists(etwDirPath)) + { + Directory.CreateDirectory(etwDirPath); + } + + string[] localLowEtlFiles = Directory.GetFiles(localLowEtwDirPath, "*.etl"); + + foreach (string file in localLowEtlFiles) + { + string fileName = Path.GetFileName(file); + string destFile = Path.Combine(etwDirPath, fileName); + + try + { + File.Copy(file, destFile, overwrite: true); + } + catch (Exception ex) + { + Logger.LogError($"Failed to copy etl file: {fileName}. Error: {ex.Message}"); + } + } + } + + string tracerptPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "system32"); + + ETLConverter converter = new ETLConverter(etwDirPath, tracerptPath); + Task.Run(() => converter.ConvertDiagnosticsETLsAsync()).Wait(); + + if (Directory.Exists(etwDirPath)) + { + // Open etw dir in FileExplorer + Process.Start("explorer.exe", etwDirPath); + } + } } } diff --git a/src/settings-ui/Settings.UI/ViewModels/HostsViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/HostsViewModel.cs index 235ae42bd6..c15d8f9306 100644 --- a/src/settings-ui/Settings.UI/ViewModels/HostsViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/HostsViewModel.cs @@ -5,6 +5,7 @@ using System; using System.Runtime.CompilerServices; using System.Threading; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs index c0ae29ed59..dcd8db95f1 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ImageResizerViewModel.cs @@ -7,6 +7,7 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.IO; using System.Linq; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs index 037761c5f8..822df0d6f1 100644 --- a/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/KeyboardManagerViewModel.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows.Input; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs index 5257c677c5..6c8ee50535 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MeasureToolViewModel.cs @@ -6,6 +6,7 @@ using System; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.Json; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs index 2ad31341c2..e307b40606 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel.cs @@ -5,6 +5,7 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; @@ -13,7 +14,7 @@ using Microsoft.PowerToys.Settings.Utilities; namespace Microsoft.PowerToys.Settings.UI.ViewModels { - public class MouseUtilsViewModel : Observable + public partial class MouseUtilsViewModel : Observable { private ISettingsUtils SettingsUtils { get; set; } @@ -23,8 +24,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private MouseHighlighterSettings MouseHighlighterSettingsConfig { get; set; } - private MouseJumpSettings MouseJumpSettingsConfig { get; set; } - private MousePointerCrosshairsSettings MousePointerCrosshairsSettingsConfig { get; set; } public MouseUtilsViewModel(ISettingsUtils settingsUtils, ISettingsRepository settingsRepository, ISettingsRepository findMyMouseSettingsRepository, ISettingsRepository mouseHighlighterSettingsRepository, ISettingsRepository mouseJumpSettingsRepository, ISettingsRepository mousePointerCrosshairsSettingsRepository, Func ipcMSGCallBackFunc) @@ -79,10 +78,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _highlightFadeDurationMs = MouseHighlighterSettingsConfig.Properties.HighlightFadeDurationMs.Value; _highlighterAutoActivate = MouseHighlighterSettingsConfig.Properties.AutoActivate.Value; - ArgumentNullException.ThrowIfNull(mouseJumpSettingsRepository); - - MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig; - MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += MouseJumpThumbnailSizePropertyChanged; + this.InitializeMouseJumpSettings(mouseJumpSettingsRepository); ArgumentNullException.ThrowIfNull(mousePointerCrosshairsSettingsRepository); @@ -137,17 +133,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _isMouseHighlighterEnabled = GeneralSettingsConfig.Enabled.MouseHighlighter; } - _jumpEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredMouseJumpEnabledValue(); - if (_jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) - { - // Get the enabled state from GPO. - _jumpEnabledStateIsGPOConfigured = true; - _isMouseJumpEnabled = _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled; - } - else - { - _isMouseJumpEnabled = GeneralSettingsConfig.Enabled.MouseJump; - } + this.InitializeMouseJumpEnabledValues(); _mousePointerCrosshairsEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredMousePointerCrosshairsEnabledValue(); if (_mousePointerCrosshairsEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _mousePointerCrosshairsEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) @@ -656,87 +642,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels SettingsUtils.SaveSettings(MouseHighlighterSettingsConfig.ToJsonString(), MouseHighlighterSettings.ModuleName); } - public bool IsMouseJumpEnabled - { - get => _isMouseJumpEnabled; - set - { - if (_jumpEnabledStateIsGPOConfigured) - { - // If it's GPO configured, shouldn't be able to change this state. - return; - } - - if (_isMouseJumpEnabled != value) - { - _isMouseJumpEnabled = value; - - GeneralSettingsConfig.Enabled.MouseJump = value; - OnPropertyChanged(nameof(_isMouseJumpEnabled)); - - OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig); - SendConfigMSG(outgoing.ToString()); - - NotifyMouseJumpPropertyChanged(); - } - } - } - - public bool IsJumpEnabledGpoConfigured - { - get => _jumpEnabledStateIsGPOConfigured; - } - - public HotkeySettings MouseJumpActivationShortcut - { - get - { - return MouseJumpSettingsConfig.Properties.ActivationShortcut; - } - - set - { - if (MouseJumpSettingsConfig.Properties.ActivationShortcut != value) - { - MouseJumpSettingsConfig.Properties.ActivationShortcut = value ?? MouseJumpSettingsConfig.Properties.DefaultActivationShortcut; - NotifyMouseJumpPropertyChanged(); - } - } - } - - public MouseJumpThumbnailSize MouseJumpThumbnailSize - { - get - { - return MouseJumpSettingsConfig.Properties.ThumbnailSize; - } - - set - { - if ((MouseJumpSettingsConfig.Properties.ThumbnailSize.Width != value?.Width) - && (MouseJumpSettingsConfig.Properties.ThumbnailSize.Height != value?.Height)) - { - MouseJumpSettingsConfig.Properties.ThumbnailSize = value; - NotifyMouseJumpPropertyChanged(); - } - } - } - - public void MouseJumpThumbnailSizePropertyChanged(object sender, PropertyChangedEventArgs e) - { - NotifyMouseJumpPropertyChanged(nameof(MouseJumpThumbnailSize)); - } - - public void NotifyMouseJumpPropertyChanged([CallerMemberName] string propertyName = null) - { - OnPropertyChanged(propertyName); - - SndMouseJumpSettings outsettings = new SndMouseJumpSettings(MouseJumpSettingsConfig); - SndModuleSettings ipcMessage = new SndModuleSettings(outsettings); - SendConfigMSG(ipcMessage.ToJsonString()); - SettingsUtils.SaveSettings(MouseJumpSettingsConfig.ToJsonString(), MouseJumpSettings.ModuleName); - } - public bool IsMousePointerCrosshairsEnabled { get => _isMousePointerCrosshairsEnabled; @@ -1016,10 +921,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private int _highlightFadeDurationMs; private bool _highlighterAutoActivate; - private GpoRuleConfigured _jumpEnabledGpoRuleConfiguration; - private bool _jumpEnabledStateIsGPOConfigured; - private bool _isMouseJumpEnabled; - private GpoRuleConfigured _mousePointerCrosshairsEnabledGpoRuleConfiguration; private bool _mousePointerCrosshairsEnabledStateIsGPOConfigured; private bool _isMousePointerCrosshairsEnabled; diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel_MouseJump.cs b/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel_MouseJump.cs new file mode 100644 index 0000000000..2818c34a99 --- /dev/null +++ b/src/settings-ui/Settings.UI/ViewModels/MouseUtilsViewModel_MouseJump.cs @@ -0,0 +1,513 @@ +๏ปฟ// 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.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Drawing.Imaging; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Runtime.CompilerServices; +using global::PowerToys.GPOWrapper; +using Microsoft.PowerToys.Settings.UI.Library; +using Microsoft.PowerToys.Settings.UI.Library.Helpers; +using Microsoft.PowerToys.Settings.UI.Library.Interfaces; +using Microsoft.UI.Xaml.Media; +using Microsoft.UI.Xaml.Media.Imaging; +using MouseJump.Common.Helpers; +using MouseJump.Common.Imaging; +using MouseJump.Common.Models.Drawing; +using MouseJump.Common.Models.Settings; +using MouseJump.Common.Models.Styles; + +namespace Microsoft.PowerToys.Settings.UI.ViewModels +{ + public partial class MouseUtilsViewModel : Observable + { + private GpoRuleConfigured _jumpEnabledGpoRuleConfiguration; + private bool _jumpEnabledStateIsGPOConfigured; + private bool _isMouseJumpEnabled; + + internal MouseJumpSettings MouseJumpSettingsConfig { get; set; } + + private void InitializeMouseJumpSettings(ISettingsRepository mouseJumpSettingsRepository) + { + ArgumentNullException.ThrowIfNull(mouseJumpSettingsRepository); + this.MouseJumpSettingsConfig = mouseJumpSettingsRepository.SettingsConfig; + this.MouseJumpSettingsConfig.Properties.ThumbnailSize.PropertyChanged += this.MouseJumpThumbnailSizePropertyChanged; + } + + private void InitializeMouseJumpEnabledValues() + { + _jumpEnabledGpoRuleConfiguration = GPOWrapper.GetConfiguredMouseJumpEnabledValue(); + if (_jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Disabled || _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled) + { + // Get the enabled state from GPO. + _jumpEnabledStateIsGPOConfigured = true; + _isMouseJumpEnabled = _jumpEnabledGpoRuleConfiguration == GpoRuleConfigured.Enabled; + } + else + { + _isMouseJumpEnabled = GeneralSettingsConfig.Enabled.MouseJump; + } + } + + public bool IsMouseJumpEnabled + { + get => _isMouseJumpEnabled; + set + { + if (_jumpEnabledStateIsGPOConfigured) + { + // If it's GPO configured, shouldn't be able to change this state. + return; + } + + if (_isMouseJumpEnabled != value) + { + _isMouseJumpEnabled = value; + + GeneralSettingsConfig.Enabled.MouseJump = value; + OnPropertyChanged(nameof(_isMouseJumpEnabled)); + + OutGoingGeneralSettings outgoing = new OutGoingGeneralSettings(GeneralSettingsConfig); + SendConfigMSG(outgoing.ToString()); + + NotifyMouseJumpPropertyChanged(); + } + } + } + + public bool IsJumpEnabledGpoConfigured + { + get => _jumpEnabledStateIsGPOConfigured; + } + + public HotkeySettings MouseJumpActivationShortcut + { + get + { + return MouseJumpSettingsConfig.Properties.ActivationShortcut; + } + + set + { + if (MouseJumpSettingsConfig.Properties.ActivationShortcut != value) + { + MouseJumpSettingsConfig.Properties.ActivationShortcut = value ?? MouseJumpSettingsConfig.Properties.DefaultActivationShortcut; + NotifyMouseJumpPropertyChanged(); + } + } + } + + public MouseJumpThumbnailSize MouseJumpThumbnailSize + { + get + { + return MouseJumpSettingsConfig.Properties.ThumbnailSize; + } + + set + { + if ((MouseJumpSettingsConfig.Properties.ThumbnailSize.Width != value?.Width) + && (MouseJumpSettingsConfig.Properties.ThumbnailSize.Height != value?.Height)) + { + MouseJumpSettingsConfig.Properties.ThumbnailSize = value; + NotifyMouseJumpPropertyChanged(); + } + } + } + + private static Bitmap LoadImageResource(string filename) + { + var assembly = Assembly.GetExecutingAssembly(); + var assemblyName = new AssemblyName(assembly.FullName ?? throw new InvalidOperationException()); + var resourceName = $"Microsoft.{assemblyName.Name}.{filename.Replace("/", ".")}"; + var resourceNames = assembly.GetManifestResourceNames(); + if (!resourceNames.Contains(resourceName)) + { + throw new InvalidOperationException($"Embedded resource '{resourceName}' does not exist."); + } + + var stream = assembly.GetManifestResourceStream(resourceName) + ?? throw new InvalidOperationException(); + var image = (Bitmap)Image.FromStream(stream); + return image; + } + + private static Lazy MouseJumpDesktopImage => new( + () => MouseUtilsViewModel.LoadImageResource("UI/Images/MouseJump-Desktop.png") + ); + + public ImageSource MouseJumpPreviewImage + { + get + { + // keep these in sync with the layout of "Images\MouseJump-Desktop.png" + var screens = new List() + { + /* + these magic numbers are the pixel dimensions of the individual screens on the + fake desktop image - "Images\MouseJump-Desktop.png" - used to generate the + preview image in the Settings UI properties page for Mouse Jump. if you update + the fake desktop image be sure to update these values as well. + */ + new(635, 172, 272, 168), + new(0, 0, 635, 339), + }; + var desktopSize = LayoutHelper.GetCombinedScreenBounds(screens).Size; + /* + magic number 283 is the content height left in the settings card after removing the top and bottom chrome: + + 300px settings card height - 1px top border - 7px top margin - 8px bottom margin - 1px bottom border = 283px image height + + this ensures we get a preview image scaled at 100% so borders etc are shown at exact pixel sizes in the preview + */ + var canvasSize = new SizeInfo(desktopSize.Width, 283).Clamp(desktopSize); + + var previewType = Enum.TryParse(this.MouseJumpPreviewType, true, out var previewTypeResult) + ? previewTypeResult + : PreviewType.Bezelled; + var previewStyle = previewType switch + { + PreviewType.Compact => StyleHelper.CompactPreviewStyle.WithCanvasSize(desktopSize), + PreviewType.Bezelled => StyleHelper.BezelledPreviewStyle.WithCanvasSize(desktopSize), + PreviewType.Custom => new PreviewStyle( + canvasSize: canvasSize, + canvasStyle: new( + marginStyle: new(0), + borderStyle: new( + color: ConfigHelper.DeserializeFromConfigColorString( + this.MouseJumpBorderColor), + all: this.MouseJumpBorderThickness, + depth: this.MouseJumpBorder3dDepth + ), + paddingStyle: new( + all: this.MouseJumpBorderPadding + ), + backgroundStyle: new( + color1: ConfigHelper.DeserializeFromConfigColorString( + this.MouseJumpBackgroundColor1), + color2: ConfigHelper.DeserializeFromConfigColorString( + this.MouseJumpBackgroundColor2) + ) + ), + screenStyle: new( + marginStyle: new( + all: this.MouseJumpScreenMargin + ), + borderStyle: new( + color: ConfigHelper.DeserializeFromConfigColorString( + this.MouseJumpBezelColor), + all: this.MouseJumpBezelThickness, + depth: this.MouseJumpBezel3dDepth + ), + paddingStyle: new(0), + backgroundStyle: new( + color1: ConfigHelper.DeserializeFromConfigColorString( + this.MouseJumpScreenColor1), + color2: ConfigHelper.DeserializeFromConfigColorString( + this.MouseJumpScreenColor2) + ) + )), + _ => throw new InvalidOperationException( + $"Unhandled {nameof(MouseJumpPreviewType)} '{previewType}'"), + }; + + var previewLayout = LayoutHelper.GetPreviewLayout( + previewStyle: previewStyle, + screens: screens, + activatedLocation: new(0, 0)); + + var desktopImage = MouseUtilsViewModel.MouseJumpDesktopImage.Value; + var imageCopyService = new StaticImageRegionCopyService(desktopImage); + using var previewImage = DrawingHelper.RenderPreview( + previewLayout, + imageCopyService); + + // save the image to a memory stream + using var stream = new MemoryStream(); + previewImage.Save(stream, ImageFormat.Png); + stream.Position = 0; + + // load the memory stream into a bitmap image + var bitmap = new BitmapImage(); + var rnd = stream.AsRandomAccessStream(); + bitmap.DecodePixelWidth = previewImage.Width; + bitmap.DecodePixelHeight = previewImage.Height; + bitmap.SetSource(rnd); + return bitmap; + } + } + + public string MouseJumpPreviewType + { + get + { + return MouseJumpSettingsConfig.Properties.PreviewType; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.PreviewType) + { + MouseJumpSettingsConfig.Properties.PreviewType = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public string MouseJumpBackgroundColor1 + { + get + { + var value = MouseJumpSettingsConfig.Properties.BackgroundColor1; + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + return value; + } + + set + { + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + if (!value.Equals(MouseJumpSettingsConfig.Properties.BackgroundColor1, StringComparison.OrdinalIgnoreCase)) + { + MouseJumpSettingsConfig.Properties.BackgroundColor1 = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public string MouseJumpBackgroundColor2 + { + get + { + var value = MouseJumpSettingsConfig.Properties.BackgroundColor2; + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + return value; + } + + set + { + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + if (!value.Equals(MouseJumpSettingsConfig.Properties.BackgroundColor2, StringComparison.OrdinalIgnoreCase)) + { + MouseJumpSettingsConfig.Properties.BackgroundColor2 = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public int MouseJumpBorderThickness + { + get + { + return MouseJumpSettingsConfig.Properties.BorderThickness; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.BorderThickness) + { + MouseJumpSettingsConfig.Properties.BorderThickness = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public string MouseJumpBorderColor + { + get + { + var value = MouseJumpSettingsConfig.Properties.BorderColor; + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + return value; + } + + set + { + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + if (!value.Equals(MouseJumpSettingsConfig.Properties.BorderColor, StringComparison.OrdinalIgnoreCase)) + { + MouseJumpSettingsConfig.Properties.BorderColor = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public int MouseJumpBorder3dDepth + { + get + { + return MouseJumpSettingsConfig.Properties.Border3dDepth; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.Border3dDepth) + { + MouseJumpSettingsConfig.Properties.Border3dDepth = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public int MouseJumpBorderPadding + { + get + { + return MouseJumpSettingsConfig.Properties.BorderPadding; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.BorderPadding) + { + MouseJumpSettingsConfig.Properties.BorderPadding = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public int MouseJumpBezelThickness + { + get + { + return MouseJumpSettingsConfig.Properties.BezelThickness; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.BezelThickness) + { + MouseJumpSettingsConfig.Properties.BezelThickness = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public string MouseJumpBezelColor + { + get + { + var value = MouseJumpSettingsConfig.Properties.BezelColor; + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + return value; + } + + set + { + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + if (!value.Equals(MouseJumpSettingsConfig.Properties.BezelColor, StringComparison.OrdinalIgnoreCase)) + { + MouseJumpSettingsConfig.Properties.BezelColor = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public int MouseJumpBezel3dDepth + { + get + { + return MouseJumpSettingsConfig.Properties.Bezel3dDepth; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.Bezel3dDepth) + { + MouseJumpSettingsConfig.Properties.Bezel3dDepth = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public int MouseJumpScreenMargin + { + get + { + return MouseJumpSettingsConfig.Properties.ScreenMargin; + } + + set + { + if (value != MouseJumpSettingsConfig.Properties.ScreenMargin) + { + MouseJumpSettingsConfig.Properties.ScreenMargin = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public string MouseJumpScreenColor1 + { + get + { + var value = MouseJumpSettingsConfig.Properties.ScreenColor1; + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + return value; + } + + set + { + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + if (!value.Equals(MouseJumpSettingsConfig.Properties.ScreenColor1, StringComparison.OrdinalIgnoreCase)) + { + MouseJumpSettingsConfig.Properties.ScreenColor1 = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public string MouseJumpScreenColor2 + { + get + { + var value = MouseJumpSettingsConfig.Properties.ScreenColor2; + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + return value; + } + + set + { + value = (value != null) ? SettingsUtilities.ToRGBHex(value) : "#000000"; + if (!value.Equals(MouseJumpSettingsConfig.Properties.ScreenColor2, StringComparison.OrdinalIgnoreCase)) + { + MouseJumpSettingsConfig.Properties.ScreenColor2 = value; + NotifyMouseJumpPropertyChanged(); + NotifyMouseJumpPropertyChanged(nameof(this.MouseJumpPreviewImage)); + } + } + } + + public void MouseJumpThumbnailSizePropertyChanged(object sender, PropertyChangedEventArgs e) + { + NotifyMouseJumpPropertyChanged(nameof(MouseJumpThumbnailSize)); + } + + public void NotifyMouseJumpPropertyChanged([CallerMemberName] string propertyName = null) + { + OnPropertyChanged(propertyName); + + SndMouseJumpSettings outsettings = new SndMouseJumpSettings(MouseJumpSettingsConfig); + SndModuleSettings ipcMessage = new SndModuleSettings(outsettings); + SendConfigMSG(ipcMessage.ToJsonString()); + SettingsUtils.SaveSettings(MouseJumpSettingsConfig.ToJsonString(), MouseJumpSettings.ModuleName); + } + } +} diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs index bc9eb69c12..bf56b312dd 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs @@ -13,6 +13,7 @@ using System.Runtime.CompilerServices; using System.Text.Json; using System.Threading; using System.Threading.Tasks; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Helpers; @@ -38,7 +39,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels 0, }; - private readonly object _machineMatrixStringLock = new(); + private readonly Lock _machineMatrixStringLock = new(); private static readonly Dictionary StatusColors = new Dictionary() { diff --git a/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs index b1cceb8afb..11e3d3ee46 100644 --- a/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/NewPlusViewModel.cs @@ -10,6 +10,7 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; using System.Windows; + using Common.UI; using global::PowerToys.GPOWrapper; using ManagedCommon; @@ -21,6 +22,7 @@ using Microsoft.PowerToys.Settings.UI.Library.Utilities; using Microsoft.PowerToys.Settings.UI.Library.ViewModels.Commands; using Windows.ApplicationModel.VoiceCommands; using Windows.System; + using static Microsoft.PowerToys.Settings.UI.Helpers.ShellGetFolder; namespace Microsoft.PowerToys.Settings.UI.ViewModels @@ -47,9 +49,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels Settings = LoadSettings(settingsUtils); // Initialize properties - _hideFileExtension = Settings.HideFileExtension; - _hideStartingDigits = Settings.HideStartingDigits; - _templateLocation = Settings.TemplateLocation; + _hideFileExtension = Settings.Properties.HideFileExtension.Value; + _hideStartingDigits = Settings.Properties.HideStartingDigits.Value; + _templateLocation = Settings.Properties.TemplateLocation.Value; InitializeEnabledValue(); InitializeGpoValues(); @@ -119,12 +121,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels if (_templateLocation != value) { _templateLocation = value; - Settings.TemplateLocation = value; + Settings.Properties.TemplateLocation.Value = value; OnPropertyChanged(nameof(TemplateLocation)); NotifySettingsChanged(); - - SaveSettingsToJson(); } } } @@ -146,12 +146,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels if (_hideFileExtension != value && !_hideFileExtensionIsGPOConfigured) { _hideFileExtension = value; - Settings.HideFileExtension = value; + Settings.Properties.HideFileExtension.Value = value; OnPropertyChanged(nameof(HideFileExtension)); NotifySettingsChanged(); - - SaveSettingsToJson(); } } } @@ -168,12 +166,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels if (_hideStartingDigits != value) { _hideStartingDigits = value; - Settings.HideStartingDigits = value; + Settings.Properties.HideStartingDigits.Value = value; OnPropertyChanged(nameof(HideStartingDigits)); NotifySettingsChanged(); - - SaveSettingsToJson(); } } } @@ -208,10 +204,10 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { settings = settingsUtils.GetSettingsOrDefault(NewPlusSettings.ModuleName); - if (string.IsNullOrEmpty(settings.TemplateLocation)) + if (string.IsNullOrEmpty(settings.Properties.TemplateLocation.Value)) { // This can happen when running the DEBUG Settings application without first letting the runner create the default settings file. - settings.TemplateLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "NewPlus", "Templates"); + settings.Properties.TemplateLocation.Value = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "NewPlus", "Templates"); } } catch (Exception e) @@ -256,12 +252,21 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void OpenNewTemplateFolder() { - var process = new ProcessStartInfo() + try { - FileName = _templateLocation, - UseShellExecute = true, - }; - Process.Start(process); + CopyTemplateExamples(_templateLocation); + + var process = new ProcessStartInfo() + { + FileName = _templateLocation, + UseShellExecute = true, + }; + Process.Start(process); + } + catch (Exception ex) + { + Logger.LogError("Failed to show NewPlus template folder.", ex); + } } private async void PickNewTemplateFolder() @@ -278,10 +283,5 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels var hwnd = WinRT.Interop.WindowNative.GetWindowHandle(App.GetSettingsWindow()); return await Task.FromResult(GetFolderDialogWithFlags(hwnd, FolderDialogFlags._BIF_NEWDIALOGSTYLE)); } - - private void SaveSettingsToJson() - { - _settingsUtils.SaveSettings(Settings.ToJsonString(), ModuleName); - } } } diff --git a/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs index 4672d0dabf..b3e6483e6c 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PeekViewModel.cs @@ -5,6 +5,7 @@ using System; using System.Globalization; using System.Text.Json; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/PluginAdditionalOptionViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PluginAdditionalOptionViewModel.cs index 02b83228c7..c77d2c0596 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PluginAdditionalOptionViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PluginAdditionalOptionViewModel.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.Runtime.CompilerServices; + using Microsoft.PowerToys.Settings.UI.Library; namespace Microsoft.PowerToys.Settings.UI.ViewModels diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs index 99ef36afb9..0c4f9db650 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerAccentViewModel.cs @@ -3,8 +3,11 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Generic; +using System.Linq; using System.Runtime.CompilerServices; using global::PowerToys.GPOWrapper; +using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Enumerations; using Microsoft.PowerToys.Settings.UI.Library.Helpers; @@ -20,49 +23,53 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private readonly ISettingsUtils _settingsUtils; - // These should be in the same order as the ComboBoxItems in PowerAccentPage.xaml - private readonly string[] _languageOptions = - { - "ALL", - "BG", - "CA", - "CRH", - "CUR", - "HR", - "CZ", - "DK", - "GA", - "GD", - "NL", - "EL", - "EST", - "EPO", - "FI", - "FR", - "DE", - "HE", - "HU", - "IS", - "IPA", - "IT", - "KU", - "LT", - "MK", - "MI", - "NO", - "PI", - "PL", - "PT", - "RO", - "ROM", - "SK", - "SL", - "SP", - "SR", - "SV", - "TK", - "CY", - }; + private const string SpecialGroup = "QuickAccent_Group_Special"; + private const string LanguageGroup = "QuickAccent_Group_Language"; + + public List Languages { get; } = [ + new PowerAccentLanguageModel("SPECIAL", "QuickAccent_SelectedLanguage_Special", SpecialGroup), + new PowerAccentLanguageModel("BG", "QuickAccent_SelectedLanguage_Bulgarian", LanguageGroup), + new PowerAccentLanguageModel("CA", "QuickAccent_SelectedLanguage_Catalan", LanguageGroup), + new PowerAccentLanguageModel("CRH", "QuickAccent_SelectedLanguage_Crimean", LanguageGroup), + new PowerAccentLanguageModel("CUR", "QuickAccent_SelectedLanguage_Currency", SpecialGroup), + new PowerAccentLanguageModel("HR", "QuickAccent_SelectedLanguage_Croatian", LanguageGroup), + new PowerAccentLanguageModel("CZ", "QuickAccent_SelectedLanguage_Czech", LanguageGroup), + new PowerAccentLanguageModel("DK", "QuickAccent_SelectedLanguage_Danish", LanguageGroup), + new PowerAccentLanguageModel("GA", "QuickAccent_SelectedLanguage_Gaeilge", LanguageGroup), + new PowerAccentLanguageModel("GD", "QuickAccent_SelectedLanguage_Gaidhlig", LanguageGroup), + new PowerAccentLanguageModel("NL", "QuickAccent_SelectedLanguage_Dutch", LanguageGroup), + new PowerAccentLanguageModel("EL", "QuickAccent_SelectedLanguage_Greek", LanguageGroup), + new PowerAccentLanguageModel("EST", "QuickAccent_SelectedLanguage_Estonian", LanguageGroup), + new PowerAccentLanguageModel("EPO", "QuickAccent_SelectedLanguage_Esperanto", LanguageGroup), + new PowerAccentLanguageModel("FI", "QuickAccent_SelectedLanguage_Finnish", LanguageGroup), + new PowerAccentLanguageModel("FR", "QuickAccent_SelectedLanguage_French", LanguageGroup), + new PowerAccentLanguageModel("DE", "QuickAccent_SelectedLanguage_German", LanguageGroup), + new PowerAccentLanguageModel("HE", "QuickAccent_SelectedLanguage_Hebrew", LanguageGroup), + new PowerAccentLanguageModel("HU", "QuickAccent_SelectedLanguage_Hungarian", LanguageGroup), + new PowerAccentLanguageModel("IS", "QuickAccent_SelectedLanguage_Icelandic", LanguageGroup), + new PowerAccentLanguageModel("IPA", "QuickAccent_SelectedLanguage_IPA", SpecialGroup), + new PowerAccentLanguageModel("IT", "QuickAccent_SelectedLanguage_Italian", LanguageGroup), + new PowerAccentLanguageModel("KU", "QuickAccent_SelectedLanguage_Kurdish", LanguageGroup), + new PowerAccentLanguageModel("LT", "QuickAccent_SelectedLanguage_Lithuanian", LanguageGroup), + new PowerAccentLanguageModel("MK", "QuickAccent_SelectedLanguage_Macedonian", LanguageGroup), + new PowerAccentLanguageModel("MI", "QuickAccent_SelectedLanguage_Maori", LanguageGroup), + new PowerAccentLanguageModel("NO", "QuickAccent_SelectedLanguage_Norwegian", LanguageGroup), + new PowerAccentLanguageModel("PI", "QuickAccent_SelectedLanguage_Pinyin", LanguageGroup), + new PowerAccentLanguageModel("PL", "QuickAccent_SelectedLanguage_Polish", LanguageGroup), + new PowerAccentLanguageModel("PT", "QuickAccent_SelectedLanguage_Portuguese", LanguageGroup), + new PowerAccentLanguageModel("RO", "QuickAccent_SelectedLanguage_Romanian", LanguageGroup), + new PowerAccentLanguageModel("ROM", "QuickAccent_SelectedLanguage_Romanization", SpecialGroup), + new PowerAccentLanguageModel("SK", "QuickAccent_SelectedLanguage_Slovak", LanguageGroup), + new PowerAccentLanguageModel("SL", "QuickAccent_SelectedLanguage_Slovenian", LanguageGroup), + new PowerAccentLanguageModel("SP", "QuickAccent_SelectedLanguage_Spanish", LanguageGroup), + new PowerAccentLanguageModel("SR", "QuickAccent_SelectedLanguage_Serbian", LanguageGroup), + new PowerAccentLanguageModel("SR_CYRL", "QuickAccent_SelectedLanguage_Serbian_Cyrillic", LanguageGroup), + new PowerAccentLanguageModel("SV", "QuickAccent_SelectedLanguage_Swedish", LanguageGroup), + new PowerAccentLanguageModel("TK", "QuickAccent_SelectedLanguage_Turkish", LanguageGroup), + new PowerAccentLanguageModel("CY", "QuickAccent_SelectedLanguage_Welsh", LanguageGroup), + ]; + + public PowerAccentLanguageGroupModel[] LanguageGroups { get; private set; } private readonly string[] _toolbarOptions = { @@ -88,6 +95,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels GeneralSettingsConfig = settingsRepository.SettingsConfig; InitializeEnabledValue(); + InitializeLanguages(); if (_settingsUtils.SettingsExists(PowerAccentSettings.ModuleName)) { @@ -102,7 +110,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels _excludedApps = _powerAccentSettings.Properties.ExcludedApps.Value; - _selectedLangIndex = Array.IndexOf(_languageOptions, _powerAccentSettings.Properties.SelectedLang.Value); + if (!string.IsNullOrWhiteSpace(_powerAccentSettings.Properties.SelectedLang.Value) && !_powerAccentSettings.Properties.SelectedLang.Value.Contains("ALL")) + { + SelectedLanguageOptions = _powerAccentSettings.Properties.SelectedLang.Value.Split(',') + .Select(l => Languages.Find(lang => lang.LanguageCode == l)) + .ToArray(); + } + else if (_powerAccentSettings.Properties.SelectedLang.Value.Contains("ALL")) + { + SelectedLanguageOptions = Languages.ToArray(); + } + else + { + SelectedLanguageOptions = Array.Empty(); + } _toolbarPositionIndex = Array.IndexOf(_toolbarOptions, _powerAccentSettings.Properties.ToolbarPosition.Value); @@ -125,6 +146,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } } + /// + /// Adds Localized Language Name, sorts by it and splits languages into two groups. + /// + private void InitializeLanguages() + { + foreach (var item in Languages) + { + item.Language = ResourceLoaderInstance.ResourceLoader.GetString(item.LanguageResourceID); + } + + Languages.Sort((x, y) => string.Compare(x.Language, y.Language, StringComparison.Ordinal)); + LanguageGroups = Languages + .GroupBy(language => language.GroupResourceID) + .Select(grp => new PowerAccentLanguageGroupModel(grp.ToList(), ResourceLoaderInstance.ResourceLoader.GetString(grp.Key))) + .ToArray(); + } + public bool IsEnabled { get => _isEnabled; @@ -251,23 +289,18 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels } } - private int _selectedLangIndex; + public bool AllSelected => _selectedLanguageOptions.Length == Languages.Count; - public int SelectedLangIndex + private PowerAccentLanguageModel[] _selectedLanguageOptions; + + public PowerAccentLanguageModel[] SelectedLanguageOptions { - get - { - return _selectedLangIndex; - } - + get => _selectedLanguageOptions; set { - if (_selectedLangIndex != value) - { - _selectedLangIndex = value; - _powerAccentSettings.Properties.SelectedLang.Value = _languageOptions[value]; - RaisePropertyChanged(nameof(SelectedLangIndex)); - } + _selectedLanguageOptions = value; + _powerAccentSettings.Properties.SelectedLang.Value = string.Join(',', _selectedLanguageOptions.Select(l => l.LanguageCode)); + RaisePropertyChanged(nameof(SelectedLanguageOptions)); } } diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs index c350222c35..f8cc3b46f1 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherPluginViewModel.cs @@ -8,6 +8,7 @@ using System.ComponentModel; using System.IO; using System.Linq; using System.Runtime.CompilerServices; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs index 9bb10b8d2f..ee0781ce91 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -10,6 +10,7 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Text.Json; using System.Windows.Input; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs index a52924860b..dc09c2cad9 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerOcrViewModel.cs @@ -9,6 +9,7 @@ using System.Globalization; using System.Linq; using System.Text.Json; using System.Timers; + using Common.UI; using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; @@ -29,7 +30,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private GeneralSettings GeneralSettingsConfig { get; set; } private readonly ISettingsUtils _settingsUtils; - private readonly object _delayedActionLock = new object(); + private readonly System.Threading.Lock _delayedActionLock = new System.Threading.Lock(); private readonly PowerOcrSettings _powerOcrSettings; private Timer _delayedTimer; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs index fa494f6cd5..3c8904803f 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerPreviewViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.CompilerServices; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs index 602c16cf6b..00616bd678 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerRenameViewModel.cs @@ -5,6 +5,7 @@ using System; using System.IO; using System.Runtime.CompilerServices; + using global::PowerToys.GPOWrapper; using ManagedCommon; using Microsoft.PowerToys.Settings.UI.Library; diff --git a/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs index 77a2e5c870..f6edc99524 100644 --- a/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/RegistryPreviewViewModel.cs @@ -5,6 +5,7 @@ using System; using System.Globalization; using System.Text.Json; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs index b222c4ddf9..0779293204 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs @@ -5,10 +5,10 @@ using System; using System.Collections.Generic; using System.IO; -using System.IO.Abstractions; using System.Linq; using System.Threading.Tasks; using System.Windows.Input; + using Microsoft.PowerToys.Settings.UI.Helpers; using Microsoft.PowerToys.Settings.UI.Library.Helpers; using Microsoft.PowerToys.Settings.UI.Services; @@ -31,6 +31,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private NavigationViewItem selected; private ICommand loadedCommand; private ICommand itemInvokedCommand; + private NavigationViewItem[] _fullListOfNavViewItems; public bool IsBackEnabled { @@ -75,6 +76,8 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels NavigationService.NavigationFailed += Frame_NavigationFailed; NavigationService.Navigated += Frame_Navigated; this.navigationView.BackRequested += OnBackRequested; + var topLevelItems = navigationView.MenuItems.OfType(); + _fullListOfNavViewItems = topLevelItems.Union(topLevelItems.SelectMany(menuItem => menuItem.MenuItems.OfType())).ToArray(); } private static KeyboardAccelerator BuildKeyboardAccelerator(VirtualKey key, VirtualKeyModifiers? modifiers = null) @@ -106,11 +109,12 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void OnItemInvoked(NavigationViewItemInvokedEventArgs args) { - var item = navigationView.MenuItems - .OfType() - .First(menuItem => (string)menuItem.Content == (string)args.InvokedItem); - var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type; - NavigationService.Navigate(pageType); + var pageType = args.InvokedItemContainer.GetValue(NavHelper.NavigateToProperty) as Type; + + if (pageType != null) + { + NavigationService.Navigate(pageType); + } } private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args) @@ -126,9 +130,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels private void Frame_Navigated(object sender, NavigationEventArgs e) { IsBackEnabled = NavigationService.CanGoBack; - Selected = navigationView.MenuItems - .OfType() - .FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType)); + Selected = _fullListOfNavViewItems.FirstOrDefault(menuItem => IsMenuItemForPageType(menuItem, e.SourcePageType)); } private static bool IsMenuItemForPageType(NavigationViewItem menuItem, Type sourcePageType) diff --git a/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs index 1ec77c81dc..e98b62dea4 100644 --- a/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/ShortcutGuideViewModel.cs @@ -4,6 +4,7 @@ using System; using System.Runtime.CompilerServices; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs index b3abc2a215..21d3a7eb92 100644 --- a/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/VideoConferenceViewModel.cs @@ -10,6 +10,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text.Json; using System.Threading.Tasks; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/src/settings-ui/Settings.UI/ViewModels/WorkspacesViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/WorkspacesViewModel.cs index b3cee17070..ff7ff1bf88 100644 --- a/src/settings-ui/Settings.UI/ViewModels/WorkspacesViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/WorkspacesViewModel.cs @@ -6,6 +6,7 @@ using System; using System.Globalization; using System.Runtime.CompilerServices; using System.Text.Json; + using global::PowerToys.GPOWrapper; using Microsoft.PowerToys.Settings.UI.Library; using Microsoft.PowerToys.Settings.UI.Library.Helpers; diff --git a/tools/BugReportTool/BugReportTool/Main.cpp b/tools/BugReportTool/BugReportTool/Main.cpp index 18a5b68889..1675255f2c 100644 --- a/tools/BugReportTool/BugReportTool/Main.cpp +++ b/tools/BugReportTool/BugReportTool/Main.cpp @@ -56,6 +56,7 @@ vector filesToDelete = { L"PowerToys Run\\Settings\\UserSelectedRecord.json", L"PowerToys Run\\Settings\\QueryHistory.json", L"NewPlus\\Templates", + L"etw", }; vector GetXpathArray(wstring xpath) diff --git a/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp b/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp index cab28b4e35..7a486aeab8 100644 --- a/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp +++ b/tools/BugReportTool/BugReportTool/ReportGPOValues.cpp @@ -7,7 +7,8 @@ std::wstring gpo_rule_configured_to_string(powertoys_gpo::gpo_rule_configured_t gpo_rule) { - switch (gpo_rule) { + switch (gpo_rule) + { case powertoys_gpo::gpo_rule_configured_wrong_value: return L"wrong_value"; case powertoys_gpo::gpo_rule_configured_unavailable: @@ -35,7 +36,7 @@ std::wstring gpo_string_to_string(const std::wstring &gpo_value) } } -void ReportGPOValues(const std::filesystem::path& tmpDir) +void ReportGPOValues(const std::filesystem::path &tmpDir) { auto reportPath = tmpDir; reportPath.append(L"gpo-configuration-info.txt"); @@ -92,4 +93,5 @@ void ReportGPOValues(const std::filesystem::path& tmpDir) report << "getConfiguredMwbPolicyDefinedIpMappingRules: " << gpo_string_to_string(powertoys_gpo::getConfiguredMwbPolicyDefinedIpMappingRules()) << std::endl; report << "getConfiguredNewPlusEnabledValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredNewPlusEnabledValue()) << std::endl; report << "getConfiguredNewPlusHideTemplateFilenameExtensionValue: " << gpo_rule_configured_to_string(powertoys_gpo::getConfiguredNewPlusHideTemplateFilenameExtensionValue()) << std::endl; + report << "getAllowDataDiagnosticsValue: " << gpo_rule_configured_to_string(powertoys_gpo::getAllowDataDiagnosticsValue()) << std::endl; } diff --git a/tools/project_template/ModuleTemplate/pch.h b/tools/project_template/ModuleTemplate/pch.h index 13be94dff6..053431799d 100644 --- a/tools/project_template/ModuleTemplate/pch.h +++ b/tools/project_template/ModuleTemplate/pch.h @@ -3,4 +3,3 @@ #include #include #include -#include diff --git a/tools/project_template/ModuleTemplate/trace.cpp b/tools/project_template/ModuleTemplate/trace.cpp index d8c81500f8..c8633db0fe 100644 --- a/tools/project_template/ModuleTemplate/trace.cpp +++ b/tools/project_template/ModuleTemplate/trace.cpp @@ -1,6 +1,8 @@ #include "pch.h" #include "trace.h" +#include + TRACELOGGING_DEFINE_PROVIDER( g_hProvider, "Microsoft.PowerToys", @@ -8,19 +10,9 @@ TRACELOGGING_DEFINE_PROVIDER( (0x38e8889b, 0x9731, 0x53f5, 0xe9, 0x01, 0xe8, 0xa7, 0xc1, 0x75, 0x30, 0x74), TraceLoggingOptionProjectTelemetry()); -void Trace::RegisterProvider() -{ - TraceLoggingRegister(g_hProvider); -} - -void Trace::UnregisterProvider() -{ - TraceLoggingUnregister(g_hProvider); -} - void Trace::MyEvent() { - TraceLoggingWrite( + TraceLoggingWriteWrapper( g_hProvider, "PowerToyName_MyEvent", ProjectTelemetryPrivacyDataTag(ProjectTelemetryTag_ProductAndServicePerformance), diff --git a/tools/project_template/ModuleTemplate/trace.h b/tools/project_template/ModuleTemplate/trace.h index 3939f62fd1..a7e29ee830 100644 --- a/tools/project_template/ModuleTemplate/trace.h +++ b/tools/project_template/ModuleTemplate/trace.h @@ -1,9 +1,9 @@ #pragma once -class Trace +#include + +class Trace : public telemetry::TraceBase { public: - static void RegisterProvider(); - static void UnregisterProvider(); static void MyEvent(); };