diff --git a/.github/actions/spell-check/excludes.txt b/.github/actions/spell-check/excludes.txt index 3e04a7f21f55..d57db991783f 100644 --- a/.github/actions/spell-check/excludes.txt +++ b/.github/actions/spell-check/excludes.txt @@ -3,11 +3,11 @@ (?:^|/)(?i)LICEN[CS]E (?:^|/)3rdparty/ (?:^|/)go\.sum$ -(?:^|/)MonacoPreviewHandler/customLanguages/ -(?:^|/)MonacoPreviewHandler/generateLanguagesJson.html -(?:^|/)MonacoPreviewHandler/index.html -(?:^|/)MonacoPreviewHandler/monaco_languages.json -(?:^|/)MonacoPreviewHandler/monacoSpecialLanguages.js +(?:^|/)FilePreviewCommon/customLanguages/ +(?:^|/)FilePreviewCommon/generateLanguagesJson.html +(?:^|/)FilePreviewCommon/index.html +(?:^|/)FilePreviewCommon/monaco_languages.json +(?:^|/)FilePreviewCommon/monacoSpecialLanguages.js (?:^|/)monacoSRC/ (?:^|/)package(?:-lock|)\.json$ (?:^|/)timezones\.json$ @@ -100,6 +100,7 @@ ^src/modules/imageresizer/dll/ContextMenuHandler\.rgs$ ^src/modules/imageresizer/dll/ImageResizerExt\.rgs$ ^src/modules/MouseUtils/MouseJumpUI/NativeMethods/User32/UI/WindowsAndMessaging/User32.SYSTEM_METRICS_INDEX.cs$ +^src/modules/peek/Peek\.Common/NativeMethods\.txt$ ^src/modules/powerrename/testapp/PowerRenameTest\.vcxproj\.filters$ ^src/modules/previewpane/PreviewPaneUnitTests/HelperFiles/MarkdownWithHTMLImageTag\.txt$ ^src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HelperFiles/MarkdownWithHTMLImageTag.txt$ diff --git a/.github/actions/spell-check/expect.txt b/.github/actions/spell-check/expect.txt index 40eaa8397a30..508c7f050e60 100644 --- a/.github/actions/spell-check/expect.txt +++ b/.github/actions/spell-check/expect.txt @@ -58,6 +58,7 @@ alekhyareddy ALLAPPS ALLINPUT ALLOWUNDO +ALLVIEW ALPHATYPE Altdown alwaysontop @@ -76,6 +77,7 @@ aocfnapldcnfbofgmbbllojgocaelgdd AOT APARTMENTTHREADED APeriod +apidl APIENTRY APIIs APPBARDATA @@ -100,6 +102,7 @@ ARCHITEW arcosh ARemapped argb +ari arik Arity arjunbalgovind @@ -108,6 +111,7 @@ ARPPRODUCTICON ARRAYSIZE arsinh artanh +arw asdf AShortcut ASingle @@ -213,6 +217,7 @@ BUILDNUMBER buildtask buildtransitive BUTTONUP +BVal BValue BYPOSITION bytearray @@ -220,10 +225,12 @@ CABD CALG callbackptr cameligo +calpwstr Cangjie CANRENAME CAPTUREBLT CAPTURECHANGED +CARRAY CAtl CBA CBB @@ -247,6 +254,7 @@ CEAF CEBAC CEBD CECB +CElems CENTERALIGN ceq certlm @@ -263,8 +271,10 @@ chdir CHILDACTIVATE CHILDWINDOW chrdavis +Chromakey Chrzan CHT +cidl CIELAB CIEXYZ cim @@ -362,6 +372,7 @@ CRECT critsec Crossdevice CRSEL +crw CSearch CSettings CSIDL @@ -380,6 +391,7 @@ CURSORINFO cursorpos customaction CUSTOMACTIONTEST +CVal cvd CVirtual cvtepu @@ -399,6 +411,7 @@ Dac dacl DAF damienleroy +DANGEROUSLYCOMMITMERELYTODISKCACHE DARKPURPLE DARKTEAL DARKYELLOW @@ -428,12 +441,15 @@ dcommon dcomp dcompi DComposition -DCR -DCs +dcr +dcs +Dct DDCDD DDCE +DDEIf DDevice ddf +Dds DDxgi Deact debian @@ -510,6 +526,7 @@ DQTYPE DRAWFRAME drawingcolor dreamsofameaningfullife +drf drivedetectionwarning dshow DSTINVERT @@ -581,6 +598,7 @@ EFDD EFE EFFEFC EFile +eip ekus emmintrin Emoji @@ -619,9 +637,13 @@ EWXLOGOFF EWXPOWEROFF EWXREBOOT EWXSHUTDOWN +Exa +exabyte examplehandler examplepowertoy EXAND +Excep +EXCEPINFO EXCLUDEFROMCAPTURE exdisp executionpolicy @@ -637,6 +659,7 @@ EXSEL exstyle EXTENDEDKEY EXTENDEDVERBS +EXTRINSICPROPERTIES eyetracker FABC fabricbot @@ -691,7 +714,7 @@ FILEOP FILEOS FILESUBTYPE FILESYSPATH -FILETIME +filetime FILEVERSION Filtergraph Filterkeyboard @@ -736,6 +759,7 @@ GETDLGCODE GETDPISCALEDSIZE GETICON GETMINMAXINFO +GETPROPERTYSTOREFLAGS GETSTATE GETTEXT GETTEXTLENGTH @@ -782,6 +806,7 @@ HCRYPTHASH HCRYPTPROV hcwhite hdc +HDR hdrop hdwwiz HEB @@ -795,8 +820,9 @@ HHmmss HHOOK hhx HIBYTE -HICON +hicon HIDEWINDOW +hif highlighter HIMAGELIST himl @@ -846,6 +872,7 @@ HTCLIENT HTHUMBNAIL HTOUCHINPUT HTTRANSPARENT +HVal HValue Hvci hwb @@ -859,12 +886,17 @@ HWNDPREV hyjiacan IBase IBeam +IBitmap +IBlock ICapture ICEBLUE IClass +IColor ICONERROR +IContext IData IDD +IDecoder IDesktop IDirect idl @@ -873,16 +905,20 @@ IDOn IDR idx IDXGI +IEncoder +IEnum IExec IEXPLORE Iface IFACEMETHOD IFACEMETHODIMP +IFile IFilter IGraphics iid Iindex IIO +iiq Ijwhost IKs ILogon @@ -894,6 +930,7 @@ imageresizerinput imageresizersettings imagingdevices ime +IMetadata imeutil inetcpl Infobar @@ -931,14 +968,17 @@ Interlop INTRESOURCE INVALIDARG invalidoperatioexception +IPalette ipc ipcmanager IPlugin IPower -IPREVIEW +ipreview ipreviewhandlervisualssetfont IProperty IPublic +IQuery +IReader irprops isbi ISearch @@ -946,10 +986,12 @@ ISettings isfinite IShell isocpp +ISource iss +ISurface ITask ith -ITHUMBNAIL +ithumbnail IUI IUnknown IWbem @@ -957,8 +999,10 @@ IWIC iwr IYUV JArray +jfi jfif jgeosdfsdsgmkedfgdfgdfgbkmhcgcflmi +jif jjw jobject joefinapps @@ -973,6 +1017,7 @@ jxr jyuwono KBDLLHOOKSTRUCT kbm +kdc KEYBDINPUT keyboardeventhandlers keyboardmanager @@ -1008,6 +1053,7 @@ LBUTTON LBUTTONDBLCLK LBUTTONDOWN LBUTTONUP +Lcid LCIDTo lcl Lclean @@ -1050,6 +1096,8 @@ LOCALPACKAGE localport LOCALSYSTEM LOCATIONCHANGE +LOCKBYTES +LOCKTYPE logconsole logfile LOGFONT @@ -1101,6 +1149,7 @@ LTRB LTRREADING luid lusrmgr +LVal LWA lwin LZero @@ -1133,6 +1182,7 @@ MBUTTON MBUTTONDBLCLK MBUTTONDOWN MBUTTONUP +mdc MDICHILD MDL mdtext @@ -1140,6 +1190,8 @@ mdtxt mdwn MEDIASUBTYPE mediatype +mef +Mega Melman MENUITEMINFO MENUITEMINFOW @@ -1208,6 +1260,7 @@ mozilla mpmc MRM mru +mrw msbuild msc msclr @@ -1306,6 +1359,7 @@ NONCONVERT NONELEVATED NONINFRINGEMENT nonstd +NOOPEN NOOWNERZORDER NOPARENTNOTIFY NOREDIRECTIONBITMAP @@ -1334,6 +1388,7 @@ NOUPDATE NOZORDER NPH NResize +nrw NTAPI ntdll ntfs @@ -1366,6 +1421,8 @@ OLEDB OLIVEGREEN onebranch onenote +ONLYIFCURRENT +ONLYONCE onstd oobe OOBEPT @@ -1374,6 +1431,7 @@ opensource openxmlformats OPTIMIZEFORINVOKE ORAW +ori ORPHANEDDIALOGTITLE ORSCANS oss @@ -1415,10 +1473,14 @@ PATINVERT PATPAINT PAUDIO pbc -Pbgra +pbgra +PBlob pcb +pcch +pcelt pch PCIDLIST +pcs PCWSTR pdb pdbonly @@ -1428,10 +1490,14 @@ pdtobj pdw PDWORD pedrolamas +pef +PElems Pels PERCEIVEDFLAG +Percision perfmon pesi +petabyte peteblois PEXCEPTION pfn @@ -1440,6 +1506,7 @@ pft pgp pgsql pguid +pkey PHANDLE PHANDLER phbm @@ -1482,10 +1549,13 @@ POWERTOYNAME powertoyssetup powertoysusersetup Powrprof +ppenum ppidl ppmt pprm pproc +pprop +ppshv ppsi ppsid ppsrm @@ -1505,6 +1575,7 @@ previouscamera PREVIOUSINSTALLFOLDER PREVIOUSVERSIONSINSTALLED prevpane +PRGBA prgms pri PRINTCLIENT @@ -1521,15 +1592,20 @@ PROGRAMFILES projectname PROPBAG PROPERTYKEY +PROPERTYNOTFOUND propkey +PROPVARIANT propvarutil prvpane psapi +pscid PSECURITY psfgao Psr psrm psrree +pstatstg +pstm pstr pstream pstrm @@ -1541,7 +1617,9 @@ ptd PTOKEN PToy ptstr +pui PULONG +pvar pwa pwcs pwsh @@ -1562,13 +1640,16 @@ QUNS qwertyuiopasdfghjklzxcvbnm qword qwrtyuiopsghjklzxvnm +raf RAII RAlt randyrants +Rasterize RAWINPUT RAWINPUTDEVICE RAWINPUTHEADER RAWPATH +rbhid Rbp RBUTTON RBUTTONDBLCLK @@ -1639,8 +1720,11 @@ resw resx retval rfc +RGBE RGBQUAD rgbs +rgelt +rgf rgn rgs rhs @@ -1688,9 +1772,13 @@ Rutkas RValue rvm rwin +rwl +rwz ryanbodrug saahmedm +sachaple sacl +SAFEARRAY safeprojectname SAMEKEYPREVIOUSLYMAPPED SAMESHORTCUTPREVIOUSLYMAPPED @@ -1699,8 +1787,10 @@ SAVEFAILED scancode scanled schedtasks +SCID Scip scipbe +Scode scoobe SCOPEID screenshot @@ -1739,14 +1829,17 @@ SFP sharpkeys SHCNE SHCNF +SHCONTF shcore shellapi +SHELLDETAILS SHELLDLL shellex SHELLEXECUTEINFO SHELLEXECUTEINFOW shellscalingapi SHFILEINFO +SHGDNF SHGFI Shl shldisp @@ -1777,6 +1870,7 @@ SHOWNOACTIVATE SHOWNORMAL SHOWWINDOW shtypes +SIATTRIBFLAGS SICHINT sid siex @@ -1829,6 +1923,8 @@ SRCINVERT SRCPAINT sre SResize +srf +SRGB srme srre srw @@ -1857,15 +1953,20 @@ STDMETHODCALLTYPE STDMETHODIMP stefan Stereolithography +STGC STGM STGMEDIUM +STGTY sticpl stl storelogo STRINGIZE stringtable stringval +Strm Strmiids +Stroe +Strret strsafe strutil sttngs @@ -1928,6 +2029,7 @@ taskschd tchar tcl Tcollab +tcs tcscpy TCustom tdbuild @@ -1937,6 +2039,7 @@ telem telephon Templated templatenamespace +terabyte testapp testcase testhost @@ -1960,6 +2063,7 @@ Titlecase TKey TLayout tlb +tlbimp TMPVAR TNP toggleswitch @@ -2030,6 +2134,7 @@ unregistering unremapped unsubscribe unvirtualized +UOffset Updatelayout UPGRADINGPRODUCTCODE Uptool @@ -2037,6 +2142,7 @@ Usb USEDEFAULT USEFILEATTRIBUTES USERDATA +USERDEFINED USERDOMAIN userprofile USESHOWWINDOW @@ -2044,6 +2150,7 @@ USESTDHANDLES USRDLL Utc utf +UType uuidof uwp uxtheme @@ -2052,6 +2159,7 @@ vabdq validmodulename Vanara variantassignment +VARTYPE vcamp vccorlib vcdl @@ -2071,6 +2179,7 @@ VERBSONLY VERBW VERIFYCONTEXT verrsrc +VERSIONED VERSIONINFO Versioning VFT @@ -2151,7 +2260,7 @@ WINDOWNAME WINDOWPLACEMENT WINDOWPOSCHANGED WINDOWPOSCHANGING -Windowsapp +windowsapp WINDOWSBUILDNUMBER Windowscodecs windowssearch @@ -2222,6 +2331,7 @@ wpr wprp wql wregex +WReserved WResize writefile Wrk @@ -2273,6 +2383,7 @@ yinwang yinyue YOffset ypescript +YQuantized YResolution YStr YUY diff --git a/.pipelines/ESRPSigning_core.json b/.pipelines/ESRPSigning_core.json index fd0aedc5ae7e..ec5e874736e7 100644 --- a/.pipelines/ESRPSigning_core.json +++ b/.pipelines/ESRPSigning_core.json @@ -12,6 +12,7 @@ "Notifications.dll", "os-detection.dll", "PowerToys.exe", + "PowerToys.FilePreviewCommon.dll", "PowerToys.Interop.dll", "BugReportTool\\PowerToys.BugReportTool.exe", "WebcamReportTool\\PowerToys.WebcamReportTool.exe", @@ -88,6 +89,13 @@ "modules\\FileLocksmith\\PowerToys.FileLocksmithUI.exe", "modules\\FileLocksmith\\PowerToys.FileLocksmithUI.dll", + "modules\\Peek\\Peek.Common.dll", + "modules\\Peek\\Peek.FilePreviewer.dll", + "modules\\Peek\\Powertoys.Peek.UI.dll", + "modules\\Peek\\Powertoys.Peek.UI.exe", + "modules\\Peek\\WIC.dll", + "modules\\Peek\\Powertoys.Peek.dll", + "modules\\ImageResizer\\PowerToys.ImageResizer.exe", "modules\\ImageResizer\\PowerToys.ImageResizer.dll", "modules\\ImageResizer\\PowerToys.ImageResizerExt.dll", diff --git a/PowerToys.sln b/PowerToys.sln index 5bc55a0c742d..d6860478ad1e 100644 --- a/PowerToys.sln +++ b/PowerToys.sln @@ -465,6 +465,18 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GPOWrapper", "src\common\GP EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPOWrapperProjection", "src\common\GPOWrapperProjection\GPOWrapperProjection.csproj", "{00EE9BA6-4E8F-43CA-960D-D4882F0FBB97}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Peek", "Peek", "{17B4FA70-001E-4D33-BBBB-0D142DBC2E20}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Peek", "src\modules\peek\peek\peek.vcxproj", "{A1425B53-3D61-4679-8623-E64A0D3D0A48}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.UI", "src\modules\peek\Peek.UI\Peek.UI.csproj", "{9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.Common", "src\modules\peek\Peek.Common\Peek.Common.csproj", "{17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Peek.FilePreviewer", "src\modules\peek\Peek.FilePreviewer\Peek.FilePreviewer.csproj", "{AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WIC", "src\modules\peek\WIC\WIC.csproj", "{21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}" +EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MarkdownPreviewHandlerCpp", "src\modules\previewpane\MarkdownPreviewHandlerCpp\MarkdownPreviewHandlerCpp.vcxproj", "{ED9A1AC6-AEB0-4569-A6E9-E1696182B545}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GcodePreviewHandlerCpp", "src\modules\previewpane\GcodePreviewHandlerCpp\GcodePreviewHandlerCpp.vcxproj", "{5A5DD09D-723A-44D3-8F2B-293584C3D731}" @@ -501,6 +513,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RegistryPreviewExt", "src\m EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "RegistryPreview", "RegistryPreview", "{929C1324-22E8-4412-A9A8-80E85F3985A5}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FilePreviewCommon", "src\common\FilePreviewCommon\FilePreviewCommon.csproj", "{9EBAA524-0EDA-470B-95D4-39383285CBB2}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.PowerToys.Run.Plugin.PowerToys", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.PowerToys\Microsoft.PowerToys.Run.Plugin.PowerToys.csproj", "{500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D}" EndProject Global @@ -1907,6 +1921,72 @@ Global {00EE9BA6-4E8F-43CA-960D-D4882F0FBB97}.Release|x64.Build.0 = Release|x64 {00EE9BA6-4E8F-43CA-960D-D4882F0FBB97}.Release|x86.ActiveCfg = Release|x64 {00EE9BA6-4E8F-43CA-960D-D4882F0FBB97}.Release|x86.Build.0 = Release|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Debug|ARM64.Build.0 = Debug|ARM64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Debug|x64.ActiveCfg = Debug|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Debug|x64.Build.0 = Debug|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Debug|x86.ActiveCfg = Debug|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Debug|x86.Build.0 = Debug|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Release|ARM64.ActiveCfg = Release|ARM64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Release|ARM64.Build.0 = Release|ARM64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Release|x64.ActiveCfg = Release|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Release|x64.Build.0 = Release|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Release|x86.ActiveCfg = Release|x64 + {A1425B53-3D61-4679-8623-E64A0D3D0A48}.Release|x86.Build.0 = Release|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|ARM64.Build.0 = Debug|ARM64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|x64.ActiveCfg = Debug|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|x64.Build.0 = Debug|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|x64.Deploy.0 = Debug|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|x86.ActiveCfg = Debug|x86 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|x86.Build.0 = Debug|x86 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Debug|x86.Deploy.0 = Debug|x86 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|ARM64.ActiveCfg = Release|ARM64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|ARM64.Build.0 = Release|ARM64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|ARM64.Deploy.0 = Release|ARM64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|x64.ActiveCfg = Release|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|x64.Build.0 = Release|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|x64.Deploy.0 = Release|x64 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|x86.ActiveCfg = Release|x86 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|x86.Build.0 = Release|x86 + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03}.Release|x86.Deploy.0 = Release|x86 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Debug|ARM64.Build.0 = Debug|ARM64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Debug|x64.ActiveCfg = Debug|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Debug|x64.Build.0 = Debug|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Debug|x86.ActiveCfg = Debug|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Debug|x86.Build.0 = Debug|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Release|ARM64.ActiveCfg = Release|ARM64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Release|ARM64.Build.0 = Release|ARM64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Release|x64.ActiveCfg = Release|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Release|x64.Build.0 = Release|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Release|x86.ActiveCfg = Release|x64 + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB}.Release|x86.Build.0 = Release|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Debug|ARM64.Build.0 = Debug|ARM64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Debug|x64.ActiveCfg = Debug|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Debug|x64.Build.0 = Debug|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Debug|x86.ActiveCfg = Debug|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Debug|x86.Build.0 = Debug|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|ARM64.ActiveCfg = Release|ARM64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|ARM64.Build.0 = Release|ARM64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x64.ActiveCfg = Release|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x64.Build.0 = Release|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x86.ActiveCfg = Release|x64 + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC}.Release|x86.Build.0 = Release|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|ARM64.Build.0 = Debug|ARM64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x64.ActiveCfg = Debug|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x64.Build.0 = Debug|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x86.ActiveCfg = Debug|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Debug|x86.Build.0 = Debug|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|ARM64.ActiveCfg = Release|ARM64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|ARM64.Build.0 = Release|ARM64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x64.ActiveCfg = Release|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x64.Build.0 = Release|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x86.ActiveCfg = Release|x64 + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF}.Release|x86.Build.0 = Release|x64 {ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|ARM64.ActiveCfg = Debug|ARM64 {ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|ARM64.Build.0 = Debug|ARM64 {ED9A1AC6-AEB0-4569-A6E9-E1696182B545}.Debug|x64.ActiveCfg = Debug|x64 @@ -2099,6 +2179,18 @@ Global {697C6AF9-0A48-49A9-866C-67DA12384015}.Release|x64.Build.0 = Release|x64 {697C6AF9-0A48-49A9-866C-67DA12384015}.Release|x86.ActiveCfg = Release|x64 {697C6AF9-0A48-49A9-866C-67DA12384015}.Release|x86.Build.0 = Release|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Debug|ARM64.Build.0 = Debug|ARM64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Debug|x64.ActiveCfg = Debug|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Debug|x64.Build.0 = Debug|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Debug|x86.ActiveCfg = Debug|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Debug|x86.Build.0 = Debug|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Release|ARM64.ActiveCfg = Release|ARM64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Release|ARM64.Build.0 = Release|ARM64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Release|x64.ActiveCfg = Release|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Release|x64.Build.0 = Release|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Release|x86.ActiveCfg = Release|x64 + {9EBAA524-0EDA-470B-95D4-39383285CBB2}.Release|x86.Build.0 = Release|x64 {500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D}.Debug|ARM64.ActiveCfg = Debug|ARM64 {500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D}.Debug|ARM64.Build.0 = Debug|ARM64 {500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D}.Debug|x64.ActiveCfg = Debug|x64 @@ -2270,6 +2362,12 @@ Global {C604B37E-9D0E-4484-8778-E8B31B0E1B3A} = {AB82E5DD-C32D-4F28-9746-2C780846188E} {E599C30B-9DC8-4E5A-BF27-93D4CCEDE788} = {1AFB6476-670D-4E80-A464-657E01DFF482} {00EE9BA6-4E8F-43CA-960D-D4882F0FBB97} = {1AFB6476-670D-4E80-A464-657E01DFF482} + {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} + {A1425B53-3D61-4679-8623-E64A0D3D0A48} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} + {9D7A6DE0-7D27-424D-ABAE-41B2161F9A03} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} + {17A99C7C-0BFF-45BB-A9FD-63A0DDC105BB} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} + {AA9F0AF8-7924-4D59-BAA1-E36F1304E0DC} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} + {21B69DE5-59FD-4C5D-A142-EF1C1C430EAF} = {17B4FA70-001E-4D33-BBBB-0D142DBC2E20} {ED9A1AC6-AEB0-4569-A6E9-E1696182B545} = {2F305555-C296-497E-AC20-5FA1B237996A} {5A5DD09D-723A-44D3-8F2B-293584C3D731} = {2F305555-C296-497E-AC20-5FA1B237996A} {B3E869C4-8210-4EBD-A621-FF4C4AFCBFA9} = {2F305555-C296-497E-AC20-5FA1B237996A} @@ -2288,6 +2386,7 @@ Global {FD86C06A-FB54-4D5E-9831-1CDADF60D45F} = {929C1324-22E8-4412-A9A8-80E85F3985A5} {697C6AF9-0A48-49A9-866C-67DA12384015} = {929C1324-22E8-4412-A9A8-80E85F3985A5} {929C1324-22E8-4412-A9A8-80E85F3985A5} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} + {9EBAA524-0EDA-470B-95D4-39383285CBB2} = {1AFB6476-670D-4E80-A464-657E01DFF482} {500DED3E-CFB5-4ED5-ACC6-02B3D6DC336D} = {4AFC9975-2456-4C70-94A4-84073C1CED93} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution diff --git a/README.md b/README.md index 0031147aba55..9691f8fa26e7 100644 --- a/README.md +++ b/README.md @@ -20,10 +20,10 @@ Microsoft PowerToys is a set of utilities for power users to tune and streamline | [Always on Top](https://aka.ms/PowerToysOverview_AoT) | [PowerToys Awake](https://aka.ms/PowerToysOverview_Awake) | [Color Picker](https://aka.ms/PowerToysOverview_ColorPicker) | | [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) | [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) | +| [Mouse utilities](https://aka.ms/PowerToysOverview_MouseUtilities) | [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) | ## Installing and running Microsoft PowerToys diff --git a/installer/PowerToysSetup/Common.wxi b/installer/PowerToysSetup/Common.wxi index 76dcb2ac9d92..ea955b0e3238 100644 --- a/installer/PowerToysSetup/Common.wxi +++ b/installer/PowerToysSetup/Common.wxi @@ -16,6 +16,7 @@ + diff --git a/installer/PowerToysSetup/FileExplorerPreview.wxs b/installer/PowerToysSetup/FileExplorerPreview.wxs index ba819ad22c26..e9a5b291d6f0 100644 --- a/installer/PowerToysSetup/FileExplorerPreview.wxs +++ b/installer/PowerToysSetup/FileExplorerPreview.wxs @@ -6,8 +6,8 @@ - - + + @@ -15,9 +15,9 @@ - + - + @@ -26,7 +26,7 @@ - + diff --git a/installer/PowerToysSetup/Peek.wxs b/installer/PowerToysSetup/Peek.wxs new file mode 100644 index 000000000000..d086c3ee6720 --- /dev/null +++ b/installer/PowerToysSetup/Peek.wxs @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/installer/PowerToysSetup/PowerToysInstaller.wixproj b/installer/PowerToysSetup/PowerToysInstaller.wixproj index 3e8a69344987..0116b31850ea 100644 --- a/installer/PowerToysSetup/PowerToysInstaller.wixproj +++ b/installer/PowerToysSetup/PowerToysInstaller.wixproj @@ -1,4 +1,4 @@ - + @@ -39,6 +39,7 @@ call "..\..\..\publish.cmd" arm64 call move /Y ..\..\..\KeyboardManager.wxs.bk ..\..\..\KeyboardManager.wxs call move /Y ..\..\..\MeasureTool.wxs.bk ..\..\..\MeasureTool.wxs call move /Y ..\..\..\MouseUtils.wxs.bk ..\..\..\MouseUtils.wxs + call move /Y ..\..\..\Peek.wxs.bk ..\..\..\Peek.wxs call move /Y ..\..\..\PowerAccent.wxs.bk ..\..\..\PowerAccent.wxs call move /Y ..\..\..\PowerRename.wxs.bk ..\..\..\PowerRename.wxs call move /Y ..\..\..\Product.wxs.bk ..\..\..\Product.wxs @@ -112,6 +113,7 @@ call "..\..\..\publish.cmd" arm64 + @@ -177,7 +179,7 @@ call "..\..\..\publish.cmd" arm64 - + @@ -527,8 +528,16 @@ - - + + + + + + + + + + diff --git a/installer/PowerToysSetup/WinAppSDK.wxs b/installer/PowerToysSetup/WinAppSDK.wxs index 145a653ef157..30eb5bd63acf 100644 --- a/installer/PowerToysSetup/WinAppSDK.wxs +++ b/installer/PowerToysSetup/WinAppSDK.wxs @@ -16,7 +16,7 @@ - + @@ -374,6 +374,16 @@ + + + + + + + @@ -504,6 +514,7 @@ + diff --git a/installer/PowerToysSetup/generateAllFileComponents.ps1 b/installer/PowerToysSetup/generateAllFileComponents.ps1 index 93b35f7684cc..eaa920e4c8d2 100644 --- a/installer/PowerToysSetup/generateAllFileComponents.ps1 +++ b/installer/PowerToysSetup/generateAllFileComponents.ps1 @@ -42,9 +42,9 @@ Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListNa #FileExplorerAdd-ons #TODO: There are multiple .deps.json files, make sure it works as expected Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson ""$PSScriptRoot..\..\..\$platform\Release\modules\FileExplorerPreview\PowerToys.SvgThumbnailProvider.deps.json"" -fileListName PowerPreviewFiles -wxsFilePath $PSScriptRoot\FileExplorerPreview.wxs" -Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson """" -fileListName MonacoCustomLanguagesFiles -wxsFilePath $PSScriptRoot\FileExplorerPreview.wxs -depsPath ""$PSScriptRoot..\..\..\$platform\Release\modules\FileExplorerPreview\customLanguages""" +Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson """" -fileListName MonacoPreviewHandlerCustomLanguagesFiles -wxsFilePath $PSScriptRoot\FileExplorerPreview.wxs -depsPath ""$PSScriptRoot..\..\..\$platform\Release\modules\FileExplorerPreview\customLanguages""" Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""PowerPreviewFiles"" -wxsFilePath $PSScriptRoot\FileExplorerPreview.wxs -regroot $registryroot" -Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""MonacoCustomLanguagesFiles"" -wxsFilePath $PSScriptRoot\FileExplorerPreview.wxs -regroot $registryroot" +Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""MonacoPreviewHandlerCustomLanguagesFiles"" -wxsFilePath $PSScriptRoot\FileExplorerPreview.wxs -regroot $registryroot" #FileLocksmith #TODO: There are multiple .deps.json files, make sure it works as expected @@ -76,6 +76,12 @@ Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListNa Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson ""$PSScriptRoot..\..\..\$platform\Release\modules\MeasureTool\PowerToys.MeasureToolUI.deps.json"" -fileListName MeasureToolFiles -wxsFilePath $PSScriptRoot\MeasureTool.wxs -isWinAppSdkProj 1" Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""MeasureToolFiles"" -wxsFilePath $PSScriptRoot\MeasureTool.wxs -regroot $registryroot" +#Peek +Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson ""$PSScriptRoot..\..\..\$platform\Release\modules\Peek\PowerToys.Peek.UI.deps.json"" -fileListName PeekFiles -wxsFilePath $PSScriptRoot\Peek.wxs" +Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson """" -fileListName PeekAssetsFiles -wxsFilePath $PSScriptRoot\Peek.wxs -depsPath ""$PSScriptRoot..\..\..\$platform\Release\modules\Peek\Assets\""" +Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""PeekFiles"" -wxsFilePath $PSScriptRoot\Peek.wxs -regroot $registryroot" +Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""PeekAssetsFiles"" -wxsFilePath $PSScriptRoot\Peek.wxs -regroot $registryroot" + #PowerAccent Invoke-Expression -Command "$PSScriptRoot\generateFileList.ps1 -fileDepsJson ""$PSScriptRoot..\..\..\$platform\Release\modules\PowerAccent\PowerToys.PowerAccent.deps.json"" -fileListName PowerAccentFiles -wxsFilePath $PSScriptRoot\PowerAccent.wxs" Invoke-Expression -Command "$PSScriptRoot\generateFileComponents.ps1 -fileListName ""PowerAccentFiles"" -wxsFilePath $PSScriptRoot\PowerAccent.wxs -regroot $registryroot" diff --git a/installer/PowerToysSetupCustomActions/CustomAction.cpp b/installer/PowerToysSetupCustomActions/CustomAction.cpp index e495f238ef4c..8ecd9ce08872 100644 --- a/installer/PowerToysSetupCustomActions/CustomAction.cpp +++ b/installer/PowerToysSetupCustomActions/CustomAction.cpp @@ -1017,6 +1017,7 @@ const std::wstring WinAppSDKConsumers[] = L"modules\\FileLocksmith", L"modules\\Hosts", L"modules\\RegistryPreview", + L"modules\\Peek", }; UINT __stdcall CreateWinAppSDKHardlinksCA(MSIHANDLE hInstall) @@ -1068,6 +1069,7 @@ const std::wstring PTInteropConsumers[] = L"modules\\PowerAccent", L"modules\\FileLocksmith", L"modules\\Hosts", + L"modules\\Peek", L"modules\\FileExplorerPreview", L"modules\\MouseUtils\\MouseJumpUI", L"modules\\RegistryPreview", @@ -1115,7 +1117,7 @@ UINT __stdcall CreateDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) UINT er = ERROR_SUCCESS; std::wstring installationFolder, dotnetRuntimeFilesSrcDir, colorPickerDir, powerOCRDir, launcherDir, fancyZonesDir, imageResizerDir, settingsDir, awakeDir, measureToolDir, powerAccentDir, fileExplorerAddOnsDir, hostsDir, fileLocksmithDir, - mouseJumpDir, registryPreviewDir; + mouseJumpDir, registryPreviewDir, peekDir; hr = WcaInitialize(hInstall, "CreateDotnetRuntimeHardlinksCA"); ExitOnFailure(hr, "Failed to initialize"); @@ -1138,6 +1140,7 @@ UINT __stdcall CreateDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) fileLocksmithDir = installationFolder + L"modules\\FileLocksmith\\"; mouseJumpDir = installationFolder + L"modules\\MouseUtils\\MouseJumpUI\\"; registryPreviewDir = installationFolder + L"modules\\RegistryPreview\\"; + peekDir = installationFolder + L"modules\\Peek\\"; for (auto file : dotnetRuntimeFiles) { @@ -1156,6 +1159,7 @@ UINT __stdcall CreateDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (fileLocksmithDir + file).c_str(), ec); std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (mouseJumpDir + file).c_str(), ec); std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (registryPreviewDir + file).c_str(), ec); + std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (peekDir + file).c_str(), ec); if (ec.value() != S_OK) { @@ -1181,6 +1185,7 @@ UINT __stdcall CreateDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (hostsDir + file).c_str(), ec); std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (mouseJumpDir + file).c_str(), ec); std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (registryPreviewDir + file).c_str(), ec); + std::filesystem::create_hard_link((dotnetRuntimeFilesSrcDir + file).c_str(), (peekDir + file).c_str(), ec); if (ec.value() != S_OK) { @@ -1275,7 +1280,7 @@ UINT __stdcall DeleteDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) UINT er = ERROR_SUCCESS; std::wstring installationFolder, colorPickerDir, powerOCRDir, launcherDir, fancyZonesDir, imageResizerDir, settingsDir, awakeDir, measureToolDir, powerAccentDir, fileExplorerAddOnsDir, - hostsDir, fileLocksmithDir, mouseJumpDir, registryPreviewDir; + hostsDir, fileLocksmithDir, mouseJumpDir, registryPreviewDir, peekDir; hr = WcaInitialize(hInstall, "DeleteDotnetRuntimeHardlinksCA"); ExitOnFailure(hr, "Failed to initialize"); @@ -1297,6 +1302,7 @@ UINT __stdcall DeleteDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) fileLocksmithDir = installationFolder + L"modules\\FileLocksmith\\"; mouseJumpDir = installationFolder + L"modules\\MouseUtils\\MouseJumpUI\\"; registryPreviewDir = installationFolder + L"modules\\RegistryPreview\\"; + peekDir = installationFolder + L"modules\\Peek\\"; try { @@ -1316,6 +1322,7 @@ UINT __stdcall DeleteDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) DeleteFile((fileLocksmithDir + file).c_str()); DeleteFile((mouseJumpDir + file).c_str()); DeleteFile((registryPreviewDir + file).c_str()); + DeleteFile((peekDir + file).c_str()); } for (auto file : dotnetRuntimeWPFFiles) @@ -1331,6 +1338,7 @@ UINT __stdcall DeleteDotnetRuntimeHardlinksCA(MSIHANDLE hInstall) DeleteFile((hostsDir + file).c_str()); DeleteFile((mouseJumpDir + file).c_str()); DeleteFile((registryPreviewDir + file).c_str()); + DeleteFile((peekDir + file).c_str()); } } catch (std::exception e) @@ -1364,7 +1372,7 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall) } processes.resize(bytes / sizeof(processes[0])); - std::array processesToTerminate = { + std::array processesToTerminate = { L"PowerToys.PowerLauncher.exe", L"PowerToys.Settings.exe", L"PowerToys.Awake.exe", @@ -1387,6 +1395,7 @@ UINT __stdcall TerminateProcessesCA(MSIHANDLE hInstall) L"PowerToys.GcodePreviewHandler.exe", L"PowerToys.PdfPreviewHandler.exe", L"PowerToys.SvgPreviewHandler.exe", + L"PowerToys.Peek.UI.exe", L"PowerToys.exe", }; diff --git a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj index f7370d499d02..7e0a583bff40 100644 --- a/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj +++ b/installer/PowerToysSetupCustomActions/PowerToysSetupCustomActions.vcxproj @@ -61,6 +61,7 @@ call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\KeyboardManager.wxs"" ""$(ProjectDir)..\PowerToysSetup\KeyboardManager.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\MeasureTool.wxs"" ""$(ProjectDir)..\PowerToysSetup\MeasureTool.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\MouseUtils.wxs"" ""$(ProjectDir)..\PowerToysSetup\MouseUtils.wxs.bk"""" + call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\Peek.wxs"" ""$(ProjectDir)..\PowerToysSetup\Peek.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\PowerAccent.wxs"" ""$(ProjectDir)..\PowerToysSetup\PowerAccent.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\PowerRename.wxs"" ""$(ProjectDir)..\PowerToysSetup\PowerRename.wxs.bk"""" call cmd /C "copy ""$(ProjectDir)..\PowerToysSetup\Product.wxs"" ""$(ProjectDir)..\PowerToysSetup\Product.wxs.bk"""" diff --git a/src/common/FilePreviewCommon/FilePreviewCommon.csproj b/src/common/FilePreviewCommon/FilePreviewCommon.csproj new file mode 100644 index 000000000000..5e442ef7bacb --- /dev/null +++ b/src/common/FilePreviewCommon/FilePreviewCommon.csproj @@ -0,0 +1,306 @@ + + + + + + net7.0-windows + win-x64;win-arm64 + $(Version).0 + Microsoft Corporation + PowerToys + PowerToys FilePreviewCommon + PowerToys.FilePreviewCommon + + + + + + + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + Always + + + diff --git a/src/modules/previewpane/MonacoPreviewHandler/Formatters/IFormatter.cs b/src/common/FilePreviewCommon/Formatters/IFormatter.cs similarity index 90% rename from src/modules/previewpane/MonacoPreviewHandler/Formatters/IFormatter.cs rename to src/common/FilePreviewCommon/Formatters/IFormatter.cs index 88bb982bc201..229c0ff1e57a 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/Formatters/IFormatter.cs +++ b/src/common/FilePreviewCommon/Formatters/IFormatter.cs @@ -2,7 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters +namespace Microsoft.PowerToys.FilePreviewCommon.Monaco.Formatters { public interface IFormatter { diff --git a/src/modules/previewpane/MonacoPreviewHandler/Formatters/JsonFormatter.cs b/src/common/FilePreviewCommon/Formatters/JsonFormatter.cs similarity index 93% rename from src/modules/previewpane/MonacoPreviewHandler/Formatters/JsonFormatter.cs rename to src/common/FilePreviewCommon/Formatters/JsonFormatter.cs index 780448cb6bde..4f366fbff831 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/Formatters/JsonFormatter.cs +++ b/src/common/FilePreviewCommon/Formatters/JsonFormatter.cs @@ -5,7 +5,7 @@ using System.Text.Encodings.Web; using System.Text.Json; -namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters +namespace Microsoft.PowerToys.FilePreviewCommon.Monaco.Formatters { public class JsonFormatter : IFormatter { diff --git a/src/modules/previewpane/MonacoPreviewHandler/Formatters/XmlFormatter.cs b/src/common/FilePreviewCommon/Formatters/XmlFormatter.cs similarity index 94% rename from src/modules/previewpane/MonacoPreviewHandler/Formatters/XmlFormatter.cs rename to src/common/FilePreviewCommon/Formatters/XmlFormatter.cs index 6a7067e23cd9..b282c802ae73 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/Formatters/XmlFormatter.cs +++ b/src/common/FilePreviewCommon/Formatters/XmlFormatter.cs @@ -5,7 +5,7 @@ using System.Text; using System.Xml; -namespace Microsoft.PowerToys.PreviewHandler.Monaco.Formatters +namespace Microsoft.PowerToys.FilePreviewCommon.Monaco.Formatters { public class XmlFormatter : IFormatter { diff --git a/src/modules/previewpane/MarkdownPreviewHandler/HTMLParsingExtension.cs b/src/common/FilePreviewCommon/HTMLParsingExtension.cs similarity index 98% rename from src/modules/previewpane/MarkdownPreviewHandler/HTMLParsingExtension.cs rename to src/common/FilePreviewCommon/HTMLParsingExtension.cs index b36467d4a19a..b0dae4dcbeb8 100644 --- a/src/modules/previewpane/MarkdownPreviewHandler/HTMLParsingExtension.cs +++ b/src/common/FilePreviewCommon/HTMLParsingExtension.cs @@ -10,7 +10,7 @@ using Markdig.Syntax; using Markdig.Syntax.Inlines; -namespace Microsoft.PowerToys.PreviewHandler.Markdown +namespace Microsoft.PowerToys.FilePreviewCommon { /// /// Callback if extension blocks external images. diff --git a/src/common/FilePreviewCommon/Helper.cs b/src/common/FilePreviewCommon/Helper.cs new file mode 100644 index 000000000000..4a854afa2df7 --- /dev/null +++ b/src/common/FilePreviewCommon/Helper.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; +using System.IO; + +namespace Microsoft.PowerToys.FilePreviewCommon +{ + public static class Helper + { + public static void CleanupTempDir(string folder) + { + try + { + var dir = new DirectoryInfo(folder); + foreach (var file in dir.EnumerateFiles("*.html")) + { + file.Delete(); + } + } + catch (Exception) + { + } + } + } +} diff --git a/src/common/FilePreviewCommon/MarkdownHelper.cs b/src/common/FilePreviewCommon/MarkdownHelper.cs new file mode 100644 index 000000000000..31013419ed6f --- /dev/null +++ b/src/common/FilePreviewCommon/MarkdownHelper.cs @@ -0,0 +1,52 @@ +// 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.IO; +using Markdig; + +namespace Microsoft.PowerToys.FilePreviewCommon +{ + public static class MarkdownHelper + { + /// + /// Markdown HTML header for light theme. + /// + private static readonly string HtmlLightHeader = "
"; + + /// + /// Markdown HTML header for dark theme. + /// + private static readonly string HtmlDarkHeader = "
"; + + /// + /// Markdown HTML footer. + /// + private static readonly string HtmlFooter = "
"; + + public static string MarkdownHtml(string fileContent, string theme, string filePath, ImagesBlockedCallBack imagesBlockedCallBack) + { + var htmlHeader = theme == "dark" ? HtmlDarkHeader : HtmlLightHeader; + + // Extension to modify markdown AST. + HTMLParsingExtension extension = new HTMLParsingExtension(imagesBlockedCallBack); + extension.FilePath = Path.GetDirectoryName(filePath); + + // if you have a string with double space, some people view it as a new line. + // while this is against spec, even GH supports this. Technically looks like GH just trims whitespace + // https://github.com/microsoft/PowerToys/issues/10354 + var softlineBreak = new Markdig.Extensions.Hardlines.SoftlineBreakAsHardlineExtension(); + + MarkdownPipelineBuilder pipelineBuilder; + pipelineBuilder = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseEmojiAndSmiley().UseYamlFrontMatter().UseMathematics(); + pipelineBuilder.Extensions.Add(extension); + pipelineBuilder.Extensions.Add(softlineBreak); + + MarkdownPipeline pipeline = pipelineBuilder.Build(); + string parsedMarkdown = Markdown.ToHtml(fileContent, pipeline); + + string markdownHTML = $"{htmlHeader}{parsedMarkdown}{HtmlFooter}"; + return markdownHTML; + } + } +} diff --git a/src/common/FilePreviewCommon/MonacoHelper.cs b/src/common/FilePreviewCommon/MonacoHelper.cs new file mode 100644 index 000000000000..de62a3bde86d --- /dev/null +++ b/src/common/FilePreviewCommon/MonacoHelper.cs @@ -0,0 +1,114 @@ +// 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.Globalization; +using System.IO; +using System.Reflection; +using System.Text.Json; +using Microsoft.PowerToys.FilePreviewCommon.Monaco.Formatters; + +namespace Microsoft.PowerToys.FilePreviewCommon +{ + public static class MonacoHelper + { + /// + /// Name of the virtual host + /// + public const string VirtualHostName = "PowerToysLocalMonaco"; + + /// + /// Formatters applied before rendering the preview + /// + public static readonly IReadOnlyCollection Formatters = new List + { + new JsonFormatter(), + new XmlFormatter(), + }.AsReadOnly(); + + /// + /// Gets the path of the current assembly. + /// + /// + /// Source: https://stackoverflow.com/a/283917/14774889 + /// + public static string AssemblyDirectory + { + get + { + string codeBase = Assembly.GetExecutingAssembly().Location; + UriBuilder uri = new UriBuilder(codeBase); + string path = Uri.UnescapeDataString(uri.Path); + return Path.GetDirectoryName(path); + } + } + + public static string MonacoDirectory + { + get + { + // TODO: common monaco folder + string codeBase = Assembly.GetExecutingAssembly().Location; + string path = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(codeBase), "..", "FileExplorerPreview")); + return path; + } + } + + public static JsonDocument GetLanguages() + { + JsonDocument languageListDocument; + using (StreamReader jsonFileReader = new StreamReader(new FileStream(MonacoDirectory + "\\monaco_languages.json", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) + { + languageListDocument = JsonDocument.Parse(jsonFileReader.ReadToEnd()); + jsonFileReader.Close(); + } + + return languageListDocument; + } + + /// + /// Converts a file extension to a language monaco id. + /// + /// The extension of the file (without the dot). + /// The monaco language id + public static string GetLanguage(string fileExtension) + { + fileExtension = fileExtension.ToLower(CultureInfo.CurrentCulture); + try + { + JsonDocument languageListDocument = GetLanguages(); + JsonElement languageList = languageListDocument.RootElement.GetProperty("list"); + foreach (JsonElement e in languageList.EnumerateArray()) + { + for (int j = 0; j < e.GetProperty("extensions").GetArrayLength(); j++) + { + if (e.GetProperty("extensions")[j].ToString() == fileExtension) + { + return e.GetProperty("id").ToString(); + } + } + } + + return "plaintext"; + } + catch (Exception) + { + return "plaintext"; + } + } + + public static string ReadIndexHtml() + { + string html; + using (StreamReader htmlFileReader = new StreamReader(new FileStream(MonacoDirectory + "\\index.html", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) + { + html = htmlFileReader.ReadToEnd(); + htmlFileReader.Close(); + } + + return html; + } + } +} diff --git a/src/modules/previewpane/MonacoPreviewHandler/customLanguages/reg.js b/src/common/FilePreviewCommon/customLanguages/reg.js similarity index 100% rename from src/modules/previewpane/MonacoPreviewHandler/customLanguages/reg.js rename to src/common/FilePreviewCommon/customLanguages/reg.js diff --git a/src/modules/previewpane/MonacoPreviewHandler/generateLanguagesJson.html b/src/common/FilePreviewCommon/generateLanguagesJson.html similarity index 100% rename from src/modules/previewpane/MonacoPreviewHandler/generateLanguagesJson.html rename to src/common/FilePreviewCommon/generateLanguagesJson.html diff --git a/src/modules/previewpane/MonacoPreviewHandler/index.html b/src/common/FilePreviewCommon/index.html similarity index 99% rename from src/modules/previewpane/MonacoPreviewHandler/index.html rename to src/common/FilePreviewCommon/index.html index 4c1d03bb1faf..7c35dec42636 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/index.html +++ b/src/common/FilePreviewCommon/index.html @@ -25,7 +25,7 @@ - + Previewer for developer Files
"; - - /// - /// Markdown HTML header for dark theme. - /// - private readonly string htmlDarkHeader = "
"; - - /// - /// Markdown HTML footer. - /// - private readonly string htmlFooter = "
"; - /// /// RichTextBox control to display if external images are blocked. /// @@ -113,15 +83,6 @@ public static string AssemblyDirectory ///
public MarkdownPreviewHandlerControl() { - // if you have a string with double space, some people view it as a new line. - // while this is against spec, even GH supports this. Technically looks like GH just trims whitespace - // https://github.com/microsoft/PowerToys/issues/10354 - var softlineBreak = new Markdig.Extensions.Hardlines.SoftlineBreakAsHardlineExtension(); - _extension = new HTMLParsingExtension(ImagesBlockedCallBack); - - _pipelineBuilder = new MarkdownPipelineBuilder().UseAdvancedExtensions().UseEmojiAndSmiley().UseYamlFrontMatter().UseMathematics(); - _pipelineBuilder.Extensions.Add(_extension); - _pipelineBuilder.Extensions.Add(softlineBreak); } /// @@ -142,7 +103,7 @@ public override void DoPreview(T dataSource) return; } - CleanupWebView2UserDataFolder(); + FilePreviewCommon.Helper.CleanupTempDir(_webView2UserDataFolder); _infoBarDisplayed = false; @@ -160,11 +121,7 @@ public override void DoPreview(T dataSource) _infoBarDisplayed = true; } - var htmlHeader = Common.UI.ThemeManager.GetWindowsBaseColor().ToLowerInvariant() == "dark" ? htmlDarkHeader : htmlLightHeader; - _extension.FilePath = Path.GetDirectoryName(filePath); - MarkdownPipeline pipeline = _pipelineBuilder.Build(); - string parsedMarkdown = Markdig.Markdown.ToHtml(fileText, pipeline); - string markdownHTML = $"{htmlHeader}{parsedMarkdown}{htmlFooter}"; + string markdownHTML = FilePreviewCommon.MarkdownHelper.MarkdownHtml(fileText, Common.UI.ThemeManager.GetWindowsBaseColor().ToLowerInvariant(), filePath, ImagesBlockedCallBack); _browser = new WebView2() { @@ -312,25 +269,5 @@ private void ImagesBlockedCallBack() { _infoBarDisplayed = true; } - - /// - /// Cleanup the previously created tmp html files from svg files bigger than 2MB. - /// - private void CleanupWebView2UserDataFolder() - { - try - { - // Cleanup temp dir - var dir = new DirectoryInfo(_webView2UserDataFolder); - - foreach (var file in dir.EnumerateFiles("*.html")) - { - file.Delete(); - } - } - catch (Exception) - { - } - } } } diff --git a/src/modules/previewpane/MonacoPreviewHandler/FileHandler.cs b/src/modules/previewpane/MonacoPreviewHandler/FileHandler.cs index 2117f7caf001..cb5679a87826 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/FileHandler.cs +++ b/src/modules/previewpane/MonacoPreviewHandler/FileHandler.cs @@ -21,12 +21,7 @@ public static string GetLanguage(string fileExtension) fileExtension = fileExtension.ToLower(CultureInfo.CurrentCulture); try { - JsonDocument languageListDocument; - using (StreamReader jsonFileReader = new StreamReader(new FileStream(Settings.AssemblyDirectory + "\\monaco_languages.json", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) - { - languageListDocument = JsonDocument.Parse(jsonFileReader.ReadToEnd()); - jsonFileReader.Close(); - } + var languageListDocument = FilePreviewCommon.MonacoHelper.GetLanguages(); JsonElement languageList = languageListDocument.RootElement.GetProperty("list"); foreach (JsonElement e in languageList.EnumerateArray()) diff --git a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj index 18e47055d0d4..5668f2fa2e69 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj +++ b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandler.csproj @@ -64,6 +64,7 @@ + @@ -71,34 +72,4 @@ - - - Always - - - - - - Always - - - - - - Always - - - - - - Always - - - - - - Always - - - diff --git a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs index f4aac30d7e84..d8ba4640a36e 100644 --- a/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs +++ b/src/modules/previewpane/MonacoPreviewHandler/MonacoPreviewHandlerControl.cs @@ -2,18 +2,10 @@ // 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.Drawing; using System.Globalization; -using System.IO; -using System.Linq; using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using System.Windows.Forms; using Common; using ManagedCommon; -using Microsoft.PowerToys.PreviewHandler.Monaco.Formatters; using Microsoft.PowerToys.PreviewHandler.Monaco.Properties; using Microsoft.Web.WebView2.Core; using Microsoft.Web.WebView2.WinForms; @@ -28,15 +20,6 @@ public class MonacoPreviewHandlerControl : FormHandlerControl /// private readonly Settings _settings = new Settings(); - /// - /// Formatters applied before rendering the preview - /// - private readonly IReadOnlyCollection _formatters = new List - { - new JsonFormatter(), - new XmlFormatter(), - }.AsReadOnly(); - /// /// Text box to display the information about blocked elements from Svg. /// @@ -77,11 +60,6 @@ public class MonacoPreviewHandlerControl : FormHandlerControl /// private Label _loadingBackground; - /// - /// Name of the virtual host - /// - public const string VirtualHostName = "PowerToysLocalMonaco"; - /// /// HTML code passed to the file /// @@ -168,7 +146,7 @@ public override void DoPreview(T dataSource) { await _webView.EnsureCoreWebView2Async(_webView2Environment).ConfigureAwait(true); - _webView.CoreWebView2.SetVirtualHostNameToFolderMapping(VirtualHostName, Settings.AssemblyDirectory, CoreWebView2HostResourceAccessKind.Allow); + _webView.CoreWebView2.SetVirtualHostNameToFolderMapping(FilePreviewCommon.MonacoHelper.VirtualHostName, Settings.AssemblyDirectory, CoreWebView2HostResourceAccessKind.Allow); Logger.LogInfo("Navigates to string of HTML file"); @@ -373,7 +351,7 @@ private void InitializeIndexFileAndSelectedFile(string filePath) if (_settings.TryFormat) { - var formatter = _formatters.SingleOrDefault(f => f.LangSet == _vsCodeLangSet); + var formatter = FilePreviewCommon.MonacoHelper.Formatters.SingleOrDefault(f => f.LangSet == _vsCodeLangSet); if (formatter != null) { try @@ -393,19 +371,12 @@ private void InitializeIndexFileAndSelectedFile(string filePath) } // prepping index html to load in - using (StreamReader htmlFileReader = new StreamReader(new FileStream(Settings.AssemblyDirectory + "\\index.html", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) - { - Logger.LogInfo("Starting reading HTML source file"); - _html = htmlFileReader.ReadToEnd(); - htmlFileReader.Close(); - Logger.LogInfo("Reading HTML source file ended"); - } - + _html = FilePreviewCommon.MonacoHelper.ReadIndexHtml(); _html = _html.Replace("[[PT_LANG]]", _vsCodeLangSet, StringComparison.InvariantCulture); _html = _html.Replace("[[PT_WRAP]]", _settings.Wrap ? "1" : "0", StringComparison.InvariantCulture); _html = _html.Replace("[[PT_THEME]]", Settings.GetTheme(), StringComparison.InvariantCulture); _html = _html.Replace("[[PT_CODE]]", _base64FileCode, StringComparison.InvariantCulture); - _html = _html.Replace("[[PT_URL]]", VirtualHostName, StringComparison.InvariantCulture); + _html = _html.Replace("[[PT_URL]]", FilePreviewCommon.MonacoHelper.VirtualHostName, StringComparison.InvariantCulture); } private async void DownloadLink_Click(object sender, EventArgs e) diff --git a/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HTMLParsingExtensionTest.cs b/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HTMLParsingExtensionTest.cs index 92fafd2aa252..d8fe7dc9bc78 100644 --- a/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HTMLParsingExtensionTest.cs +++ b/src/modules/previewpane/UnitTests-MarkdownPreviewHandler/HTMLParsingExtensionTest.cs @@ -24,7 +24,7 @@ public void ExtensionUpdatesTablesClassWhenUsed() { // Arrange string mdString = "| A | B |\n| -- | -- | "; - HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }); + Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension htmlParsingExtension = new Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension(() => { }); MarkdownPipeline markdownPipeline = BuildPipeline(htmlParsingExtension); // Act @@ -40,7 +40,7 @@ public void ExtensionUpdatesBlockQuotesClassWhenUsed() { // Arrange string mdString = "> Blockquotes."; - HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }); + Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension htmlParsingExtension = new Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension(() => { }); MarkdownPipeline markdownPipeline = BuildPipeline(htmlParsingExtension); // Act @@ -56,7 +56,7 @@ public void ExtensionUpdatesFigureClassAndBlocksRelativeUrlWhenUsed() { // arrange string mdString = "![text](a.jpg \"Figure\")"; - HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }, "C:\\Users\\"); + Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension htmlParsingExtension = new Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension(() => { }, "C:\\Users\\"); MarkdownPipeline markdownPipeline = BuildPipeline(htmlParsingExtension); // Act @@ -72,7 +72,7 @@ public void ExtensionAddsClassToFigureCaptionWhenUsed() { // arrange string mdString = "^^^ This is a caption"; - HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }, "C:/Users/"); + Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension htmlParsingExtension = new Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension(() => { }, "C:/Users/"); MarkdownPipeline markdownPipeline = BuildPipeline(htmlParsingExtension); // Act @@ -89,7 +89,7 @@ public void ExtensionRemovesExternalImageUrlAndMakeCallbackWhenUsed() // arrange int count = 0; string mdString = "![text](http://dev.nodeca.com \"Figure\")"; - HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { count++; }); + Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension htmlParsingExtension = new Microsoft.PowerToys.FilePreviewCommon.HTMLParsingExtension(() => { count++; }); MarkdownPipeline markdownPipeline = BuildPipeline(htmlParsingExtension); // Act diff --git a/src/runner/main.cpp b/src/runner/main.cpp index cc07f7112652..f32723684b24 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -168,6 +168,7 @@ int runner(bool isProcessElevated, bool openSettings, std::string settingsWindow L"modules/RegistryPreview/PowerToys.RegistryPreviewExt.dll", L"modules/MeasureTool/PowerToys.MeasureToolModuleInterface.dll", L"modules/Hosts/PowerToys.HostsModuleInterface.dll", + L"modules/Peek/PowerToys.Peek.dll", }; const auto VCM_PATH = L"modules/VideoConference/PowerToys.VideoConferenceModule.dll"; if (const auto mf = LoadLibraryA("mf.dll")) diff --git a/src/settings-ui/Settings.UI.Library/EnabledModules.cs b/src/settings-ui/Settings.UI.Library/EnabledModules.cs index 7db56bc0ecf8..dcf7cb05acb7 100644 --- a/src/settings-ui/Settings.UI.Library/EnabledModules.cs +++ b/src/settings-ui/Settings.UI.Library/EnabledModules.cs @@ -362,6 +362,22 @@ public bool FileLocksmith } } + private bool peek = true; + + [JsonPropertyName("Peek")] + public bool Peek + { + get => peek; + set + { + if (peek != value) + { + LogTelemetryEvent(value); + peek = value; + } + } + } + private bool registryPreview = true; [JsonPropertyName("RegistryPreview")] diff --git a/src/settings-ui/Settings.UI.Library/PeekProperties.cs b/src/settings-ui/Settings.UI.Library/PeekProperties.cs new file mode 100644 index 000000000000..bdf25d064878 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/PeekProperties.cs @@ -0,0 +1,20 @@ +// 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; + +namespace Microsoft.PowerToys.Settings.UI.Library +{ + public class PeekProperties + { + public PeekProperties() + { + ActivationShortcut = new HotkeySettings(false, true, false, false, 0x20); + } + + public HotkeySettings ActivationShortcut { get; set; } + + public override string ToString() => JsonSerializer.Serialize(this); + } +} diff --git a/src/settings-ui/Settings.UI.Library/PeekSettings.cs b/src/settings-ui/Settings.UI.Library/PeekSettings.cs new file mode 100644 index 000000000000..7d6b656267ab --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/PeekSettings.cs @@ -0,0 +1,35 @@ +// 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.Interfaces; + +namespace Microsoft.PowerToys.Settings.UI.Library +{ + public class PeekSettings : BasePTModuleSettings, ISettingsConfig + { + public const string ModuleName = "Peek"; + public const string ModuleVersion = "0.0.1"; + + [JsonPropertyName("properties")] + public PeekProperties Properties { get; set; } + + public PeekSettings() + { + Name = ModuleName; + Version = ModuleVersion; + Properties = new PeekProperties(); + } + + public string GetModuleName() + { + return Name; + } + + public bool UpgradeSettingsConfiguration() + { + return false; + } + } +} diff --git a/src/settings-ui/Settings.UI/App.xaml.cs b/src/settings-ui/Settings.UI/App.xaml.cs index ab0c612c9803..5874d5ab97fd 100644 --- a/src/settings-ui/Settings.UI/App.xaml.cs +++ b/src/settings-ui/Settings.UI/App.xaml.cs @@ -380,6 +380,7 @@ public static Type GetPage(string settingWindow) case "Hosts": return typeof(HostsPage); case "RegistryPreview": return typeof(RegistryPreviewPage); case "PastePlain": return typeof(PastePlainPage); + case "Peek": return typeof(PeekPage); default: // Fallback to general Debug.Assert(false, "Unexpected SettingsWindow argument value"); diff --git a/src/settings-ui/Settings.UI/Assets/FluentIcons/FluentIconsPeek.png b/src/settings-ui/Settings.UI/Assets/FluentIcons/FluentIconsPeek.png new file mode 100644 index 000000000000..5469e32791cb Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/FluentIcons/FluentIconsPeek.png differ diff --git a/src/settings-ui/Settings.UI/Assets/Modules/OOBE/Peek.gif b/src/settings-ui/Settings.UI/Assets/Modules/OOBE/Peek.gif new file mode 100644 index 000000000000..8dd16485f1c0 Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Modules/OOBE/Peek.gif differ diff --git a/src/settings-ui/Settings.UI/Assets/Modules/Peek.png b/src/settings-ui/Settings.UI/Assets/Modules/Peek.png new file mode 100644 index 000000000000..5c56e0cdd4ae Binary files /dev/null and b/src/settings-ui/Settings.UI/Assets/Modules/Peek.png differ diff --git a/src/settings-ui/Settings.UI/MainWindow.xaml.cs b/src/settings-ui/Settings.UI/MainWindow.xaml.cs index 12e7f02f544a..c98f85baf211 100644 --- a/src/settings-ui/Settings.UI/MainWindow.xaml.cs +++ b/src/settings-ui/Settings.UI/MainWindow.xaml.cs @@ -128,6 +128,9 @@ public MainWindow(bool isDark, bool createHidden = false) case "PastePlain": needToUpdate = generalSettingsConfig.Enabled.PastePlain != isEnabled; generalSettingsConfig.Enabled.PastePlain = isEnabled; break; + case "Peek": + needToUpdate = generalSettingsConfig.Enabled.Peek != isEnabled; + generalSettingsConfig.Enabled.Peek = isEnabled; break; case "PowerRename": needToUpdate = generalSettingsConfig.Enabled.PowerRename != isEnabled; generalSettingsConfig.Enabled.PowerRename = isEnabled; break; diff --git a/src/settings-ui/Settings.UI/OOBE/Enums/PowerToysModules.cs b/src/settings-ui/Settings.UI/OOBE/Enums/PowerToysModules.cs index bdfb3e54f687..d21d0a886468 100644 --- a/src/settings-ui/Settings.UI/OOBE/Enums/PowerToysModules.cs +++ b/src/settings-ui/Settings.UI/OOBE/Enums/PowerToysModules.cs @@ -16,6 +16,7 @@ public enum PowerToysModules ImageResizer, KBM, MouseUtils, + Peek, PowerRename, Run, QuickAccent, diff --git a/src/settings-ui/Settings.UI/OOBE/Views/OobePeek.xaml b/src/settings-ui/Settings.UI/OOBE/Views/OobePeek.xaml new file mode 100644 index 000000000000..79337d5bcf46 --- /dev/null +++ b/src/settings-ui/Settings.UI/OOBE/Views/OobePeek.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + +