From 74a1a6eca242cae82584970670b8405e30394db4 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Fri, 6 Dec 2024 06:33:08 -1000 Subject: [PATCH] Upgrade to check-spelling v0.0.24 (#36235) This upgrades to [v0.0.24](https://github.com/check-spelling/check-spelling/releases/tag/v0.0.24). A number of GitHub APIs are being turned off shortly, so you need to upgrade or various uncertain outcomes will occur. There's a new accessibility forbidden pattern: > Do not use `(click) here` links > For more information, see: > * https://www.w3.org/QA/Tips/noClickHere > * https://webaim.org/techniques/hypertext/link_text > * https://granicus.com/blog/why-click-here-links-are-bad/ > * https://heyoka.medium.com/dont-use-click-here-f32f445d1021 ```pl (?i)(?:>|\[)(?:(?:click |)here|link|(?:read |)more)(?:|m([|!/@#,;']).*?\g{-1}) # perl qr regex (?|\(.*?\)|([|!/@#,;']).*?\g{-1}) +# perl run +perl(?:\s+-[a-zA-Z]\w*)+ + +# C network byte conversions +#(?:\d|\bh)to(?!ken)(?=[a-z])|to(?=[adhiklpun]\() + # Go regular expressions regexp?\.MustCompile\(`[^`]*`\) @@ -503,14 +549,20 @@ regexp?\.MustCompile\(`[^`]*`\) sed 's/(?:[^/]*?[a-zA-Z]{3,}[^/]*?/){2} # node packages -(["'])\@[^/'" ]+/[^/'" ]+\g{-1} +(["'])@[^/'" ]+/[^/'" ]+\g{-1} # go install go install(?:\s+[a-z]+\.[-@\w/.]+)+ +# pom.xml +<(?:group|artifact)Id>.*?< + # jetbrains schema https://youtrack.jetbrains.com/issue/RSRP-489571 urn:shemas-jetbrains-com +# Debian changelog severity +[-\w]+ \(.*\) (?:\w+|baseline|unstable|experimental); urgency=(?:low|medium|high|emergency|critical)\b + # kubernetes pod status lists # https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-phase \w+(?:-\w+)+\s+\d+/\d+\s+(?:Running|Pending|Succeeded|Failed|Unknown)\s+ @@ -518,9 +570,15 @@ urn:shemas-jetbrains-com # kubectl - pods in CrashLoopBackOff \w+-[0-9a-f]+-\w+\s+\d+/\d+\s+CrashLoopBackOff\s+ +# kubernetes applications +\.apps/[-\w]+ + # kubernetes object suffix -[0-9a-f]{10}-\w{5}\s +# kubernetes crd patterns +^\s*pattern: .*$ + # posthog secrets ([`'"])phc_[^"',]+\g{-1} @@ -532,6 +590,9 @@ urn:shemas-jetbrains-com # xcode api botches customObjectInstantitationMethod +# msvc api botches +PrependWithABINamepsace + # configure flags .* \| --\w{2,}.*?(?=\w+\s\w+) @@ -539,21 +600,34 @@ customObjectInstantitationMethod \.fa-[-a-z0-9]+ # bearer auth -(['"])Bear[e][r] .*?\g{-1} +(['"])[Bb]ear[e][r] .*?\g{-1} + +# bearer auth +\b[Bb]ear[e][r]:? [-a-zA-Z=;:/0-9+.]+ # basic auth -(['"])Basic [-a-zA-Z=;:/0-9+]{3,}\g{-1} +(['"])[Bb]asic [-a-zA-Z=;:/0-9+]{3,}\g{-1} # base64 encoded content -([`'"])[-a-zA-Z=;:/0-9+]+=\g{-1} +#([`'"])[-a-zA-Z=;:/0-9+]{3,}=\g{-1} # base64 encoded content in xml/sgml ->[-a-zA-Z=;:/0-9+]+=[-a-zA-Z=;:/0-9+]{3,}== 0.0.22) \\\w{2,}\{ +# American Mathematical Society (AMS) / Doxygen +TeX/AMS + +# File extensions +\*\.[+\w]+, + # eslint "varsIgnorePattern": ".+" +# nolint +nolint:\w+ + # Windows short paths -[/\\][^/\\]{5,6}~\d{1,2}[/\\] +[/\\][^/\\]{5,6}~\d{1,2}(?=[/\\]) + +# Windows Resources with accelerators +\b[A-Z]&[a-z]+\b(?!;) + +# cygwin paths +/cygdrive/[a-zA-Z]/(?:Program Files(?: \(.*?\)| ?)(?:/[-+.~\\/()\w ]+)*|[-+.~\\/()\w])+ # in check-spelling@v0.0.22+, printf markers aren't automatically consumed # printf markers #(? MOZILLA PUBLIC LICENSE v1.1 aaaa abcdefghjkmnpqrstuvxyz abgr @@ -22,7 +19,6 @@ ADDUNDORECORD ADifferent adml admx -advapi advfirewall AFeature AFFINETRANSFORM @@ -56,7 +52,6 @@ APPBARDATA appdata APPEXECLINK Appium -Applicationcan APPLICATIONFRAMEHOST appmanifest appmodel @@ -124,7 +119,6 @@ bmi bms BNumber BODGY -BOKMAL bootstrapper BOOTSTRAPPERINSTALLFOLDER bostrot @@ -164,7 +158,6 @@ CCom CContext CDeclaration CDEF -cdpx CElems CENTERALIGN ceq @@ -180,7 +173,6 @@ cidl cim CImage cla -clangformat CLASSDC CLASSNOTAVAILABLE clickable @@ -202,12 +194,10 @@ CMINVOKECOMMANDINFO CMINVOKECOMMANDINFOEX CMock CMONITORS -cmpgt cmph cne CNF coclass -codeofconduct codereview Codespaces codicon @@ -217,7 +207,6 @@ colorformat colorhistory colorhistorylimit COLORKEY -comctl comdef comdlg comexp @@ -227,9 +216,6 @@ commctrl commdlg compmgmt COMPOSITIONFULL -comsupp -comsuppw -comsuppwd comutil CONFIGW CONFLICTINGMODIFIERKEY @@ -249,7 +235,6 @@ COULDNOT countof cph CPower -cppblog cppwinrt createdump CREATESCHEDULEDTASK @@ -266,7 +251,6 @@ CSettings cso CSRW CStyle -CSY CTest currentculture CURRENTDIR @@ -277,7 +261,6 @@ CUSTOMACTIONTEST CVal cvd CVirtual -cvtepu cxfksword CXSCREEN CXSMICON @@ -293,7 +276,6 @@ datareader datatracker dataversion Dayof -Dbghelp DBLCLKS DBLEPSILON DCapture @@ -378,7 +360,7 @@ drivedetectionwarning dshow DSTINVERT DUMMYUNIONNAME -dutil +Dutil DVASPECT DVASPECTINFO DVD @@ -407,21 +389,17 @@ dwrite dxgi dxgidebug dxgiformat -dxguid easeofaccess ecount EData Edid EDITKEYBOARD -editkeyboardwindow EDITSHORTCUTS -editshortcutswindow EFile ekus emmintrin Emoji ENABLEDELAYEDEXPANSION -enabledisable ENABLEDPOPUP encodedlaunch encryptor @@ -444,11 +422,9 @@ ESettings esrp etl etw -EUQ eurochange eventlog eventvwr -everytime evntrace evt EWXFORCE @@ -521,6 +497,7 @@ FZE gacutil Gaeilge Gaidhlig +GC'ed GCLP gdi gdiplus @@ -549,12 +526,10 @@ GSM gtm guiddata guiddef -guidgenerator GUITHREADINFO GValue gwl GWLP -handlekeyboardhookevent hangeul Hanzi Hardlines @@ -640,38 +615,25 @@ HWNDLAST HWNDNEXT HWNDPREV hyjiacan -IApp IBeam -ICapture -IClass ICONERROR ICONLOCATION -IData IDD -IDesktop -IDirect idl idlist -IDOn IDR IDXGI -IEnum ietf -IExec IEXPLORE IFACEMETHOD IFACEMETHODIMP IFile -IFilter IGNOREUNKNOWN -IGraphics iid Iindex -IJson Ijwhost IKs iljxck -ILogon IMAGEHLP IMAGERESIZERCONTEXTMENU IMAGERESIZEREXT @@ -683,7 +645,7 @@ inetcpl Infobar INFOEXAMPLE Infotip -initguid +INITGUID inorder INPC inproc @@ -691,7 +653,6 @@ INPUTHARDWARE INPUTKEYBOARD INPUTLANGCHANGED INPUTMOUSE -inputparser INPUTSINK INPUTTYPE INSTALLDESKTOPSHORTCUT @@ -712,30 +673,21 @@ INTRESOURCE INVALIDARG invalidoperatioexception ipcmanager -IPlugin -IPower IPREVIEW ipreviewhandlervisualssetfont -IProperty -IPublic irprops isbi ISearch ISettings -IShell isocpp iss issecret ISSEPARATOR -ITask ith ITHUMBNAIL -ITwoWayPipeMessageIPCManaged IUI IUnknown IUse -IWbem -IWeb IWIC iwr IYUV @@ -757,7 +709,6 @@ keyboardmanagercommon KEYBOARDMANAGEREDITOR keyboardmanagerstate keyboardmanagerui -keydropdowncontrol KEYEVENTF KEYIMAGE keynum @@ -769,25 +720,21 @@ kmph Knownfolders KSPROPERTY Kybd -languagesjson lastcodeanalysissucceeded Lastdevice LASTEXITCODE LAYOUTRTL lcb LCIDTo -lcl Lclean Ldone ldx LEFTSCROLLBAR -lego LError LEVELID LExit lhwnd LIBID -licate lindex LINKOVERLAY LINQTo @@ -864,7 +811,6 @@ MAKEINTRESOURCE MAKEINTRESOURCEA MAKEINTRESOURCEW MAKELANGID -makepri manifestdependency MAPPEDTOSAMEKEY MAPTOSAMESHORTCUT @@ -892,13 +838,11 @@ mfc mfidl mfobjects mfplat -Mfsensorgroup mftransform Mgmt mic midl mii -MIIM mindaro Minimatch Minimizable @@ -988,7 +932,6 @@ NCPAINT NCRENDERING ndp NEEDDISPATCH -needinfo netcoreapp netcpl netframework @@ -1006,7 +949,6 @@ NEWPLUSSHELLEXTENSIONWIN newrow newsgroups NIF -NLD NLog NLSTEXT NNN @@ -1083,7 +1025,6 @@ oldpath oldtheme oleaut OLECHAR -onebranch opencode OPENFILENAME opensource @@ -1140,7 +1081,6 @@ pdto pdtobj pdw Peb -pef PElems Pels PERCEIVEDFLAG @@ -1165,7 +1105,6 @@ pinvoke pipename PKBDLLHOOKSTRUCT plib -PLK ploc ploca plocm @@ -1212,7 +1151,6 @@ prgms pri PRINTCLIENT printmanagement -privacystatement prm proactively PROCESSENTRY @@ -1227,7 +1165,6 @@ projectname PROPBAG PROPERTYKEY propkey -propsys PROPVARIANT propvarutil prvpane @@ -1237,7 +1174,6 @@ PSECURITY psfgao psfi PSMODULEPATH -Psr psrm psrree pstatstg @@ -1254,7 +1190,7 @@ PTOKEN PToy ptstr pui -pwa +PWAs pwcs PWSTR pwsz @@ -1320,7 +1256,6 @@ Renamer reparented reparenting reparse -reportbug reportfileaccesses requery requerying @@ -1332,7 +1267,6 @@ RESIZETOFIT resmimetype RESOURCEID RESTORETOMAXIMIZED -restrictedcapabilities restrictederrorinfo resultlist RETURNONLYFSDIRS @@ -1359,7 +1293,6 @@ Rsp rstringalnum rstringalpha rstringdigit -Rstrtmgr RTB RTLREADING ruleset @@ -1368,7 +1301,6 @@ rundll rungameid RUNLEVEL runtimeclass -runtimeobject runtimepack runtimes ruuid @@ -1388,14 +1320,13 @@ Scode screensaver screenshots scrollviewer -sddl +SDDL SDKDDK sdns searchterm SEARCHUI secpol SENDCHANGE -sendinput sendvirtualinput serverside SETCONTEXT @@ -1411,7 +1342,6 @@ settingsheader settingshotkeycontrol setvariable SETWORKAREA -setzero sfgao SFGAOF SHANDLE @@ -1419,7 +1349,7 @@ sharpkeys SHCNE SHCNF SHCONTF -shcore +Shcore shellapi SHELLDETAILS SHELLDLL @@ -1440,7 +1370,6 @@ shmem SHNAMEMAPPING shobjidl SHORTCUTATLEAST -shortcutcontrol SHORTCUTMAXONEACTIONKEY SHORTCUTNOREPEATEDMODIFIER SHORTCUTONEACTIONKEY @@ -1469,7 +1398,6 @@ sigdn SIGNINGSCENARIO Signtool SINGLEKEY -singlekeyremapcontrol sipolicy SIZEBOX Sizename @@ -1540,7 +1468,6 @@ STRINGIZE stringtable stringval Strm -Strmiids strret strsafe strutil @@ -1581,7 +1508,6 @@ SYSLIB SYSMENU SYSTEMAPPS SYSTEMTIME -SYSTEMWOW tailwindcss tapp TApplication @@ -1594,7 +1520,7 @@ TARGETHEADER targetver taskkill taskschd -tchar +TCHAR Tcollab tcs tcscpy @@ -1645,7 +1571,6 @@ traies transicc TRAYMOUSEMESSAGE triaging -TRK trl trx tsa @@ -1680,7 +1605,7 @@ uniquifier Uniquifies unitconverter unittests -unknwn +Unknwn UNLEN UNORM unregistering @@ -1698,14 +1623,13 @@ Usb USEDEFAULT USEFILEATTRIBUTES USERDATA -Userenv USESHOWWINDOW USESTDHANDLES USRDLL UType uuidv uwp -uxtheme +Uxtheme vabdq validmodulename valuegenerator @@ -1769,8 +1693,6 @@ Vtbl WANTMAPPINGHANDLE WANTPALM wbem -Wbemidl -wbemuuid WBounds Wca wcautil @@ -1788,9 +1710,9 @@ webcam webpage websites wekyb -Wevtapi wgpocpl WIC +wifi wil winapi wincodec @@ -1806,7 +1728,6 @@ WINDOWPOSCHANGED WINDOWPOSCHANGING windowsapp WINDOWSBUILDNUMBER -Windowscodecs windowssearch windowssettings WINDOWSTYLES @@ -1817,20 +1738,17 @@ WINEVENT winevt winexe winforms -winfx winget wingetcreate Winhook WINL winlogon winmd -winmm -winnt +WINNT winres winrt winsdk winsdkver -winspool winsta winternl WINTHRESHOLD @@ -1857,7 +1775,6 @@ WNDCLASSEXW WNDCLASSW WNDPROC wnode -workarounds WORKSPACESEDITOR WORKSPACESLAUNCHER WORKSPACESSNAPSHOTTOOL @@ -1897,7 +1814,6 @@ XElement xfd XFile XIncrement -XLoc XNamespace Xoshiro XPels diff --git a/.github/actions/spell-check/line_forbidden.patterns b/.github/actions/spell-check/line_forbidden.patterns index 8ddb666cd6..24483dd6f5 100644 --- a/.github/actions/spell-check/line_forbidden.patterns +++ b/.github/actions/spell-check/line_forbidden.patterns @@ -1,119 +1,289 @@ # reject `m_data` as VxWorks defined it and that breaks things if it's used elsewhere # see [fprime](https://github.com/nasa/fprime/commit/d589f0a25c59ea9a800d851ea84c2f5df02fb529) # and [Qt](https://github.com/qtproject/qt-solutions/blame/fb7bc42bfcc578ff3fa3b9ca21a41e96eb37c1c7/qtscriptclassic/src/qscriptbuffer_p.h#L46) -# \bm_data\b +#\bm_data\b +# Were you debugging using a framework with `fit()`? # If you have a framework that uses `it()` for testing and `fit()` for debugging a specific test, -# you might not want to check in code where you were debugging w/ `fit()`, in which case, you might want -# to use this: +# you might not want to check in code where you skip all the other tests. #\bfit\( -# s.b. anymore +# Should be `HH:MM:SS` +\bHH:SS:MM\b + +# Should be `86400` (seconds in a standard day) +\b84600\b(?:.*\bday\b) + +# Should probably be `2006-01-02` (yyyy-mm-dd) +# Assuming that the time is being passed to https://go.dev/src/time/format.go +\b2006-02-01\b + +# Should probably be `YYYYMMDD` +\b[Yy]{4}[Dd]{2}[Mm]{2}(?!.*[Yy]{4}[Dd]{2}[Mm]{2}).*$ + +# Should be `a priori` or `and prior` +(?i)(? Don't use `can not` when you mean `cannot`. The only time you're likely to see `can not` written as separate words is when the word `can` happens to precede some other phrase that happens to start with `not`. +# > `Can't` is a contraction of `cannot`, and it's best suited for informal writing. +# > In formal writing and where contractions are frowned upon, use `cannot`. +# > It is possible to write `can not`, but you generally find it only as part of some other construction, such as `not only . . . but also.` +# - if you encounter such a case, add a pattern for that case to patterns.txt. +\b[Cc]an not\b + +# Do not use `(click) here` links +# For more information, see: +# * https://www.w3.org/QA/Tips/noClickHere +# * https://webaim.org/techniques/hypertext/link_text +# * https://granicus.com/blog/why-click-here-links-are-bad/ +# * https://heyoka.medium.com/dont-use-click-here-f32f445d1021 +(?i)(?:>|\[)(?:(?:click |)here|this(?=\]\([^\)]+:/)|link|(?:read |)more(?!|".*?") -# hit-count: 2239 file-count: 134 -# hex runs -\b[0-9a-fA-F]{16,}\b +# #pragma lib +^\s*#pragma comment\(lib, ".*?"\) -# hit-count: 1868 file-count: 1 -# sha-... -- uses a fancy capture -(\\?['"]|")[0-9a-f]{40,}\g{-1} +# languageHashTable +"\w+(?:-\w+|)"\s+=\s+@\(".*"\) -# hit-count: 1100 file-count: 97 -# base64 encoded content, possibly wrapped in mime -(?:^|[\s=;:?])[-a-zA-Z=;:/0-9+]{50,}(?:[\s=;:?]|$) +# wikipedia +\b\w\w\.wikipedia\.org/wiki/[-\w%.#]+ -# hit-count: 426 file-count: 165 -# GitHub SHAs (markdown) -(?:\[`?[0-9a-f]+`?\]\(https:/|)/(?:www\.|)github\.com(?:/[^/\s"]+){2,}(?:/[^/\s")]+)(?:[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|) +# css fonts +\bfont-family:[^;}]+ -# hit-count: 331 file-count: 117 -# hex digits including css/html color classes: -(?:[\\0][xX]|\\u|[uU]\+|#x?|\%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b - -# hit-count: 275 file-count: 45 -# version suffix v# -(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_])) - -# hit-count: 209 file-count: 97 -# w3 -\bw3\.org/[-0-9a-zA-Z/#.]+ - -# hit-count: 137 file-count: 38 -# alternate markers if you run into latex and friends -(?]|\b)[0-9a-fA-F]{8}-(?:[0-9a-fA-F]{4}-){3}[0-9a-fA-F]{10,12}(?:\g{ # UnitTests \[DataRow\(.*\)\] +# AdditionalDependencies +.*< + +# the last line of mimetype="application/x-microsoft.net.object.bytearray.base64" things in .resx files +^\s*[-a-zA-Z=;:/0-9+]*[-a-zA-Z;:/0-9+][-a-zA-Z=;:/0-9+]*=$ + +# Automatically suggested patterns + +# hit-count: 3715 file-count: 992 +# IServiceProvider / isAThing +(?:\b|_)(?:(?:ns|)I|isA)(?=(?:[A-Z][a-z]{2,})+(?:[A-Z\d]|\b)) + +# hit-count: 404 file-count: 42 +# base64 encoded content, possibly wrapped in mime +(?:^|[\s=;:?])[-a-zA-Z=;:/0-9+]{50,}(?:[\s=;:?]|$) + +# hit-count: 402 file-count: 160 +# hex runs +\b[0-9a-fA-F]{16,}\b + +# hit-count: 337 file-count: 110 +# hex digits including css/html color classes: +(?:[\\0][xX]|\\u|[uU]\+|#x?|%23)[0-9_a-fA-FgGrR]*?[a-fA-FgGrR]{2,}[0-9_a-fA-FgGrR]*(?:[uUlL]{0,3}|[iu]\d+)\b + +# hit-count: 311 file-count: 43 # D2D -D?2D +D?2D(?!efault) + +# hit-count: 272 file-count: 75 +# GitHub SHAs (markdown) +(?:\[`?[0-9a-f]+`?\]\(https:/|)/(?:www\.|)github\.com(?:/[^/\s"]+){2,}(?:/[^/\s")]+)(?:[0-9a-f]+(?:[-0-9a-zA-Z/#.]*|)\b|) + +# hit-count: 146 file-count: 27 +# version suffix v# +(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_])) + +# hit-count: 105 file-count: 103 +# w3 +\bw3\.org/[-0-9a-zA-Z/#.]+ + +# hit-count: 94 file-count: 6 +# Contributor +\[[^\]]+\]\(https://github\.com/[^/\s"]+/?\) + +RegExp\(([`'"]).*?\g{-1}\)|(?:escapes|regEx):\s*(?:/.*/|([`'"]).*?\g{-1})|return/.*?/ + +# hit-count: 65 file-count: 38 +# regex choice +\(\?:[^)]+\|[^)]+\) + +# hit-count: 37 file-count: 14 +# Markdown anchor links +\(#\S*?[a-zA-Z]\S*?\) + +# hit-count: 33 file-count: 5 +# base64 encoded pkcs +\bMII[-a-zA-Z=;:/0-9+]+ + +# hit-count: 28 file-count: 22 +# stackexchange -- https://stackexchange.com/feeds/sites +\b(?:askubuntu|serverfault|stack(?:exchange|overflow)|superuser).com/(?:questions/\w+/[-\w]+|a/) + +# hit-count: 14 file-count: 3 +# node packages +(["'])@[^/'" ]+/[^/'" ]+\g{-1} + +# hit-count: 13 file-count: 1 +# Intel intrinsics +_mm_(?!dd)\w+ + +# hit-count: 11 file-count: 5 +# URL escaped characters +%[0-9A-F][A-F](?=[A-Za-z]) + +# hit-count: 9 file-count: 5 +# Wikipedia +\ben\.wikipedia\.org/wiki/[-\w%.#]+ + +# hit-count: 5 file-count: 4 +# vs devops +\bvisualstudio.com(?::443|)/[-\w/?=%&.]* + +# hit-count: 5 file-count: 4 +# Alternatively, if you're using check-spelling v0.0.25+, and you would like to _check_ the Non-English content for spelling errors, you can. For information on how to do so, see: +# https://docs.check-spelling.dev/Feature:-Configurable-word-characters.html#unicode +[a-zA-Z]*[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3}[a-zA-ZÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]*|[a-zA-Z]{3,}[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź]|[ÀÁÂÃÄÅÆČÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝßàáâãäåæčçèéêëìíîïðñòóôõöøùúûüýÿĀāŁłŃńŅņŒœŚśŠšŜŝŸŽžź][a-zA-Z]{3,} + +# hit-count: 4 file-count: 4 +# microsoft +\b(?:https?://|)(?:(?:(?:blogs|download\.visualstudio|docs|msdn2?|research)\.|)microsoft|blogs\.msdn)\.co(?:m|\.\w\w)/[-_a-zA-Z0-9()=./%]* + +aka\.ms/[a-zA-Z0-9]+ + +# hit-count: 3 file-count: 3 +# githubusercontent +/[-a-z0-9]+\.githubusercontent\.com/[-a-zA-Z0-9?&=_\/.]* + +# hit-count: 3 file-count: 2 +# css url wrappings +\burl\([^)]+\) + +# hit-count: 3 file-count: 1 +# kubernetes crd patterns +^\s*pattern: .*$ + +# hit-count: 3 file-count: 1 +# Lorem +# Update Lorem based on your content (requires `ge` and `w` from https://github.com/jsoref/spelling; and `review` from https://github.com/check-spelling/check-spelling/wiki/Looking-for-items-locally ) +# grep '^[^#].*lorem' .github/actions/spelling/patterns.txt|perl -pne 's/.*i..\?://;s/\).*//' |tr '|' "\n"|sort -f |xargs -n1 ge|perl -pne 's/^[^:]*://'|sort -u|w|sed -e 's/ .*//'|w|review - +# Warning, while `(?i)` is very neat and fancy, if you have some binary files that aren't proper unicode, you might run into: +# ... Operation "substitution (s///)" returns its argument for non-Unicode code point 0x1C19AE (the code point will vary). +# ... You could manually change `(?i)X...` to use `[Xx]...` +# ... or you could add the files to your `excludes` file (a version after 0.0.19 should identify the file path) +(?:(?:\w|\s|[,.])*\b(?i)(?:amet|consectetur|cursus|dolor|eros|ipsum|lacus|libero|ligula|lorem|magna|neque|nulla|suscipit|tempus)\b(?:\w|\s|[,.])*) + +# hit-count: 3 file-count: 1 +# libraries +(?:\b|_)lib(?:re(?=office)|)(?!era[lt]|ero|erty|rar(?:i(?:an|es)|y))(?=[a-z]) + +# hit-count: 2 file-count: 1 +# While you could try to match `http://` and `https://` by using `s?` in `https?://`, sometimes there +# YouTube url +\b(?:(?:www\.|)youtube\.com|youtu.be)/(?:channel/|embed/|user/|playlist\?list=|watch\?v=|v/|)[-a-zA-Z0-9?&=_%]* # hit-count: 1 file-count: 1 # GHSA GHSA(?:-[0-9a-z]{4}){3} # hit-count: 1 file-count: 1 -# medium -\bmedium\.com/\@?[^/\s"]+/[-\w]+ +# GitHub actions +\buses:\s+[-\w.]+/[-\w./]+@[-\w.]+ # hit-count: 1 file-count: 1 -# kubectl.kubernetes.io/last-applied-configuration -"kubectl.kubernetes.io/last-applied-configuration": ".*" +# medium +\bmedium\.com/@?[^/\s"]+/[-\w]+ + +# hit-count: 1 file-count: 1 +# sha-... -- uses a fancy capture +(\\?['"]|")[0-9a-f]{40,}\g{-1} # hit-count: 1 file-count: 1 # tar arguments \b(?:\\n|)g?tar(?:\.exe|)(?:(?:\s+--[-a-zA-Z]+|\s+-[a-zA-Z]+|\s[ABGJMOPRSUWZacdfh-pr-xz]+\b)(?:=[^ ]*|))+ -\bSecur32 - # Questionably acceptable forms of `in to` # Personally, I prefer `log into`, but people object # https://www.tprteaching.com/log-into-log-in-to-login/ -\b(?:[Ll]og|[Ss]ign) in to\b +\b(?:(?:[Ll]og(?:g(?=[a-z])|)|[Ss]ign)(?:ed|ing)?) in to\b # to opt in \bto opt in\b # acceptable duplicates # ls directory listings -[-bcdlpsw](?:[-r][-w][-Ssx]){3}\s+\d+\s+\S+\s+\S+\s+\d+\s+ +[-bcdlpsw](?:[-r][-w][-SsTtx]){3}[\.+*]?\s+\d+\s+\S+\s+\S+\s+[.\d]+(?:[KMGT]|)\s+ # mount \bmount\s+-t\s+(\w+)\s+\g{-1}\b # C types and repeated CSS values -\s(auto|center|div|inherit|long|LONG|none|normal|solid|thin|transparent|very)(?: \g{-1})+\s -# C struct -\bstruct\s+(\w+)\s+\g{-1}\b +\s(auto|buffalo|center|div|inherit|long|LONG|none|normal|solid|thin|transparent|very)(?: \g{-1})+\s +# C enum and struct +\b(?:enum|struct)\s+(\w+)\s+\g{-1}\b # go templates \s(\w+)\s+\g{-1}\s+\`(?:graphql|inject|json|yaml): # doxygen / javadoc / .net -(?:[\\@](?:brief|groupname|t?param|return|retval)|(?:public|private|\[Parameter(?:\(.+\)|)\])(?:\s+static|\s+override|\s+readonly)*)(?:\s+\{\w+\}|)\s+(\w+)\s+\g{-1}\s +(?:[\\@](?:brief|defgroup|groupname|link|t?param|return|retval)|(?:public|private|\[Parameter(?:\(.+\)|)\])(?:\s+(?:static|override|readonly|required|virtual))*)(?:\s+\{\w+\}|)\s+(\w+)\s+\g{-1}\s + +# macOS file path +(?:Contents\W+|(?!iOS)/)MacOS\b + +# Python package registry has incorrect spelling for macOS / Mac OS X +"Operating System :: MacOS :: MacOS X" + +# "company" in Germany +\bGmbH\b + +# IntelliJ +\bIntelliJ\b # Commit message -- Signed-off-by and friends ^\s*(?:(?:Based-on-patch|Co-authored|Helped|Mentored|Reported|Reviewed|Signed-off)-by|Thanks-to): (?:[^<]*<[^>]*>|[^<]*)\s*$ diff --git a/.github/actions/spell-check/reject.txt b/.github/actions/spell-check/reject.txt index e5e4c3eef8..5cc86ef80c 100644 --- a/.github/actions/spell-check/reject.txt +++ b/.github/actions/spell-check/reject.txt @@ -3,9 +3,11 @@ benefitting occurences? ^dependan.* +^diables?$ ^oer$ Sorce ^[Ss]pae.* +^Teh$ ^untill$ ^untilling$ ^wether.* diff --git a/.github/workflows/spelling2.yml b/.github/workflows/spelling2.yml index b550f8986b..e79708399f 100644 --- a/.github/workflows/spelling2.yml +++ b/.github/workflows/spelling2.yml @@ -34,14 +34,14 @@ name: Spell checking # # For background, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Update-with-deploy-key -# Sarif reporting +# SARIF reporting # -# Access to Sarif reports is generally restricted (by GitHub) to members of the repository. +# Access to SARIF reports is generally restricted (by GitHub) to members of the repository. # # Requires enabling `security-events: write` # and configuring the action with `use_sarif: 1` # -# For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-Sarif-output +# For information on the feature, see: https://github.com/check-spelling/check-spelling/wiki/Feature:-SARIF-output # Minimal workflow structure: # @@ -60,23 +60,23 @@ name: Spell checking on: push: branches: - - "**" + - "**" tags-ignore: - - "**" + - "**" pull_request_target: branches: - - "**" + - "**" types: - - 'opened' - - 'reopened' - - 'synchronize' + - "opened" + - "reopened" + - "synchronize" issue_comment: types: - - 'created' + - "created" jobs: spelling: - name: Spell checking + name: Check Spelling permissions: contents: read pull-requests: read @@ -91,52 +91,59 @@ jobs: # note: If you use only_check_changed_files, you do not want cancel-in-progress cancel-in-progress: true steps: - - name: check-spelling - id: spelling - uses: check-spelling/check-spelling@v0.0.22 - with: - config: .github/actions/spell-check - suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }} - checkout: true - check_file_names: 1 - spell_check_this: microsoft/PowerToys@main - post_comment: 0 - use_magic_file: 1 - warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check - experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }} - use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }} - extra_dictionary_limit: 20 - extra_dictionaries: - cspell:aws/aws.txt - cspell:cpp/src/compiler-clang-attributes.txt - cspell:cpp/src/compiler-msvc.txt - cspell:cpp/src/lang-keywords.txt - cspell:cpp/src/stdlib-c.txt - cspell:cpp/src/stdlib-cmath.txt - cspell:cpp/src/stdlib-cpp.txt - cspell:csharp/csharp.txt - cspell:css/dict/css.txt - cspell:django/dict/django.txt - cspell:dotnet/dict/dotnet.txt - cspell:filetypes/filetypes.txt - cspell:fullstack/dict/fullstack.txt - cspell:golang/dict/go.txt - cspell:html/dict/html.txt - cspell:java/src/java.txt - cspell:java/src/java-terms.txt - cspell:k8s/dict/k8s.txt - cspell:lorem-ipsum/dictionary.txt - cspell:monkeyc/src/monkeyc_keywords.txt - cspell:node/dict/node.txt - cspell:php/dict/php.txt - cspell:powershell/dict/powershell.txt - cspell:python/src/common/extra.txt - cspell:python/src/python/python.txt - cspell:python/src/python/python-lib.txt - cspell:scala/dict/scala.txt - cspell:software-terms/dict/softwareTerms.txt - cspell:swift/src/swift.txt - cspell:typescript/dict/typescript.txt + - name: check-spelling + id: spelling + uses: check-spelling/check-spelling@v0.0.24 + with: + config: .github/actions/spell-check + suppress_push_for_open_pull_request: ${{ github.actor != 'dependabot[bot]' && 1 }} + checkout: true + check_file_names: 1 + spell_check_this: microsoft/PowerToys@main + post_comment: 0 + use_magic_file: 1 + report-timing: 1 + warnings: bad-regex,binary-file,deprecated-feature,ignored-expect-variant,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,token-is-substring,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration,no-files-to-check,unclosed-block-ignore-begin,unclosed-block-ignore-end + experimental_apply_changes_via_bot: 1 + use_sarif: ${{ (!github.event.pull_request || (github.event.pull_request.head.repo.full_name == github.repository)) && 1 }} + check_extra_dictionaries: "" + dictionary_source_prefixes: > + { + "cspell": "https://raw.githubusercontent.com/check-spelling/cspell-dicts/v20241114/dictionaries/" + } + extra_dictionaries: | + cspell:software-terms/softwareTerms.txt + cspell:cpp/stdlib-cpp.txt + cspell:filetypes/filetypes.txt + cspell:cpp/stdlib-c.txt + cspell:lorem-ipsum/dictionary.txt + cspell:python/python/python-lib.txt + cspell:php/php.txt + cspell:fullstack/fullstack.txt + cspell:dotnet/dotnet.txt + cspell:swift/swift.txt + cspell:node/node.txt + cspell:dart/dart.txt + cspell:django/django.txt + cspell:python/python/python.txt + cspell:powershell/powershell.txt + cspell:npm/npm.txt + cspell:golang/go.txt + cspell:cpp/compiler-msvc.txt + cspell:csharp/csharp.txt + cspell:html/html.txt + cspell:java/java.txt + cspell:aws/aws.txt + cspell:typescript/typescript.txt + cspell:cpp/lang-keywords.txt + cspell:python/common/extra.txt + cspell:scala/scala.txt + cspell:shell/shell-all-words.txt + cspell:css/css.txt + cspell:r/r.txt + cspell:java/java-terms.txt + cspell:cpp/stdlib-cerrno.txt + cspell:k8s/k8s.txt comment-push: name: Report (Push) @@ -144,16 +151,17 @@ jobs: runs-on: ubuntu-latest needs: spelling permissions: + actions: read contents: write if: (success() || failure()) && needs.spelling.outputs.followup && github.event_name == 'push' steps: - - name: comment - uses: check-spelling/check-spelling@v0.0.22 - with: - config: .github/actions/spell-check - checkout: true - spell_check_this: microsoft/PowerToys@main - task: ${{ needs.spelling.outputs.followup }} + - name: comment + uses: check-spelling/check-spelling@v0.0.24 + with: + config: .github/actions/spell-check + checkout: true + spell_check_this: microsoft/PowerToys@main + task: ${{ needs.spelling.outputs.followup }} comment-pr: name: Report (PR) @@ -161,18 +169,19 @@ jobs: runs-on: ubuntu-latest needs: spelling permissions: + actions: read contents: read pull-requests: write if: (success() || failure()) && needs.spelling.outputs.followup && contains(github.event_name, 'pull_request') steps: - - name: comment - uses: check-spelling/check-spelling@v0.0.22 - with: - config: .github/actions/spell-check - checkout: true - spell_check_this: check-spelling/spell-check-this@prerelease - task: ${{ needs.spelling.outputs.followup }} - experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }} + - name: comment + uses: check-spelling/check-spelling@v0.0.24 + with: + config: .github/actions/spell-check + checkout: true + spell_check_this: check-spelling/spell-check-this@prerelease + task: ${{ needs.spelling.outputs.followup }} + experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }} update: name: Update PR @@ -182,18 +191,19 @@ jobs: actions: read runs-on: ubuntu-latest if: ${{ - github.repository_owner != 'microsoft' && - github.event_name == 'issue_comment' && - github.event.issue.pull_request && - contains(github.event.comment.body, '@check-spelling-bot apply') + github.repository_owner != 'microsoft' && + github.event_name == 'issue_comment' && + github.event.issue.pull_request && + contains(github.event.comment.body, '@check-spelling-bot apply') && + contains(github.event.comment.body, 'https://') }} concurrency: group: spelling-update-${{ github.event.issue.number }} cancel-in-progress: false steps: - - name: apply spelling updates - uses: check-spelling/check-spelling@v0.0.22 - with: - experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }} - checkout: true - ssh_key: "${{ secrets.CHECK_SPELLING }}" + - name: apply spelling updates + uses: check-spelling/check-spelling@v0.0.24 + with: + experimental_apply_changes_via_bot: ${{ github.repository_owner != 'microsoft' && 1 }} + checkout: true + ssh_key: "${{ secrets.CHECK_SPELLING }}" diff --git a/doc/devdocs/common/common.md b/doc/devdocs/common/common.md index 5d5d906a44..9bc6e39e16 100644 --- a/doc/devdocs/common/common.md +++ b/doc/devdocs/common/common.md @@ -97,6 +97,6 @@ namespace ``` -Note: since _background activation_ implies that your toast handler will be invoked in a separate process, you can't share data directly from within a handler and your PT process. Also, since PT is currently a Desktop Bridge app, _foreground activation_ is [handled the same as background](https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl#foreground-vs-background-activation), therefore we don't make a dedicated API for it. You can read more on the rationale of the current design [here](https://github.com/microsoft/PowerToys/pull/1178#issue-368768337). +Note: since _background activation_ implies that your toast handler will be invoked in a separate process, you can't share data directly from within a handler and your PT process. Also, since PT is currently a Desktop Bridge app, _foreground activation_ is [handled the same as background](https://learn.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/send-local-toast-desktop-cpp-wrl#foreground-vs-background-activation), therefore we don't make a dedicated API for it. You can read more on the [rationale of the current design](https://github.com/microsoft/PowerToys/pull/1178#issue-368768337). diff --git a/doc/devdocs/localization.md b/doc/devdocs/localization.md index a3842a9f8c..322f90ab6d 100644 --- a/doc/devdocs/localization.md +++ b/doc/devdocs/localization.md @@ -17,13 +17,13 @@ ## Localization on the pipeline (CDPX) [The localization step](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L45-L52) is run on the pipeline before the solution is built. This step runs the [build-localization](https://github.com/microsoft/PowerToys/blob/main/.pipelines/build-localization.cmd) script, which generates resx files for all the projects with localization enabled using the `Localization.XLoc` package. -The [`Localization.XLoc`](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/build-localization.cmd#L24-L25) tool is run on the repo root, and it checks for all occurrences of `LocProject.json`. Each localized project has a `LocProject.json` file in the project root, which contains the location of the English resx file, list of languages for localization, and the output path where the localized resx files are to be copied to. In addition to this, some other parameters can be set, such as whether the language ID should be added as a folder in the file path or in the file name. When the CDPX pipeline is run, the localization team is notified of changes in the English resx files. For each project with localization enabled, a `loc` folder (see [this](https://github.com/microsoft/PowerToys/tree/main/src/modules/launcher/Microsoft.Launcher/loc) for example) is created in the same directory as the `LocProject.json` file. The folder contains language specific folders which in turn have a nested folder path equivalent to `OutputPath` in the `LocProject.json`. Each of these folders contain one `lcl` file. The `lcl` files contain the English resources along with their translation for that language. These are described in more detail [here](#lcl-files). Once the `.resx` files are generated, they will be used during the `Build PowerToys` step for localized versions of the modules. +The [`Localization.XLoc`](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/build-localization.cmd#L24-L25) tool is run on the repo root, and it checks for all occurrences of `LocProject.json`. Each localized project has a `LocProject.json` file in the project root, which contains the location of the English resx file, list of languages for localization, and the output path where the localized resx files are to be copied to. In addition to this, some other parameters can be set, such as whether the language ID should be added as a folder in the file path or in the file name. When the CDPX pipeline is run, the localization team is notified of changes in the English resx files. For each project with localization enabled, a `loc` folder (see [this](https://github.com/microsoft/PowerToys/tree/main/src/modules/launcher/Microsoft.Launcher/loc) for example) is created in the same directory as the `LocProject.json` file. The folder contains language specific folders which in turn have a nested folder path equivalent to `OutputPath` in the `LocProject.json`. Each of these folders contain one `lcl` file. The `lcl` files contain the English resources along with their translation for that language. These are described in more detail in the [Lcl files section](#lcl-files). Once the `.resx` files are generated, they will be used during the `Build PowerToys` step for localized versions of the modules. -Since the localization script requires certain nuget packages, the [`restore-localization`](https://github.com/microsoft/PowerToys/blob/main/.pipelines/restore-localization.cmd) script is run before running `build-localization` to install all the required packages. This script must [run in the `restore` step](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L37-L39) of pipeline because [the host is network isolated](https://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/2066/Consuming-Packages-in-a-CDPx-Pipelinhttps://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/2066/Consuming-Packages-in-a-CDPx-Pipeline?anchor=overview) at the `build` step. The [Toolset package source](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L23) is used for this. +Since the localization script requires certain nuget packages, the [`restore-localization`](https://github.com/microsoft/PowerToys/blob/main/.pipelines/restore-localization.cmd) script is run before running `build-localization` to install all the required packages. This script must [run in the `restore` step](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L37-L39) of pipeline because [the host is network isolated](https://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/2066/Consuming-Packages-in-a-CDPx-Pipeline?anchor=overview) at the `build` step. The [Toolset package source](https://github.com/microsoft/PowerToys/blob/86d77103e9c69686c297490acb04775d43ef8b76/.pipelines/pipeline.user.windows.yml#L23) is used for this. -The process and variables that can be tweaked on the pipeline are described in more detail [here](https://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/290/Localization). +The process and variables that can be tweaked on the pipeline are described in more detail on [onebranch (account required) under Localization](https://onebranch.visualstudio.com/Pipeline/_wiki/wikis/Pipeline.wiki/290/Localization). -The localized resource dlls for C# projects are added to the MSI only for build on the pipeline. This is done by checking if the [`IsPipeline` variable is defined](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/installer/PowerToysSetup/Product.wxs#L804-L805), which gets defined before building the installer on the pipeline [here](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/.pipelines/build-installer.cmd#L4). This is done because the localized resx files are only present on the pipeline, and not having this check would result in the installer project failing to build locally. +The localized resource dlls for C# projects are added to the MSI only for build on the pipeline. This is done by checking if the [`IsPipeline` variable is defined](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/installer/PowerToysSetup/Product.wxs#L804-L805), which gets defined before [building the installer on the pipeline](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/.pipelines/build-installer.cmd#L4). This is done because the localized resx files are only present on the pipeline, and not having this check would result in the installer project failing to build locally. ## Enabling localization on a new project To enable localization on a new project, the first step is to create a file `LocProject.json` in the project root. @@ -45,7 +45,7 @@ For example, for a project in the folder `src\path` where the resx file is prese ] } ``` -The rest of the steps depend on the project type and are covered in the sections below. The steps to add the localized files to the MSI can be found [here](#Enabling-localized-MSI-for-a-new-project). +The rest of the steps depend on the project type and are covered in the sections below. The steps to add the localized files to the MSI can be found in [Enabling localized MSI for a new project](#Enabling-localized-MSI-for-a-new-project). ### C++ C++ projects do not support `resx` files, and instead use `rc` files along with `resource.h` files. The CDPX pipeline however doesn't support localizing `rc` files and the other alternative they support is directly translating the resources from the binary which makes it harder to maintain resources. To avoid this, a custom script has been added which expects a resx file and converts the entries to an rc file with a string table and adds resource declarations to a resource.h file so that the resources can be compiled with the C++ project. @@ -59,7 +59,7 @@ After generating the resx file, rename the existing rc and h files to ProjName.b ``` -This event runs a script which generates a resource.h and ProjName.rc in the `Generated Files` folder using the strings in all the resx files along with the existing information in resource.base.h and ProjName.base.rc. The script can be found [here](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-resx-to-rc.ps1). The script uses [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) to convert the resx file to a string table expected in the .rc file format. When the resources are added to the rc file the `IDS_` prefix is added and resource names are in upper case (as it was originally). Any occurrences of `"` in the string resource is escaped as `""` to prevent build errors. The string tables are added to the rc file in the following format: +This event runs a script which generates a resource.h and ProjName.rc in the `Generated Files` folder using the strings in all the resx files along with the existing information in resource.base.h and ProjName.base.rc. The script is [convert-resx-to-rc.ps1](https://github.com/microsoft/PowerToys/blob/main/tools/build/convert-resx-to-rc.ps1). The script uses [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) to convert the resx file to a string table expected in the .rc file format. When the resources are added to the rc file the `IDS_` prefix is added and resource names are in upper case (as it was originally). Any occurrences of `"` in the string resource is escaped as `""` to prevent build errors. The string tables are added to the rc file in the following format: ``` #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US @@ -71,7 +71,7 @@ END #endif ``` -Since there is no API to identify the `AFX_TARG_*`, `LANG_*` or `SUBLANG_*` values from each langId from the pipeline, these are hardcoded in the script (for each language) as done [here](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/tools/build/convert-resx-to-rc.ps1#L50-L77). **If any other languages are added in the future, this script will have to be updated.** In order to determine what are the language codes, you can open the rc file in Resource View, right click the string table and press `Insert Copy` and choose the corresponding language. This autogenerates the required code and can be used to figure out the language codes. The files also add the resource declarations to a resource.h file, starting from 101 by default(this can be changed by an optional argument). Since the output files will be generated in `Generated Files`, any includes in these two files will require an additional `..\` and wherever resource.h is used, it will have to be included as `Generated Files\resource.h`. While adding `resource.base.h` and `ProjName.base.rc` to the vcxproj, these should be modified to not participate in the build to avoid build errors: +Since there is no API to identify the `AFX_TARG_*`, `LANG_*` or `SUBLANG_*` values from each langId from the pipeline, these are hardcoded in the script (for each language) as done in [lines 50-77 of `convert-resx-to-rc.ps1`](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/tools/build/convert-resx-to-rc.ps1#L50-L77). **If any other languages are added in the future, this script will have to be updated.** In order to determine what are the language codes, you can open the rc file in Resource View, right click the string table and press `Insert Copy` and choose the corresponding language. This autogenerates the required code and can be used to figure out the language codes. The files also add the resource declarations to a resource.h file, starting from 101 by default(this can be changed by an optional argument). Since the output files will be generated in `Generated Files`, any includes in these two files will require an additional `..\` and wherever resource.h is used, it will have to be included as `Generated Files\resource.h`. While adding `resource.base.h` and `ProjName.base.rc` to the vcxproj, these should be modified to not participate in the build to avoid build errors: ``` ``` @@ -86,7 +86,7 @@ Since C# projects natively support `resx` files, the only step required here is ``` -**Note:** Building with localized resources may cause a build warning `Referenced assembly 'mscorlib.dll' targets a different processor` which is a VS bug. More details can be found [here](https://github.com/microsoft/PowerToys/issues/7269). +**Note:** Building with localized resources may cause a build warning `Referenced assembly 'mscorlib.dll' targets a different processor` which is a VS bug. More details can be found in [PowerToys issue #7269](https://github.com/microsoft/PowerToys/issues/7269). **Note:** If a project needs to be migrated from XAML resources to resx, the easiest way to convert the resources would be to change to format to `=` separates resources by either manually (by Ctrl+H on a text editor), or by a script, and then running [`resgen`](https://learn.microsoft.com/dotnet/framework/tools/resgen-exe-resource-file-generator#Convert) on `Developer Command Prompt for VS` to convert it to resx format. ``` @@ -153,7 +153,7 @@ For C++ and UWP projects no additional files are generated with localization tha ``` For C# projects, satellite dlls are generated when the project is built. For a project named `ProjName`, files are created in the format `langId\ProjName.resources.dll` where `langId` is in the same format as the lcl files. The satellite dlls need to be included with the MSI, but they must be added only if the solution is built from the build farm, as the localized resx files will not be present on local machines (and that could cause local builds of the installer to fail). -This can be done by adding the directory name of the project [here](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/installer/PowerToysSetup/Product.wxs#L806) and a resource component for the project can be created [here](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/installer/PowerToysSetup/Product.wxs#L845-L847) in this format: +This can be done by adding the directory name of the project to [Product.wxs near line 806](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/installer/PowerToysSetup/Product.wxs#L806) and a resource component for the project can be created in [Product.wxs near lines 845-847](https://github.com/microsoft/PowerToys/blob/f92bd6ffd38014c228544bb8d68d0937ce4c2b6d/installer/PowerToysSetup/Product.wxs#L845-L847) in this format: ``` diff --git a/doc/devdocs/modules/keyboardmanager/keyboardeventhandlers.md b/doc/devdocs/modules/keyboardmanager/keyboardeventhandlers.md index cb3d1561ce..a2ee097771 100644 --- a/doc/devdocs/modules/keyboardmanager/keyboardeventhandlers.md +++ b/doc/devdocs/modules/keyboardmanager/keyboardeventhandlers.md @@ -25,13 +25,13 @@ This file contains documentation for all the methods involved in key/shortcut re - Check if any shortcut remap is currently invoked. This is required to ensure that two remaps don't occur simultaneously at a time, and we send key up events for the shortcuts only if they are actually invoked and not for artificial key up events. In addition to that, while a remap is in the middle of execution, the keyboard state will not match the physical keys, so we do not want a remap Ctrl+A to Ctrl+V to also trigger the remap from Ctrl+V to Alt+V on pressing Ctrl+A on the keyboard. - Get the remap table as per the `activatedApp` argument (i.e. if it is empty, we get the global shortcut remap table and otherwise we get the corresponding app-specific shortcut remap table). - Iterate over the list of remaps in descending order of number of keys in the shortcut. This is required **for shortcut to key remaps** to ensure that if a user has both Ctrl+A and Ctrl+Shift+A remapped to some keys, and the user presses Ctrl+Shift+A, then we prefer the Ctrl+Shift+A remap. This logic would not be required if there were only shortcut to shortcut remaps, as they are invoked only on exact match. -- If any shortcut was found to be invoked (from the first step), then we skip till we find the matching shortcut remap. If not we check if the modifiers of the original shortcut are pressed down. If they are, we check if the current key event is a key down event and it matches the action key of the original shortcut. For shortcut to shortcut and for disabling a shortcut [we have an additional step](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L208-L212) where we check if any other key is pressed apart from the original shortcut. This is required because for these two features we allow the remaps only if those exact keys are pressed. The method used for this is described in detail [here](keyboardmanagercommon.md#IsKeyboardStateClearExceptShortcut). If a win key was pressed, we store whether it was the left or the right one, in order to determine which key to set for remaps from/to the common Win key code which we added. This is so that pressing and releasing Left Win key results in that Win key getting modified and not the Right Win key. +- If any shortcut was found to be invoked (from the first step), then we skip till we find the matching shortcut remap. If not we check if the modifiers of the original shortcut are pressed down. If they are, we check if the current key event is a key down event and it matches the action key of the original shortcut. For shortcut to shortcut and for disabling a shortcut [we have an additional step](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L208-L212) where we check if any other key is pressed apart from the original shortcut. This is required because for these two features we allow the remaps only if those exact keys are pressed. The method used for this is [described in detail](keyboardmanagercommon.md#IsKeyboardStateClearExceptShortcut). If a win key was pressed, we store whether it was the left or the right one, in order to determine which key to set for remaps from/to the common Win key code which we added. This is so that pressing and releasing Left Win key results in that Win key getting modified and not the Right Win key. - If the remap is to a key, we send a dummy key event followed by releasing the original shortcut's modifiers and setting the target key (or doing nothing if it is remapped to disable) and we suppress the event. - If the remap is to a shortcut, if the modifiers in the original shortcut are present in the target, we only set the additional modifiers and the action key of the target. If it isn't, we send a dummy key event followed by releasing the modifiers which are not common, and setting the remaining ones in the target along with the action key. - For both cases, we set the `isShortcutInvoked` flag to true, and set the `KeyboardManagerState.activatedApp` if it is an app-specific shortcut remap. - For the `isShortcutInvoked` is true scenario (i.e. the initial remap keydown section is done) there are several cases depending on the key pressed or released: - [**Case 1:**](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L339-L430) If a modifier in the original shortcut is released, we need to reset back to the physical keys pressed. - - For remap to shortcut, we release the target action key if it is currently pressed, and depending on whether all the modifiers of the original shortcut are present in the target, we release the target modifiers that are not common, and set the remaining original shortcut modifiers except the one that was released. We do not need to send the original action key as that will get generate it's own key event if it is held down. + - For remap to shortcut, we release the target action key if it is currently pressed, and depending on whether all the modifiers of the original shortcut are present in the target, we release the target modifiers that are not common, and set the remaining original shortcut modifiers except the one that was released. We do not need to send the original action key as that will get generate its own key event if it is held down. - For remap to key, we release the target key if it is pressed (and it is not remapped to Disable), and we set the original shortcut modifiers. - For both the cases we send a dummy key event at the end, since we are setting modifiers without any other key after that, and we reset all the remap variables. - [**Case 2:**](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L435-L461) If the original shortcut's action key is pressed again, we send the target shortcut's action key or the target key again (or for disable we just suppress the event). @@ -57,9 +57,9 @@ This file contains documentation for all the methods involved in key/shortcut re ## HandleAppSpecificShortcutRemapEvent [This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L754-L809) is used for handling app-specific shortcut to shortcut and shortcut to key remaps. The general logic is as follows: - Check if the `dwExtraInfo` field is set to `KEYBOARDMANAGER_SHORTCUT_FLAG`. This indicates that the key event was generated by the KBM shortcut remap method using `SendInput`. This ensures that we don't read events generated by the shortcut remap method, but we still read events which are generated by the key remap method. -- Get the name of the process in the foreground. This is done using `GetCurrentApplication` which uses `GetForegroundWindow` to get the window handle and `get_process_path` from the common lib. This approach can fail for UWP apps in full screen, so for that scenario we use the `GetGUIThreadInfo` approach to find the correct window handle, and hence the correct process name. This method is described in more detail [here](keyboardmanagercommon.md#Foreground-app-detection) +- Get the name of the process in the foreground. This is done using `GetCurrentApplication` which uses `GetForegroundWindow` to get the window handle and `get_process_path` from the common lib. This approach can fail for UWP apps in full screen, so for that scenario we use the `GetGUIThreadInfo` approach to find the correct window handle, and hence the correct process name. This method is [described in more detail](keyboardmanagercommon.md#Foreground-app-detection) - By checking `KeyboardManagerState.GetActivatedApp` we check if an app-specific shortcut is currently invoked. If so, we consider this application to be the activated app. This is required because some shortcut remaps could cause the current app to lose focus and hence until the shortcut is completely released we should allow that remap to continue, otherwise the user could end up in a state where some keys do not get released. For example: remap Ctrl+A to Alt+Tab for Edge, when a user presses Ctrl+A the window loses focus as Alt+Tab gets executed. -- If there is no app-specific shortcut currently invoked, we check if the foreground process is present in the list of app-specific remaps, either with or without the file extension and case insensitive. If it is, this is considered to be the activated app. +- If there is no app-specific shortcut currently invoked, we check if the foreground process is present in the list of app-specific remaps, either with or without the file extension and case-insensitive. If it is, this is considered to be the activated app. - Call `HandleShortcutRemapEvent` with the `activatedApp` argument so that app-specific shortcut remapping takes place if it applies for the current key event. ## HandleSingleKeyToggleToModEvent (Obsolete - Code from PoC which is commented out) @@ -81,4 +81,4 @@ The [`MockedInput`](https://github.com/microsoft/PowerToys/blob/main/src/modules - For modifiers the behavior is slightly different as if the key state of the L/R version is modified, it should also modify the common version, and if a common version is released, it should release both the L and R versions. ### Tests for single key remaps and shortcut remaps -Using the MockedInput handler, all the expected (and known) key scenarios that can occur for while pressing a [remapped key](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp) or [remapped shortcut](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp) are tested. The foreground app behavior which is specific to app-specific shortcuts is tested [here](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/AppSpecificShortcutRemappingTests.cpp). +Using the MockedInput handler, all the expected (and known) key scenarios that can occur for while pressing a [remapped key](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp) or [remapped shortcut](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp) are tested. The foreground app behavior which is specific to app-specific shortcuts is tested in [AppSpecificShortcutRemappingTests.cpp](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/AppSpecificShortcutRemappingTests.cpp). diff --git a/doc/devdocs/modules/keyboardmanager/keyboardmanager.md b/doc/devdocs/modules/keyboardmanager/keyboardmanager.md index b58a51b74f..c570a735e8 100644 --- a/doc/devdocs/modules/keyboardmanager/keyboardmanager.md +++ b/doc/devdocs/modules/keyboardmanager/keyboardmanager.md @@ -27,14 +27,14 @@ This file contains the documentation for the KeyboardManager PowerToy module whi The `KeyboardManager` module has [3 main class members](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L54-L61): - A static pointer to the current object of `KeyboardManager`. This is required for using the `KeyboardManager` object in the low level keyboard hook handler as that method must be static. This is described in more detail in [this section](#Low-level-keyboard-hook-handler). - An object of type `Input`, which is used for all the operations that involving getting or setting keyboard states. This is wrapped in an object to allow testing the remapping methods. -- An object of type `KeyboardManagerState`. This object contains all the data related to remappings and is also used in the sense of a View Model as it used to communicate common data that is shared between the KBM UI and the backend. This class is described in more detail [here](keyboardmanagercommon.md#keyboardmanagerstate). +- An object of type `KeyboardManagerState`. This object contains all the data related to remappings and is also used in the sense of a [View Model as it used to communicate common data that is shared between the KBM UI and the backend](keyboardmanagercommon.md#keyboardmanagerstate). ## Enable/Disable -On enabling KBM, the low level keyboard hook is started, and it is unhooked on disable. This is done to allow users to manually restart KBM if some other application which registers a keyboard hook was launched after PowerToys, so that it can be brought back to the highest priority hook (as the last hook to be registered receives the input first as mentioned [here](https://learn.microsoft.com/windows/win32/winmsg/about-hooks#hook-procedures)). +On enabling KBM, the low level keyboard hook is started, and it is unhooked on disable. This is done to allow users to manually restart KBM if some other application which registers a keyboard hook was launched after PowerToys, so that it can be brought back to the highest priority hook (as the [last hook to be registered receives the input first](https://learn.microsoft.com/windows/win32/winmsg/about-hooks#hook-procedures)). In addition to stopping the hook, any active KBM UI windows are also closed on disabling. This is done because the KBM UI uses the same keyboard hook for the Type button where you can type a key/shortcut, so if KBM is disabled the windows would not be completely functional. -The enable/disable code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L301-L322) +The [enable/disable code can be found in dllmain.cpp](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L301-L322) ## Settings format KBM uses two sets of settings files. @@ -101,10 +101,10 @@ KBM uses two sets of settings files. - `originalKeys` stores the key/shortcut which is to be pressed for the remap, and `newKeys` stores the key/shortcut which is to be executed. - Both contain semi-colon separated virtual key codes. For `remapKeys`, `originalKeys` must have only one key code, whereas for `remapShortcuts` it must have at least two key codes. - `inProcess` sub-key was added in `remapKeys` because there was a possibility of adding the registry based remapping approach (used by [SharpKeys](https://github.com/randyrants/sharpkeys)), so that would be under a separate sub-key while `inProcess` would be for keyboard hook based remaps. This was deprioritized as there weren't enough requests for it. - - `remapShortcuts` is split into `global` and `appSpecific`, where `global` remaps would apply to all applications, whereas `appSpecific` would apply on when the `targetApp` is in focus. `targetApp` must be the process name of the app (with or without it's extension), e.g. `msedge` or `msedge.exe` for Microsoft Edge. + - `remapShortcuts` is split into `global` and `appSpecific`, where `global` remaps would apply to all applications, whereas `appSpecific` would apply on when the `targetApp` is in focus. `targetApp` must be the process name of the app (with or without its extension), e.g. `msedge` or `msedge.exe` for Microsoft Edge. ## Loading settings -KBM settings are loaded only on the C++ side only at start up, in the [constructor](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L67-L68). The settings file may get modified from the KBM UI on applying new remappings, but the file is not read again. The files are read from the PowerToys Settings process whenever a change is made to the file (using a FileWatcher) or whenever the KBM page is opened. The settings are updated only when the user presses the OK button from either of the Remap Keys or Remap Shortcuts windows. This is described in more detail [here](keyboardmanagerui.md#ok-and-cancel-button). +KBM settings are loaded only on the C++ side only at start up, in the [constructor](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L67-L68). The settings file may get modified from the KBM UI on applying new remappings, but the file is not read again. The files are read from the PowerToys Settings process whenever a change is made to the file (using a FileWatcher) or whenever the KBM page is opened. The settings are updated only when the user presses the OK button from either of the Remap Keys or Remap Shortcuts windows. This is described in more detail [keyboardmanagerui: OK and Cancel button](keyboardmanagerui.md#ok-and-cancel-button). ## Low level keyboard hook handler Since the [`hook_proc`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L330-L349) cannot be a member function in the class, this is declared `static` and a `static pointer` to the `KeyboardManager` project is used ([`keyboardmanager_object_ptr`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L54-L55)). @@ -117,22 +117,23 @@ As seen in the code for `hook_proc`, similar to other keyboard hooks in PowerToy The [`HandleKeyboardHookEvent`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L384-L458) is the method which calls the corresponding remapping methods in the required order. The following checks are executed in order: - **`KeyboardManagerState.AreRemappingsEnabled`:** This returns false while the KBM remap tables are getting updated. If it is in this state, `HandleKeyboardHookEvent` returns `0`, i.e. the key event is not suppressed and is forwarded normally. - **Check for `KEYBOARDMANAGER_SUPPRESS_FLAG`:** If the key event has the suppress flag, the method returns 1 to suppress the key event. -- **[`KeyboardManagerState.DetectSingleRemapKeyUIBackend`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L399-L408):** This method is used for handling hook operations for the single key Type UI in the Remap keys window. If the Remap keys window is open, then `HandleKeyboardHookEvent` returns `0` and the key event is forwarded normally. If the left column Type button is clicked on the Remap keys window and the window is in focus, then the key event is suppressed and the UI is updated with the latest key from the recent key events. This method is described in more detail [here](keyboardmanagercommon.md#DetectSingleRemapKeyUIBackend-and-DetectShortcutUIBackend). -- **[`KeyboardManagerState.DetectShortcutUIBackend(data, true)`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L410-L419):** This method is used for handling hook operations for the shortcut Type UI in the Remap keys window (when `isRemapKey` arg is `true`). If the Remap keys window is open, then `HandleKeyboardHookEvent` returns `0` and the key event is forwarded normally. If the right column Type button is clicked on the Remap keys window and the window is in focus, then the key event is suppressed and the UI is updated with the shortcut from the recent key events. This method is described in more detail [here](keyboardmanagercommon.md#DetectSingleRemapKeyUIBackend-and-DetectShortcutUIBackend). -- **`HandleSingleKeyRemapEvent`:** This method handles the single key remap logic. If a remapping takes place, the key event is suppressed. This method is described in more detail [here](keyboardeventhandlers.md#HandleSingleKeyRemapEvent). +- **[`KeyboardManagerState.DetectSingleRemapKeyUIBackend`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L399-L408):** This method is used for handling hook operations for the single key Type UI in the Remap keys window. If the Remap keys window is open, then `HandleKeyboardHookEvent` returns `0` and the key event is forwarded normally. If the left column Type button is clicked on the Remap keys window and the window is in focus, then the key event is suppressed and the UI is updated with the latest key from the recent key events. This method is described in more detail in [DetectSingleRemapKeyUIBackend and DetectShortcutUIBackend](keyboardmanagercommon.md#DetectSingleRemapKeyUIBackend-and-DetectShortcutUIBackend). +- **[`KeyboardManagerState.DetectShortcutUIBackend(data, true)`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L410-L419):** This method is used for handling hook operations for the shortcut Type UI in the Remap keys window (when `isRemapKey` arg is `true`). If the Remap keys window is open, then `HandleKeyboardHookEvent` returns `0` and the key event is forwarded normally. If the right column Type button is clicked on the Remap keys window and the window is in focus, then the key event is suppressed and the UI is updated with the shortcut from the recent key events. This method is also described in more detail in [DetectSingleRemapKeyUIBackend and DetectShortcutUIBackend](keyboardmanagercommon.md#DetectSingleRemapKeyUIBackend-and-DetectShortcutUIBackend). +- **`HandleSingleKeyRemapEvent`:** This method handles the single key remap logic. If a remapping takes place, the key event is suppressed. This method is described in more detail in [HandleSingleKeyRemapEvent](keyboardeventhandlers.md#HandleSingleKeyRemapEvent). - **[`KeyboardManagerState.DetectShortcutUIBackend(data, false)`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L430-L439):** This method is used for handling hook operations for the shortcut Type UI in the Remap shortcuts window (when `isRemapKey` arg is `false`). If the Remap shortcuts window is open, then `HandleKeyboardHookEvent` returns `0` and the key event is forwarded normally. If the Type button is clicked on the Remap shortcuts window and the window is in focus, then the key event is suppressed and the UI is updated with the shortcut from the recent key events. **Since this is executed after the single key remap method, all single key remappings are applied when the user is on the Remap shortcuts window.** -- **`HandleAppSpecificShortcutRemapEvent`:** This method handles the app-specific shortcut remap logic. If a remapping takes place, the key event is suppressed. This method is described in more detail [here](keyboardeventhandlers.md#HandleAppSpecificShortcutRemapEvent). **Since this is executed after the single key remap method, single key remappings have precedence over shortcut remaps and are correspondingly reflected in shortcut remaps.** -- **`HandleOSLevelShortcutRemapEvent`:** This method handles the global shortcut remap logic. If a remapping takes place, the key event is suppressed. This method is described in more detail [here](keyboardeventhandlers.md#HandleOSLevelShortcutRemapEvent). The app-specific remap method is executed before this because if a shortcut is remapped to different keys/shortcuts for a particular app and globally, the app-specific variant should be preferred if that app is in focus. **Since this is executed after the single key remap method, single key remappings have precedence over shortcut remaps and are correspondingly reflected in shortcut remaps.** +- **`HandleAppSpecificShortcutRemapEvent`:** This method handles the app-specific shortcut remap logic. If a remapping takes place, the key event is suppressed. This method is described in more detail in [HandleAppSpecificShortcutRemapEvent](keyboardeventhandlers.md#HandleAppSpecificShortcutRemapEvent). **Since this is executed after the single key remap method, single key remappings have precedence over shortcut remaps and are correspondingly reflected in shortcut remaps.** +- **`HandleOSLevelShortcutRemapEvent`:** This method handles the global shortcut remap logic. If a remapping takes place, the key event is suppressed. This method is described in more detail under [HandleOSLevelShortcutRemapEvent](keyboardeventhandlers.md#HandleOSLevelShortcutRemapEvent). The app-specific remap method is executed before this because if a shortcut is remapped to different keys/shortcuts for a particular app and globally, the app-specific variant should be preferred if that app is in focus. **Since this is executed after the single key remap method, single key remappings have precedence over shortcut remaps and are correspondingly reflected in shortcut remaps.** **Note:** Single key remaps need to be executed before shortcut remaps, because otherwise there can be several logical issues. For example if a user has Ctrl remapped to X and Ctrl+A remapped to Y, we can't detect Ctrl+A because the moment Ctrl is pressed it would be remapped to X before the system ever sees Ctrl+A. This is why the design decision was made to separate Remap keys and Remap shortcuts, and all key remaps are reflected in the shortcut remaps. ## Custom Action to launch KBM UI -KBM uses the [`call_custom_action`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L249-L280) method from the `PowertoyModuleIface` in order to launch the KBM UI when the user clicks the Remap a key or Remap a shortcut button from the KBM settings page. On clicking the button, we check if there is already any active KBM UI window, and if there is it is brought to the foreground. If not, the corresponding KBM UI window is launched on a separate detached thread. The UI is described in more detail [here](keyboardmanagerui.md). +KBM uses the [`call_custom_action`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L249-L280) method from the `PowertoyModuleIface` in order to launch the KBM UI when the user clicks the Remap a key or Remap a shortcut button from the KBM settings page. On clicking the button, we check if there is already any active KBM UI window, and if there is it is brought to the foreground. If not, the corresponding KBM UI window is launched on a separate detached thread. The UI is described in more detail in [Keyboard Manager UI](keyboardmanagerui.md). ## SendInput Special Scenarios ### Extended keys -Certain keys such as the arrow keys, right Ctrl/Alt, and Del/Home/Ins, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found [here](https://learn.microsoft.com/windows/win32/inputdev/about-keyboard-input#extended-key-flag). +Certain keys such as the arrow keys, right Ctrl/Alt, and Del/Home/Ins, etc need to be sent with the `KEYEVENTF_EXTENDEDKEY` flag because otherwise the NumPad versions get sent, which can cause weird behavior when NumLock is on. The code can be found where [`SetKeyEvent` checks `IsExtendedKey(keyCode)`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L190-L194) and the list of extended keys in code can be found in [`IsExtendedKey`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L73-L98). Docs about extended keys can be found in [Keyboard Input Overview: Extended-Key Flag +](https://learn.microsoft.com/windows/win32/inputdev/about-keyboard-input#extended-key-flag). The weird behavior that is caused by this can be found at these issues: - https://github.com/microsoft/PowerToys/issues/3478 @@ -140,7 +141,7 @@ The weird behavior that is caused by this can be found at these issues: - https://github.com/microsoft/PowerToys/issues/3981 ### Scan code -Certain applications (such as Windows Terminal) may filter out key events which are set to scan code 0. Even though the `KEYEVENTF_SCANCODE` flag is not set, the `wScan` field is still sent, which defaults to 0. To avoid this issue we use the `MapVirtualKey` API to find the scan code from the virtual key code. Code can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L196-L198). +Certain applications (such as Windows Terminal) may filter out key events which are set to scan code 0. Even though the `KEYEVENTF_SCANCODE` flag is not set, the `wScan` field is still sent, which defaults to 0. To avoid this issue we use the `MapVirtualKey` API to find the scan code from the virtual key code. Code can be found in [`SetKeyEvent`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L196-L198). ## Special Scenarios Since we are using low level keyboard hooks and not actual OS level input handling certain scenarios with input require workarounds as do they not interact well with the OS input logic directly. These are covered in the sub-sections below. @@ -156,7 +157,7 @@ The dummy key event is currently used in the following places (the linked code s - https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L509-L510 ### Suppressing Num Lock in a keyboard hook -The Num Lock key state is updated by the OS before it is intercepted by low level hooks. This causes the issue that even if you suppress a Num Lock key event, Num Lock will still get toggled. In order to work around this, in the [`hook_proc`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L340-L344) whenever we suppress a Num Lock key down event, we send an additional Num Lock key up followed by key down so that the Num Lock state is reverted to it's previous value before the suppressed event. These are sent with a `KEYBOARDMANAGER_SUPPRESS_FLAG` in the `dwExtraInfo` field, so that we suppress them at the start of the hook (see code [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L811-L825)). Since these events will update the Num Lock state before the low level hooks, by suppressing them we ensure that these are not sent to any other hooks/applications and hence are only processed by the OS. +The Num Lock key state is updated by the OS before it is intercepted by low level hooks. This causes the issue that even if you suppress a Num Lock key event, Num Lock will still get toggled. In order to work around this, in the [`hook_proc`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L340-L344) whenever we suppress a Num Lock key down event, we send an additional Num Lock key up followed by key down so that the Num Lock state is reverted to its previous value before the suppressed event. These are sent with a `KEYBOARDMANAGER_SUPPRESS_FLAG` in the `dwExtraInfo` field, so that we suppress them at the start of the hook (see code in [`SetNumLockToPreviousState`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L811-L825)). Since these events will update the Num Lock state before the low level hooks, by suppressing them we ensure that these are not sent to any other hooks/applications and hence are only processed by the OS. This assumes that KBM is the last hook to be registered (since another hook-based app like AutoHotkey could remap NumLock to some other key which could mess up this logic). @@ -167,7 +168,7 @@ While using Japanese IME on Windows, shortcuts like Shift/Alt/Ctrl + These shortcuts are detected before low level hooks, and hence cause issues while remapping Caps Lock to Shift/Alt/Ctrl or vice-versa, as there could be an intermediate state where the system detects both the keys as being pressed. This results in a state where the modifier key does not get released since the OS suppresses the key up messages before they reach the low level hooks. -In order to work around this when a key down for the modifier is being processed, we send a key up for the modifier key with the `KEYBOARDMANAGER_SUPPRESS_FLAG` in the `dwExtraInfo` field, so that we suppress them at the start of the hook, and this key event would only be processed by the OS, without getting forwarded to other hooks/apps. The approach is described in more detail at [this comment](https://github.com/microsoft/PowerToys/issues/3397#issuecomment-640136416), as discussed with the AutoHotkey team. The code for the workaround can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L827-L846). Tests for these scenarios have also been added at: +In order to work around this when a key down for the modifier is being processed, we send a key up for the modifier key with the `KEYBOARDMANAGER_SUPPRESS_FLAG` in the `dwExtraInfo` field, so that we suppress them at the start of the hook, and this key event would only be processed by the OS, without getting forwarded to other hooks/apps. The approach is described in more detail at [this comment](https://github.com/microsoft/PowerToys/issues/3397#issuecomment-640136416), as discussed with the AutoHotkey team. The code for the workaround can be found in [`ResetIfModifierKeyForLowerLevelKeyHandlers`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/KeyboardEventHandlers.cpp#L827-L846). Tests for these scenarios have also been added at: - [Tests for workaround on single key remaps](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/SingleKeyRemappingTests.cpp#L110-L219) - [Tests for workaround on shortcut remaps](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/test/OSLevelShortcutRemappingTests.cpp#L1935-L2144) @@ -189,8 +190,8 @@ Using a driver approach has the benefit of not depending on precedence orders as ## Telemetry Keyboard Manager emits the following telemetry events (implemented in [trace.h](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/trace.h) and [trace.cpp](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/trace.cpp)): -- **`KeyboardManager_EnableKeyboardManager`:** Logs a `boolean` value storing the KBM toggle state. It is logged whenever KBM is enabled or disabled (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L305-L316)). -- **`KeyboardManager_KeyRemapCount`:** Logs the number of key to key and key to shortcut remaps (i.e. all the remaps on the Remap a key window). This gets logged on saving new settings in the Remap a key window (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L159-L163)). -- **`KeyboardManager_OSLevelShortcutRemapCount`:** Logs the number of global shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L220)). -- **`KeyboardManager_AppSpecificShortcutRemapCount`:** Logs the number of app-specific shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L221)). -- **`KeyboardManager_Error`:** Logs the occurrence of an error in KBM with the name of the method, error code and the corresponding error message. This is currently used only for logging `SetWindowsHookEx` failures (emitted [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L364-L369)). +- **`KeyboardManager_EnableKeyboardManager`:** Logs a `boolean` value storing the KBM toggle state. It is logged whenever KBM is enabled or disabled (emitted in [`enable`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L305-L306) and [`disable`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L315-L316)). +- **`KeyboardManager_KeyRemapCount`:** Logs the number of key to key and key to shortcut remaps (i.e. all the remaps on the Remap a key window). This gets logged on saving new settings in the Remap a key window (emitted at [the end of `ApplySingleKeyRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L159-L163)). +- **`KeyboardManager_OSLevelShortcutRemapCount`:** Logs the number of global shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted at [the end of `ApplyShortcutRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L220)). +- **`KeyboardManager_AppSpecificShortcutRemapCount`:** Logs the number of app-specific shortcut to shortcut and shortcut to key remaps. This gets logged on saving new settings in the Remap a shortcut window (emitted [after calling `OSLevelShortcutRemapCount` in `ApplyShortcutRemappings`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L221)). +- **`KeyboardManager_Error`:** Logs the occurrence of an error in KBM with the name of the method, error code and the corresponding error message. This is currently used only for logging `SetWindowsHookEx` failures (emitted [at the end of `start_lowlevel_keyboard_hook`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/dll/dllmain.cpp#L364-L369)). diff --git a/doc/devdocs/modules/keyboardmanager/keyboardmanagercommon.md b/doc/devdocs/modules/keyboardmanager/keyboardmanagercommon.md index e0258db13d..3132d3f29d 100644 --- a/doc/devdocs/modules/keyboardmanager/keyboardmanagercommon.md +++ b/doc/devdocs/modules/keyboardmanager/keyboardmanagercommon.md @@ -37,7 +37,7 @@ The [`SaveConfigToFile`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a To prevent the UI thread and low level hook thread from concurrently accessing the remap tables we use an [`atomic bool` variable](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyboardManagerState.h#L91-L92), which is set to `true` while the tables are getting updated. When this is `true` the hook will skip all remappings. Use of mutexes in the hook were removed to prevent reentrant mutex bugs. ## KeyDelay -[This class](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/KeyDelay.cpp) implements a queue based approach for processing key events and based on the time difference between key down and key up events [executes separate methods for `ShortPress`, `LongPress` or `LongPressReleased`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyDelay.h#L69-L72). The class is used for the hold Enter/Esc functionality required for making the Type window accessible and prevent keyboard traps (see [this](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/SingleKeyRemapControl.cpp#L273-L292) for an example of it's usage). The `KeyEvents` are added to the queue from the hook thread of KBM, and a separate [`DelayThread`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyDelay.cpp#L142-L166) is used to process the key events by checking the `time` member in the key event. The thresholds for short vs long press and hold wait timeouts are `static` constants, but if the module is extended for other purposes these could be made into arguments. +The [KeyDelay class](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/KeyDelay.cpp) implements a queue based approach for processing key events and based on the time difference between key down and key up events [executes separate methods for `ShortPress`, `LongPress` or `LongPressReleased`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyDelay.h#L69-L72). The class is used for the hold Enter/Esc functionality required for making the Type window accessible and prevent keyboard traps (see [this call to `keyboardManagerState.RegisterKeyDelay`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/SingleKeyRemapControl.cpp#L273-L292) for an example of its usage). The `KeyEvents` are added to the queue from the hook thread of KBM, and a separate [`DelayThread`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyDelay.cpp#L142-L166) is used to process the key events by checking the `time` member in the key event. The thresholds for short vs long press and hold wait timeouts are `static` constants, but if the module is extended for other purposes these could be made into arguments. **Note:** [Deletion of the `KeyDelay`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyDelay.cpp#L4-L12) object should never be called from the `DelayThread` i.e. from within one of the 3 handlers, as it can re-enter the mutex and would lead to a deadlock. This can be avoided by either deleting it on a separate thread or as done in the KBM UI, on the dispatcher thread. See [this PR](https://github.com/microsoft/PowerToys/pull/6959#issue-496583547) for more details on this issue. @@ -45,16 +45,16 @@ To prevent the UI thread and low level hook thread from concurrently accessing t The [`Shortcut` class](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/Shortcut.h) is a data structure for storing key combinations which are valid shortcuts and it contains several methods which are used for shortcut specific operations. [`RemapShortcut`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/RemapShortcut.h) consists of a shortcut/key union (`std::variant`), along with other boolean flags which are required on the hook side for storing any relevant keyboard states mid-execution. ### IsKeyboardStateClearExceptShortcut -[This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Shortcut.cpp#L665-L813) is used by the `HandleShortcutRemapEvent` to check if any other keys on the keyboard have been pressed apart from the keys in the shortcut. This is required because shortcut to shortcut remaps should not be applied if the shortcut is pressed with other keys. The method iterates over all the possible key codes, except any keys that are considered reserved, unassigned, OEM-specific or undefined, as well as mouse buttons (see list [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Shortcut.cpp#L628-L663)). +[This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Shortcut.cpp#L665-L813) is used by the `HandleShortcutRemapEvent` to check if any other keys on the keyboard have been pressed apart from the keys in the shortcut. This is required because shortcut to shortcut remaps should not be applied if the shortcut is pressed with other keys. The method iterates over all the possible key codes, except any keys that are considered reserved, unassigned, OEM-specific or undefined, as well as mouse buttons (see [list in `IgnoreKeyCode`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Shortcut.cpp#L628-L663)). ### CheckModifiersKeyboardState [This method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Shortcut.cpp#L517-L614) uses `GetVirtualKeyState` (internally calls `GetAsyncKeyState` in production code), to check if all the modifiers of the current shortcut are being pressed. Since Win doesn't have a non-L/R key code we check this by checking both LWIN and RWIN. ### Tests -Tests for some methods in the `Shortcut` class can be found [here](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/ShortcutTests.cpp). +Tests for some methods in the `Shortcut` class can be found in [`OSLevelShortcutRemappingTests.cpp`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/KeyboardManagerEngineTest/OSLevelShortcutRemappingTests.cpp) and [`AppSpecificShortcutRemappingTests.cpp`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/KeyboardManagerEngineTest/AppSpecificShortcutRemappingTests.cpp). ## Helpers -[This namespace](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/Helpers.cpp) has any methods which are used across either UI or the backend which aren't specific to either. Some of these methods have tests [here](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/test/SetKeyEventTests.cpp). +[This namespace](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/common/Helpers.cpp) has any methods which are used across either UI or the backend which aren't specific to either. Some of these methods have tests in [`SetKeyEventTests.cpp`](https://github.com/microsoft/PowerToys/blob/main/src/modules/keyboardmanager/KeyboardManagerEngineTest/SetKeyEventTests.cpp). ### Foreground App Detection [`GetCurrentApplication`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L226-L268) is used for detecting the foreground process for App-specific shortcuts. The logic is very similar to that used for FZ's app exception feature, involving `GetForegroundWindow` and `get_process_path`. The one additional case which has been added is for full-screen UWP apps, where the above method fails and returns `ApplicationFrameHost.exe`. The [`GetFullscreenUWPWindowHandle`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/Helpers.cpp#L210-L224) uses `GetGUIThreadInfo` API to find the window linked to the GUI thread. This logic is based on [this stackoverflow answer](https://stackoverflow.com/questions/39702704/connecting-uwp-apps-hosted-by-applicationframehost-to-their-real-processes/55353165#55353165). diff --git a/doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md b/doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md index a94c9f0b36..a1e67c2920 100644 --- a/doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md +++ b/doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md @@ -23,7 +23,7 @@ The KBM UI was originally implemented as a XAML Island, but in order to easily s Mica is then achieved by calling [`BackdropMaterial::SetApplyToRootOrPageBackground()`](https://github.com/microsoft/PowerToys/blob/b3f27057d43445abc59aa04405f7c24bb895a61c/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp#L388-L400) in both of the editor windows, or falls back to the `ApplicationPageBackgroundThemeBrush` background if Mica isn't available. -The UI was also updated to use WinUI 2.8 to match the look and feel of the Fluent design language of Windows 11 and the rest of PowerToys. There has been talk about [migrating the implementation to XAML files instead of code-behind](https://github.com/microsoft/PowerToys/issues/2027) and [utilizing WinUI 3 going forward](https://github.com/microsoft/PowerToys/issues/15870). More about the update can be read in [here](https://github.com/microsoft/PowerToys/pull/28473). +The UI was also updated to use WinUI 2.8 to match the look and feel of the Fluent design language of Windows 11 and the rest of PowerToys. There has been talk about [migrating the implementation to XAML files instead of code-behind](https://github.com/microsoft/PowerToys/issues/2027) and [utilizing WinUI 3 going forward](https://github.com/microsoft/PowerToys/issues/15870). More about the update can be read in [[Keyboard Manager] Modernize the editor UI - PR#28473](https://github.com/microsoft/PowerToys/pull/28473). [**Link to the original documentation**](https://github.com/microsoft/PowerToys/blob/b3f27057d43445abc59aa04405f7c24bb895a61c/doc/devdocs/modules/keyboardmanager/keyboardmanagerui.md#c-xaml-islands) @@ -43,7 +43,7 @@ When the `EditKeyboardWindow`/`EditShortcutsWindow` is created, [we iterate thro ### OK and Cancel button [On pressing the OK button](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditKeyboardWindow.cpp#L66-L89) in `EditKeyboardWindow`, first the [`CheckIfRemappingsAreValid` method](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L10-L44) is executed which performs basic validity checks on the current remappings in the remap buffer (`static SingleKeyRemapControl::singleKeyRemapBuffer`), such as if there are no NULL columns and none of the source keys are repeated. All other validity checks are assumed to happen while the user adds the remapping. If this is found to be invalid a ContentDialog is displayed which shows that some remappings are invalid and if the user proceeds only the valid ones will be applied. If it is valid [`GetOrphanedKeys`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L46-L75) is executed which checks if any keys are orphaned (i.e. the key has been remapped and no other key has been remapped to it, so there is no way to send that key code), and a dialog is shown for notifying the user with a list of orphaned keys. After this the settings are [applied by adding it to the `KeyboardManagerState.singleKeyReMap` member](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L102-L164) and they are saved to the JSON file. `EditShortcutsWindow` differs slightly from this, as there is no orphaned keys check, and [on pressing OK](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/EditShortcutsWindow.cpp#L32-L47) both the global and app-specific shortcuts are validated and [updated](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/LoadingAndSavingRemappingHelper.cpp#L166-L223). -The code used for updating the remapping tables in `KeyboardManagerState` can be found [here](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyboardManagerState.cpp#L104-L183). For shortcut remaps, the `sortedKeys` vectors are updated and re-sorted whenever an element is added to them (like [this](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyboardManagerState.cpp#L135-L136)). +The code used for updating the remapping tables in `KeyboardManagerState` can be found in [KeyboardManagerState.cpp lines 104-183](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyboardManagerState.cpp#L104-L183). For shortcut remaps, the `sortedKeys` vectors are updated and re-sorted whenever an element is added to them (like [this code in `KeyboardManagerState::AddOSLevelShortcut`](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/common/KeyboardManagerState.cpp#L135-L136)). On pressing OK (after confirmation dialogs) or Cancel, the window is closed and UI states are reset. @@ -106,4 +106,9 @@ Unlike the Single Key handler, there is a different set of errors that can occur **Note:** After updating the buffer we have [code to handle a special case](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp#L269-L279), which was required to prevent scenarios where a drop down can get deleted but the corresponding `KeyDropDownControl` object isn't deleted. The code checks if the drop down is still linked to the parent and accordingly deletes the `KeyDropDownControl` object from the vector. -**IgnoreKeyToShortcutWarning special case:** [An additional](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp#L177-L181) check was added to ignore the Map to Same key error when an existing remapping is loaded. This was because a remapping like Ctrl->Ctrl+A has an intermediate step of Ctrl->Ctrl, which could lead to an error of invalid input, even though Ctrl+A is valid. The only way to actually add this is from the Type button or by adding them in a different order (like typing Shift+A and then changing Shift to Ctrl). Since the intermediate check could fail, this was causing the app to crash since the Xaml Island wouldn't be completely loaded at that point and the Flyout can't be displayed. [This](https://github.com/microsoft/PowerToys/issues/6695) is the linked issue which describes the repro scenario. +**IgnoreKeyToShortcutWarning special case:** +[An additional](https://github.com/microsoft/PowerToys/blob/b80578b1b9a4b24c9945bddac33c771204280107/src/modules/keyboardmanager/ui/KeyDropDownControl.cpp#L177-L181) check was added to ignore the Map to Same key error when an existing remapping is loaded. +This was because a remapping like Ctrl->Ctrl+A has an intermediate step of Ctrl->Ctrl, which could lead to an error of invalid input, even though Ctrl+A is valid. +The only way to actually add this is from the Type button or by adding them in a different order (like typing Shift+A and then changing Shift to Ctrl). +Since the intermediate check could fail, this was causing the app to crash since the Xaml Island wouldn't be completely loaded at that point and the Flyout can't be displayed. +[Issue #6695](https://github.com/microsoft/PowerToys/issues/6695) is the linked issue which describes the repro scenario. diff --git a/doc/devdocs/modules/launcher/architecture.md b/doc/devdocs/modules/launcher/architecture.md index f0287f56dc..1d96edb20f 100644 --- a/doc/devdocs/modules/launcher/architecture.md +++ b/doc/devdocs/modules/launcher/architecture.md @@ -16,7 +16,7 @@ PowerToys Run UI is written in the WPF framework. The UI code is present in the 3. **[`ResultList.xaml`](/src/modules/launcher/PowerLauncher/LauncherControl.xaml)**: This control implements the UI component for displaying results (marked in green in Fig 1). It consists of a `ListView` WPF control with a custom `ItemTemplate` to display application logo, name, tooltip text, and context menu. ## Data flow -The backend code is written using the `Model-View-ViewModel (MVVM)` structural design pattern. Plugins act as `Model` in this project. A detailed overview of the project's structure is given [here](/doc/devdocs/modules/launcher/project_structure.md). +The backend code is written using the `Model-View-ViewModel (MVVM)` structural design pattern. Plugins act as `Model` in this project. A detailed overview of the project's structure is given in [Project Structure](/doc/devdocs/modules/launcher/project_structure.md). #### Flow of data between UI(view) and ViewModels Data flow between View and ViewModel follows typical `MVVM` scheme. Properties in viewModels are bound to WPF controls and when these properties are updated, `INotifyPropertyChanged` handler is invoked, which in turn updates UI. The diagram below provides a rough sketch of the components involved. diff --git a/doc/devdocs/modules/launcher/plugins/history.md b/doc/devdocs/modules/launcher/plugins/history.md index bf62a34b5f..0855b39157 100644 --- a/doc/devdocs/modules/launcher/plugins/history.md +++ b/doc/devdocs/modules/launcher/plugins/history.md @@ -96,7 +96,7 @@ The plugin uses only these interfaces (all inside the `Main.cs`): #### Build Dependency Access to PluginManager was needed to make this plugin work. Because of this a reference to PowerToys.PowerLauncher was needed. -Since History Plugin needs a reference to PowerToys.PowerLauncher, it can not be set as a dependency reference in PowerToys.PowerLauncher project (else a circular reference would exist). +Since History Plugin needs a reference to PowerToys.PowerLauncher, it cannot be set as a dependency reference in PowerToys.PowerLauncher project (else a circular reference would exist). This means that if you build PowerToys.PowerLauncher only it will not build History Plugin. You will need to manually build History Plugin at least once and again manually if you change it. ### Caching diff --git a/doc/devdocs/modules/launcher/plugins/overview.md b/doc/devdocs/modules/launcher/plugins/overview.md index 2dec6931e2..f715447a0e 100644 --- a/doc/devdocs/modules/launcher/plugins/overview.md +++ b/doc/devdocs/modules/launcher/plugins/overview.md @@ -32,7 +32,7 @@ Each plugin implements the `IPlugin` interface which comprises of the `Init()` a ### Score - The user query is executed against each of the plugins and the result list view is updated with results from each of the plugins. - The ordering of the results is based on the `Score` of each Result. -- Each plugin assigns a score to a result based on it's relevance. The results with higher scores are displayed higher in the list view and vice versa. +- Each plugin assigns a score to a result based on its relevance. The results with higher scores are displayed higher in the list view and vice versa. ## Plugin settings Plugin settings that are editable from the settings are stored in `PowerToys Run\settings.json`. In the very first run, those settings are populated from plugin' `plugin.json` file. Unlike Wox we do not support multiple action keywords. Instead, we have `ActionKeyword` and `IsGlobal` options. diff --git a/doc/devdocs/modules/launcher/plugins/program.md b/doc/devdocs/modules/launcher/plugins/program.md index 1c3d86ba07..9ef8bd82c7 100644 --- a/doc/devdocs/modules/launcher/plugins/program.md +++ b/doc/devdocs/modules/launcher/plugins/program.md @@ -23,7 +23,7 @@ There are broadly two different categories of applications: 5. Common start menu (Applications which are common to all users) 8. Locations pointed to by the PATH environment variable. - To prevent applications and shortcuts present in multiple locations from showing up as duplicate results, we consider apps with the same name, executable name and full path to be the same. -- The subtitle of the application result is set based on it's application type. It could be one of the following: +- The subtitle of the application result is set based on its application type. It could be one of the following: 1. Lnk Shortcuts 2. Appref files 3. Internet shortcut - steam and epic games diff --git a/doc/devdocs/modules/launcher/plugins/windowwalker.md b/doc/devdocs/modules/launcher/plugins/windowwalker.md index 6a26f54e6f..c451d8103a 100644 --- a/doc/devdocs/modules/launcher/plugins/windowwalker.md +++ b/doc/devdocs/modules/launcher/plugins/windowwalker.md @@ -36,7 +36,7 @@ The user can switch to the found windows, close them or kill their process. | `SubtitleShowPid` | `false` | Show process id in subtitle | | `SubtitleShowDesktopName` | `true` | Show desktop name in subtitle (If two or more desktops exist) | | `ConfirmKillProcess` | `true` | Request confirmation when killing a process | - | `KillProcessTree` | `false` | Kill process and it's child processes | + | `KillProcessTree` | `false` | Kill process and its child processes | | `OpenAfterKillAndClose` | `false` | Stay open after closing windows and killing processes (Not working with kill process confirmation) | | `HideKillProcessOnElevatedProcesses` | `false` | Hide "kill process" button if additional permissions required | | `HideExplorerSettingInfo` | `false` | Hide Explorer process information | diff --git a/doc/devdocs/modules/launcher/project_structure.md b/doc/devdocs/modules/launcher/project_structure.md index 0a8ccbfe3c..b8edfb71d5 100644 --- a/doc/devdocs/modules/launcher/project_structure.md +++ b/doc/devdocs/modules/launcher/project_structure.md @@ -10,7 +10,7 @@ Fig 1. Project along with their dependencies in `PowerToys Run` ecosystem. This is the startup project for the `PowerToys Run.` It is a WPF desktop application and follows the `Model-View-ViewModel (MVVM)` design pattern. Plugins play the role of `Model` and provide data to `ViewModel.` #### [`PowerLauncher.Telemetry`](/src/modules/launcher/PowerLauncher.Telemetry) -[`PowerLauncher.Telemetry`](/src/modules/launcher/PowerLauncher.Telemetry) is a .net core project that contains telemetry events generated by `PowerLauncher.` These events have been discussed in detail [here](/doc/devdocs/modules/launcher/telemetry.md). +[`PowerLauncher.Telemetry`](/src/modules/launcher/PowerLauncher.Telemetry) is a .net core project that contains telemetry events generated by `PowerLauncher.` These events have been discussed in detail in [Launcher Telemetry](/doc/devdocs/modules/launcher/telemetry.md). #### [`Wox.Core`](/src/modules/launcher/Wox.Core) [`Wox.Core`](/src/modules/launcher/Wox.Core) is a .net core project that contains helper classes required by the `PowerLauncher` project. Two major functionalities encapsulated in this project are [`PluginManager`](/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs) and [`Query Builder.`](/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs) [`PluginManager`](/src/modules/launcher/Wox.Core/Plugin/PluginManager.cs) provides an interface for managing C# plugins. [`Query Builder.`](/src/modules/launcher/Wox.Core/Plugin/QueryBuilder.cs) decimate user-typed query string and creates a [`Query`](/src/modules/launcher/Wox.Plugin/Query.cs) object. [`Query`](/src/modules/launcher/Wox.Plugin/Query.cs) object contains the action keyword and cleaned query, which is then sent to all plugins. @@ -19,6 +19,6 @@ This is the startup project for the `PowerToys Run.` It is a WPF desktop applica [`Wox.Infrastructure`](/src/modules/launcher/Wox.Infrastructure) is a .net core project that contains helper classes required for image manipulation and storage by the `PowerLauncher` project and the plugins. [`ImageLoader.cs`](/src/modules/launcher/Wox.Infrastructure/Image/ImageLoader.cs) class is used to load icons for `Win32` program. It also provides caching functionality to speed up image loading for frequently queried programs. #### [`Wox.Plugin`](/src/modules/launcher/Wox.Plugin) -[`Wox.Plugin`](/src/modules/launcher/Wox.Plugin) contains interfaces that facilitate communication between `PowerLauncher` and plugins. These interfaces have been discussed in detail [here](/doc/devdocs/modules/launcher/architecture.md#flow-of-data-between-viewmodels-and-pluginsmodel). It also contains a helper class for logging. [`Log.cs`](/src/modules/launcher/Wox.Plugin/Logger/Log.cs) provides an abstraction for logging error, information, and output to text files. These files are stored at `%userprofile%/appdata/local/microsoft/powertoys/powertoys run/Logs.` +[`Wox.Plugin`](/src/modules/launcher/Wox.Plugin) contains interfaces that facilitate communication between `PowerLauncher` and plugins. These interfaces have been discussed in detail in [Flow of data between ViewModels and Plugins(Model)](/doc/devdocs/modules/launcher/architecture.md#flow-of-data-between-viewmodels-and-pluginsmodel). It also contains a helper class for logging. [`Log.cs`](/src/modules/launcher/Wox.Plugin/Logger/Log.cs) provides an abstraction for logging error, information, and output to text files. These files are stored at `%userprofile%/appdata/local/microsoft/powertoys/powertoys run/Logs.` diff --git a/doc/devdocs/runner.md b/doc/devdocs/runner.md index dab6fc8eb1..f4e5ebb1e2 100644 --- a/doc/devdocs/runner.md +++ b/doc/devdocs/runner.md @@ -5,7 +5,7 @@ Contains the executable starting point, initialization code and the list of know Contains code for initializing and managing the PowerToy modules. `PowertoyModule` is a RAII-style holder for the `PowertoyModuleIface` pointer, which we got by [invoking module DLL's `powertoy_create` function](https://github.com/microsoft/PowerToys/blob/1760af50c8803588cb575167baae0439af38a9c1/src/runner/powertoy_module.cpp#L13-L24). #### [`powertoys_events.cpp`](/src/runner/powertoys_events.cpp) -Contains code that handles the various events listeners, and forwards those events to the PowerToys modules. You can learn more about the current event architecture [here](/doc/devdocs/shared-hooks.md). +Contains code that handles the various events listeners, and forwards those events to the PowerToys modules. You can learn more about the current event architecture in [shared hooks](/doc/devdocs/shared-hooks.md). #### [`lowlevel_keyboard_event.cpp`](/src/runner/lowlevel_keyboard_event.cpp) Contains code for registering the low level keyboard event hook that listens for keyboard events. Please note that `signal_event` is called from the main thread for this event. diff --git a/doc/devdocs/settingsv2/communication-with-modules.md b/doc/devdocs/settingsv2/communication-with-modules.md index a19190fbe7..d4b2a3c896 100644 --- a/doc/devdocs/settingsv2/communication-with-modules.md +++ b/doc/devdocs/settingsv2/communication-with-modules.md @@ -6,7 +6,7 @@ ## PT Run - Any changes to the UI are saved by the settings process in the `settings.json` file located within the `/Local/Microsoft/PowerToys/Launcher/` folder. -- PT Run watches for any changes within this file and updates it's general settings or propagates the information to the plugins, depending on the type of information. +- PT Run watches for any changes within this file and updates its general settings or propagates the information to the plugins, depending on the type of information. Eg: The maximum number of results drop down updates the maximum number of rows in the results list which updates the general settings of PT Run whereas the drive detection checkbox details are dispatched to the indexer plugin. ## Keyboard Manager diff --git a/doc/devdocs/settingsv2/project-overview.md b/doc/devdocs/settingsv2/project-overview.md index d196aafe83..50b15f4e74 100644 --- a/doc/devdocs/settingsv2/project-overview.md +++ b/doc/devdocs/settingsv2/project-overview.md @@ -1,5 +1,5 @@ # Overview -`Settings` is Windows App Sdk WinUI3 .Net Unpackaged desktop application. More details about Windows App Sdk can be found [here](https://github.com/microsoft/WindowsAppSDK#windows-app-sdk---calling-all-windows-developers). More details about WinUI can be found [here](https://microsoft.github.io/microsoft-ui-xaml/about.html#what-is-it). +`Settings` is Windows App Sdk WinUI3 .Net Unpackaged desktop application. More details about Windows App Sdk can be found in [Windows App SDK - Calling all Windows developers!](https://github.com/microsoft/WindowsAppSDK#windows-app-sdk---calling-all-windows-developers). More details about WinUI can be found in [Build apps with WinUI](https://developer.microsoft.com/en-us/windows/develop/). ## Settings V2 Project structure The Settings project .Net WinUI3 based project which diff --git a/src/Monaco/customLanguages/reg.js b/src/Monaco/customLanguages/reg.js index 671f4a36bd..f81f21f455 100644 --- a/src/Monaco/customLanguages/reg.js +++ b/src/Monaco/customLanguages/reg.js @@ -3,7 +3,7 @@ export function regDefinition() { tokenPostfix: '.reg', tokenizer: { root: [ - // Header (case sensitive) + // Header (case-sensitive) [/Windows Registry Editor Version 5.00/, 'comment'], [/REGEDIT4/, 'comment'], // Comments diff --git a/src/common/GPOWrapper/pch.h b/src/common/GPOWrapper/pch.h index 21199686d5..b10d0155ca 100644 --- a/src/common/GPOWrapper/pch.h +++ b/src/common/GPOWrapper/pch.h @@ -1,4 +1,4 @@ #pragma once -#include +#include #include #include diff --git a/src/common/Telemetry/TelemetryBase.cs b/src/common/Telemetry/TelemetryBase.cs index d63ea2a5be..77733f22ae 100644 --- a/src/common/Telemetry/TelemetryBase.cs +++ b/src/common/Telemetry/TelemetryBase.cs @@ -39,7 +39,7 @@ namespace Microsoft.PowerToys.Telemetry public const EventKeywords ProjectKeywordMeasure = (EventKeywords)0x0; /// - /// Group ID for Powertoys project. + /// Group ID for PowerToys project. /// private static readonly string[] PowerToysTelemetryTraits = { "ETW_GROUP", "{42749043-438c-46a2-82be-c6cbeb192ff2}" }; diff --git a/src/common/interop/pch.h b/src/common/interop/pch.h index 0934324c05..c4835a98e1 100644 --- a/src/common/interop/pch.h +++ b/src/common/interop/pch.h @@ -6,7 +6,7 @@ #pragma once #define WIN32_LEAN_AND_MEAN // add headers that you want to pre-compile here -#include +#include #include #include #include diff --git a/src/common/logger/logger.cpp b/src/common/logger/logger.cpp index 9587b97743..709e634af6 100644 --- a/src/common/logger/logger.cpp +++ b/src/common/logger/logger.cpp @@ -85,7 +85,7 @@ void Logger::init(std::string loggerName, std::wstring logFilePath, std::wstring { // todo: that message should be shown from init caller and strings should be localized MessageBoxW(NULL, - L"Logger can not be initialized", + L"Logger cannot be initialized", L"PowerToys", MB_OK | MB_ICONERROR); diff --git a/src/common/notifications/BackgroundActivator/pch.h b/src/common/notifications/BackgroundActivator/pch.h index 83ef612465..17b97f557d 100644 --- a/src/common/notifications/BackgroundActivator/pch.h +++ b/src/common/notifications/BackgroundActivator/pch.h @@ -1,5 +1,5 @@ #pragma once -#include +#include #include #include #include diff --git a/src/common/notifications/notifications.cpp b/src/common/notifications/notifications.cpp index 8b245cfa79..0190e088b2 100644 --- a/src/common/notifications/notifications.cpp +++ b/src/common/notifications/notifications.cpp @@ -4,7 +4,7 @@ #include "utils/com_object_factory.h" #include "utils/window.h" -#include +#include #include #include #include diff --git a/src/common/utils/EventWaiter.h b/src/common/utils/EventWaiter.h index 1a2ba89f02..b9f420c81d 100644 --- a/src/common/utils/EventWaiter.h +++ b/src/common/utils/EventWaiter.h @@ -11,7 +11,7 @@ public: EventWaiter() {} EventWaiter(const std::wstring& name, std::function callback) { - // Create localExitThreadEvent and localWaitingEvent for capturing. We can not capture 'this' as we implement move constructor. + // Create localExitThreadEvent and localWaitingEvent for capturing. We cannot capture 'this' as we implement move constructor. auto localExitThreadEvent = exitThreadEvent = CreateEvent(nullptr, false, false, nullptr); HANDLE localWaitingEvent = waitingEvent = CreateEvent(nullptr, false, false, name.c_str()); std::thread([=]() { diff --git a/src/common/utils/os-detect.h b/src/common/utils/os-detect.h index 57c68e1b76..b26afb7223 100644 --- a/src/common/utils/os-detect.h +++ b/src/common/utils/os-detect.h @@ -2,7 +2,7 @@ #include -// The following three helper functions determine if the user has a build version higher than or equal to 19h1 (aka 1903), as that is a requirement for xaml islands +// The following three helper functions determine if the user has a build version greater than or equal to 19h1 (aka 1903), as that is a requirement for xaml islands // Source : Microsoft-ui-xaml github // Link: https://github.com/microsoft/microsoft-ui-xaml/blob/c045cde57c5c754683d674634a0baccda34d58c4/dev/dll/SharedHelpers.cpp template diff --git a/src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp b/src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp index 8bd2e0860e..bef34c4cd4 100644 --- a/src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp +++ b/src/modules/AdvancedPaste/AdvancedPasteModuleInterface/dllmain.cpp @@ -157,7 +157,7 @@ private: } catch (const winrt::hresult_error& ex) { - // Looks like the only way to access the PasswordVault is through the an API that throws an exception in case the resource doesn't exist. + // Looks like the only way to access the PasswordVault is through an API that throws an exception in case the resource doesn't exist. // If the debugger breaks here, just continue. // If you want to disable breaking here in a more permanent way, just add a condition in Visual Studio's Exception Settings to not break on win::hresult_error, but that might make you not hit other exceptions you might want to catch. if (ex.code() == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) diff --git a/src/modules/EnvironmentVariables/EnvironmentVariablesUILib/Strings/en-us/Resources.resw b/src/modules/EnvironmentVariables/EnvironmentVariablesUILib/Strings/en-us/Resources.resw index 8ea986dcb1..3754c1bb05 100644 --- a/src/modules/EnvironmentVariables/EnvironmentVariablesUILib/Strings/en-us/Resources.resw +++ b/src/modules/EnvironmentVariables/EnvironmentVariablesUILib/Strings/en-us/Resources.resw @@ -275,7 +275,7 @@ Add variable - Profile can not be applied. + Profile cannot be applied. Variables or backup variables are invalid. diff --git a/src/modules/MeasureTool/MeasureToolCore/pch.h b/src/modules/MeasureTool/MeasureToolCore/pch.h index 95b368b96b..c95b544c04 100644 --- a/src/modules/MeasureTool/MeasureToolCore/pch.h +++ b/src/modules/MeasureTool/MeasureToolCore/pch.h @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include #include diff --git a/src/modules/NewPlus/NewShellExtensionContextMenu.win10/pch.h b/src/modules/NewPlus/NewShellExtensionContextMenu.win10/pch.h index 3ddfa219b2..5018653070 100644 --- a/src/modules/NewPlus/NewShellExtensionContextMenu.win10/pch.h +++ b/src/modules/NewPlus/NewShellExtensionContextMenu.win10/pch.h @@ -21,7 +21,7 @@ #include #include #include -#include +#include using namespace Microsoft::WRL; // PowerToys project common diff --git a/src/modules/NewPlus/NewShellExtensionContextMenu/pch.h b/src/modules/NewPlus/NewShellExtensionContextMenu/pch.h index 981209e500..b766a837d5 100644 --- a/src/modules/NewPlus/NewShellExtensionContextMenu/pch.h +++ b/src/modules/NewPlus/NewShellExtensionContextMenu/pch.h @@ -20,7 +20,7 @@ #include #include #include -#include +#include // PowerToys project common #include diff --git a/src/modules/Workspaces/WorkspacesEditor/Utils/StringUtils.cs b/src/modules/Workspaces/WorkspacesEditor/Utils/StringUtils.cs index 3d2d146de2..76593e041a 100644 --- a/src/modules/Workspaces/WorkspacesEditor/Utils/StringUtils.cs +++ b/src/modules/Workspaces/WorkspacesEditor/Utils/StringUtils.cs @@ -10,7 +10,7 @@ namespace WorkspacesEditor.Utils { public static string UpperCamelCaseToDashCase(this string str) { - // If it's single letter variable, leave it as it is + // If it's a single letter variable, leave it as it is return str.Length == 1 ? str : string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "-" + x.ToString() : x.ToString())).ToLowerInvariant(); diff --git a/src/modules/Workspaces/WorkspacesLauncherUI/Utils/StringUtils.cs b/src/modules/Workspaces/WorkspacesLauncherUI/Utils/StringUtils.cs index 1f1d1abd64..f39d6d4646 100644 --- a/src/modules/Workspaces/WorkspacesLauncherUI/Utils/StringUtils.cs +++ b/src/modules/Workspaces/WorkspacesLauncherUI/Utils/StringUtils.cs @@ -10,7 +10,7 @@ namespace WorkspacesLauncherUI.Utils { public static string UpperCamelCaseToDashCase(this string str) { - // If it's single letter variable, leave it as it is + // If it's a single letter variable, leave it as it is if (str.Length == 1) { return str; diff --git a/src/modules/alwaysontop/AlwaysOnTop/WinHookEventIDs.h b/src/modules/alwaysontop/AlwaysOnTop/WinHookEventIDs.h index 756ddbbbae..e85315b5dd 100644 --- a/src/modules/alwaysontop/AlwaysOnTop/WinHookEventIDs.h +++ b/src/modules/alwaysontop/AlwaysOnTop/WinHookEventIDs.h @@ -1,5 +1,5 @@ #pragma once -extern UINT WM_PRIV_SETTINGS_CHANGED; // Scheduled when the a watched settings file is updated +extern UINT WM_PRIV_SETTINGS_CHANGED; // Scheduled when a watched settings file is updated void InitializeWinhookEventIds(); \ No newline at end of file diff --git a/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml.cs b/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml.cs index 018d28e5ca..dd41419e58 100644 --- a/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml.cs +++ b/src/modules/colorPicker/ColorPickerUI/Views/ColorEditorView.xaml.cs @@ -102,7 +102,7 @@ namespace ColorPicker.Views private void HistoryColors_ItemClick(object sender, ItemClickEventArgs e) { // Note: it does not handle clicking on the same color. - // More appropriate event would be SelectionChanged but we can not distinguish between user action and program action inside of it. + // More appropriate event would be SelectionChanged but we cannot distinguish between user action and program action inside of it. SessionEventHelper.Event.EditorHistoryColorPicked = true; } */ diff --git a/src/modules/fancyzones/FancyZonesLib/FancyZonesWinHookEventIDs.h b/src/modules/fancyzones/FancyZonesLib/FancyZonesWinHookEventIDs.h index 5558caaf29..b00c8c1f8f 100644 --- a/src/modules/fancyzones/FancyZonesLib/FancyZonesWinHookEventIDs.h +++ b/src/modules/fancyzones/FancyZonesLib/FancyZonesWinHookEventIDs.h @@ -15,6 +15,6 @@ extern UINT WM_PRIV_APPLIED_LAYOUTS_FILE_UPDATE; // Scheduled when the watched a extern UINT WM_PRIV_DEFAULT_LAYOUTS_FILE_UPDATE; // Scheduled when the watched default-layouts.json file is updated extern UINT WM_PRIV_SNAP_HOTKEY; // Scheduled when we receive a snap hotkey key down press extern UINT WM_PRIV_QUICK_LAYOUT_KEY; // Scheduled when we receive a key down press to quickly apply a layout -extern UINT WM_PRIV_SETTINGS_CHANGED; // Scheduled when the a watched settings file is updated +extern UINT WM_PRIV_SETTINGS_CHANGED; // Scheduled when a watched settings file is updated void InitializeWinhookEventIds(); diff --git a/src/modules/fancyzones/FancyZonesTests/UnitTests/WindowProcessingTests.Spec.cpp b/src/modules/fancyzones/FancyZonesTests/UnitTests/WindowProcessingTests.Spec.cpp index 7ce509b806..b1953d7f0d 100644 --- a/src/modules/fancyzones/FancyZonesTests/UnitTests/WindowProcessingTests.Spec.cpp +++ b/src/modules/fancyzones/FancyZonesTests/UnitTests/WindowProcessingTests.Spec.cpp @@ -197,7 +197,7 @@ namespace FancyZonesUnitTests TEST_METHOD (ExcludedApp_ByUser) { - // case sensitive, should be uppercase + // case-sensitive, should be uppercase FancyZonesSettings::instance().SetSettings(Settings{ .excludedAppsArray = { L"TEST_EXCLUDED" } }); // exclude by window title diff --git a/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs b/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs index b0cb80550f..2543568436 100644 --- a/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs +++ b/src/modules/fancyzones/editor/FancyZonesEditor/EditorWindow.cs @@ -24,7 +24,7 @@ namespace FancyZonesEditor Logger.LogTrace(); // If new custom Canvas layout is created (i.e. edited Blank layout), - // it's type needs to be updated + // its type needs to be updated if (EditingLayout.Type == LayoutType.Blank) { EditingLayout.Type = LayoutType.Custom; diff --git a/src/modules/imageresizer/ImageResizerContextMenu/dllmain.cpp b/src/modules/imageresizer/ImageResizerContextMenu/dllmain.cpp index 31335d59a3..b550009ec7 100644 --- a/src/modules/imageresizer/ImageResizerContextMenu/dllmain.cpp +++ b/src/modules/imageresizer/ImageResizerContextMenu/dllmain.cpp @@ -228,12 +228,12 @@ private: if (UuidCreate(&temp_uuid) == RPC_S_UUID_NO_ADDRESS) { auto val = get_last_error_message(GetLastError()); - Logger::warn(L"UuidCreate can not create guid. {}", val.has_value() ? val.value() : L""); + Logger::warn(L"UuidCreate cannot create guid. {}", val.has_value() ? val.value() : L""); } else if (UuidToString(&temp_uuid, reinterpret_cast(& uuid_chars)) != RPC_S_OK) { auto val = get_last_error_message(GetLastError()); - Logger::warn(L"UuidToString can not convert to string. {}", val.has_value() ? val.value() : L""); + Logger::warn(L"UuidToString cannot convert to string. {}", val.has_value() ? val.value() : L""); } if (uuid_chars != nullptr) diff --git a/src/modules/imageresizer/dll/ContextMenuHandler.h b/src/modules/imageresizer/dll/ContextMenuHandler.h index abcadfa972..0a6b59da07 100644 --- a/src/modules/imageresizer/dll/ContextMenuHandler.h +++ b/src/modules/imageresizer/dll/ContextMenuHandler.h @@ -8,7 +8,7 @@ #include #if defined(_WIN32_WCE) && !defined(_CE_DCOM) && !defined(_CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA) -#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of it's single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." +#error "Single-threaded COM objects are not properly supported on Windows CE platform, such as the Windows Mobile platforms that do not include full DCOM support. Define _CE_ALLOW_SINGLE_THREADED_OBJECTS_IN_MTA to force ATL to support creating single-thread COM object's and allow use of its single-threaded COM object implementations. The threading model in your rgs file was set to 'Free' as that is the only threading model supported in non DCOM Windows CE platforms." #endif using namespace ATL; diff --git a/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx b/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx index d3dd047fd8..ef66605311 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx +++ b/src/modules/keyboardmanager/KeyboardManagerEditor/Resources.resx @@ -430,7 +430,7 @@ Row as in horizontal rows in a table, and columns - Disable can not be an action or a modifier key + Disable cannot be an action or a modifier key Key on a keyboard diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp index 4557c73430..1af4ce7bce 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/BufferValidationHelpers.cpp @@ -139,7 +139,7 @@ namespace BufferValidationHelpers } else if (selectedKeyCode == CommonSharedConstants::VK_DISABLED && dropDownIndex) { - // Disable can not be selected if one modifier key has already been selected + // Disable cannot be selected if one modifier key has already been selected errorType = ShortcutErrorType::ShortcutDisableAsActionKey; } // If none of the above, then the action key will be set diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp index 3597107808..85a6fa1b4d 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditKeyboardWindow.cpp @@ -500,7 +500,7 @@ LRESULT CALLBACK EditKeyboardWindowProc(HWND hWnd, UINT messageCode, WPARAM wPar } break; default: - // If the Xaml Bridge object exists, then use it's message handler to handle keyboard focus operations + // If the Xaml Bridge object exists, then use its message handler to handle keyboard focus operations if (xamlBridgePtr != nullptr) { return xamlBridgePtr->MessageHandler(messageCode, wParam, lParam); diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp index 0a2f044765..f0f819d916 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/EditShortcutsWindow.cpp @@ -523,7 +523,7 @@ LRESULT CALLBACK EditShortcutsWindowProc(HWND hWnd, UINT messageCode, WPARAM wPa } break; default: - // If the Xaml Bridge object exists, then use it's message handler to handle keyboard focus operations + // If the Xaml Bridge object exists, then use its message handler to handle keyboard focus operations if (xamlBridgePtr != nullptr) { return xamlBridgePtr->MessageHandler(messageCode, wParam, lParam); diff --git a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/pch.h b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/pch.h index 316ab36e42..41654021e1 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/pch.h +++ b/src/modules/keyboardmanager/KeyboardManagerEditorLibrary/pch.h @@ -3,7 +3,7 @@ #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include +#include #include #include diff --git a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp index 9fa12a426a..bd9b4504c0 100644 --- a/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp +++ b/src/modules/keyboardmanager/KeyboardManagerEngineLibrary/KeyboardEventHandlers.cpp @@ -613,7 +613,7 @@ namespace KeyboardEventHandlers if (!isAltRightKeyInvoked) { - // Set original shortcut key down state except the action key and the released modifier since the original action key may or may not be held down. If it is held down it will generate it's own key message + // Set original shortcut key down state except the action key and the released modifier since the original action key may or may not be held down. If it is held down it will generate its own key message Helpers::SetModifierKeyEvents(it->first, it->second.winKeyInvoked, keyEventList, true, KeyboardManagerConstants::KEYBOARDMANAGER_SHORTCUT_FLAG, std::get(it->second.targetShortcut), data->lParam->vkCode); } else @@ -637,7 +637,7 @@ namespace KeyboardEventHandlers // Ensures that after releasing both the action key and AltGr, Ctrl does not remain falsely pressed. if (!isAltRightKeyInvoked) { - // Set original shortcut key down state except the action key and the released modifier since the original action key may or may not be held down. If it is held down it will generate it's own key message + // Set original shortcut key down state except the action key and the released modifier since the original action key may or may not be held down. If it is held down it will generate its own key message Helpers::SetModifierKeyEvents(it->first, it->second.winKeyInvoked, keyEventList, true, KeyboardManagerConstants::KEYBOARDMANAGER_SHORTCUT_FLAG, Shortcut(), data->lParam->vkCode); } else @@ -1711,7 +1711,7 @@ namespace KeyboardEventHandlers query_string = process_name; it = state.appSpecificShortcutReMap.find(query_string); - // If no entry is found, search for the process name without it's file extension + // If no entry is found, search for the process name without its file extension if (it == state.appSpecificShortcutReMap.end()) { // Find index of the file extension diff --git a/src/modules/keyboardmanager/common/Helpers.cpp b/src/modules/keyboardmanager/common/Helpers.cpp index dc23e62fae..fb2cefd98a 100644 --- a/src/modules/keyboardmanager/common/Helpers.cpp +++ b/src/modules/keyboardmanager/common/Helpers.cpp @@ -338,7 +338,7 @@ namespace Helpers return key; } - // Function to sort a vector of shortcuts based on it's size + // Function to sort a vector of shortcuts based on its size void SortShortcutVectorBasedOnSize(std::vector& shortcutVector) { std::sort(shortcutVector.begin(), shortcutVector.end(), [](Shortcut first, Shortcut second) { diff --git a/src/modules/keyboardmanager/common/Helpers.h b/src/modules/keyboardmanager/common/Helpers.h index 4adbcf67c2..bd878a3942 100644 --- a/src/modules/keyboardmanager/common/Helpers.h +++ b/src/modules/keyboardmanager/common/Helpers.h @@ -52,6 +52,6 @@ namespace Helpers // Function to filter the key codes for artificial key codes int32_t FilterArtificialKeys(const int32_t& key); - // Function to sort a vector of shortcuts based on it's size + // Function to sort a vector of shortcuts based on its size void SortShortcutVectorBasedOnSize(std::vector& shortcutVector); } \ No newline at end of file diff --git a/src/modules/keyboardmanager/common/Shortcut.cpp b/src/modules/keyboardmanager/common/Shortcut.cpp index ecd8b58c80..38550199f4 100644 --- a/src/modules/keyboardmanager/common/Shortcut.cpp +++ b/src/modules/keyboardmanager/common/Shortcut.cpp @@ -21,7 +21,7 @@ std::vector Shortcut::splitwstring(const std::wstring& input, wcha return splittedStrings; } -// Constructor to initialize Shortcut from it's virtual key code string representation. +// Constructor to initialize Shortcut from its virtual key code string representation. Shortcut::Shortcut(const std::wstring& shortcutVK) : winKey(ModifierKey::Disabled), ctrlKey(ModifierKey::Disabled), altKey(ModifierKey::Disabled), shiftKey(ModifierKey::Disabled), actionKey(NULL) { @@ -46,7 +46,7 @@ Shortcut::Shortcut(const DWORD key) SetKey(key); } -// Constructor to initialize Shortcut from it's virtual key code string representation. +// Constructor to initialize Shortcut from its virtual key code string representation. Shortcut::Shortcut(const std::wstring& shortcutVK, const DWORD secondKeyOfChord) : winKey(ModifierKey::Disabled), ctrlKey(ModifierKey::Disabled), altKey(ModifierKey::Disabled), shiftKey(ModifierKey::Disabled), actionKey(NULL) { diff --git a/src/modules/keyboardmanager/common/Shortcut.h b/src/modules/keyboardmanager/common/Shortcut.h index 0bbe00bb4f..72fb0ac469 100644 --- a/src/modules/keyboardmanager/common/Shortcut.h +++ b/src/modules/keyboardmanager/common/Shortcut.h @@ -82,10 +82,10 @@ public: // Constructor to initialize Shortcut from single key Shortcut(const DWORD key); - // Constructor to initialize Shortcut from it's virtual key code string representation. + // Constructor to initialize Shortcut from its virtual key code string representation. Shortcut(const std::wstring& shortcutVK); - // Constructor to initialize Shortcut from it's virtual key code string representation. + // Constructor to initialize Shortcut from its virtual key code string representation. Shortcut(const std::wstring& shortcutVK, const DWORD _secondKeyOfChord); // Constructor to initialize shortcut from a list of keys diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs index a47f8275fe..0443662680 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Indexer/Main.cs @@ -163,7 +163,7 @@ namespace Microsoft.Plugin.Indexer }; r.ContextData = searchResult; - // If the result is a directory, then it's display should show a directory. + // If the result is a directory, then its display should show a directory. if (_fileSystem.Directory.Exists(path)) { r.QueryTextDisplay = path; diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs index 17d5ae939f..b5611b793b 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Program/Programs/UWPApplication.cs @@ -252,10 +252,10 @@ namespace Microsoft.Plugin.Program.Programs logoUri = LogoUriFromManifest(manifestApp); Enabled = true; - CanRunElevated = IfApplicationcanRunElevated(); + CanRunElevated = IfApplicationCanRunElevated(); } - private bool IfApplicationcanRunElevated() + private bool IfApplicationCanRunElevated() { if (EntryPoint == "Windows.FullTrustApplication") { diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs index cd4a3e0e6f..6d380cb7dd 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.Uri.UnitTests/UriHelper/ExtendedUriParserTests.cs @@ -132,7 +132,7 @@ namespace Microsoft.Plugin.Uri.UnitTests.UriHelper // All following cases should be parsed as application URI [DataRow("mailto:", true, null, "mailto:")] [DataRow("mailto:/", false, null, null)] - [DataRow("mailto:example@mail.com", true, null, "mailto:example@mail.com")] + [DataRow("mailto:mail@example.com", true, null, "mailto:mail@example.com")] [DataRow("ms-settings:", true, null, "ms-settings:")] [DataRow("ms-settings:/", false, null, null)] [DataRow("ms-settings://", false, null, null)] diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs index 9846ebff16..ecbe4bfb07 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/ContextMenuHelper.cs @@ -39,7 +39,7 @@ namespace Microsoft.Plugin.WindowWalker.Components { if (!windowData.IsWindow) { - Log.Debug($"Can not close the window '{windowData.Title}' ({windowData.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper)); + Log.Debug($"Cannot close the window '{windowData.Title}' ({windowData.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper)); return false; } @@ -79,7 +79,7 @@ namespace Microsoft.Plugin.WindowWalker.Components // Validate process if (!window.IsWindow || !window.Process.DoesExist || !window.Process.Name.Equals(WindowProcess.GetProcessNameFromProcessID(window.Process.ProcessID), StringComparison.Ordinal)) { - Log.Debug($"Can not kill process '{window.Process.Name}' ({window.Process.ProcessID}) of the window '{window.Title}' ({window.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper)); + Log.Debug($"Cannot kill process '{window.Process.Name}' ({window.Process.ProcessID}) of the window '{window.Title}' ({window.Hwnd}), because it doesn't exist.", typeof(ContextMenuHelper)); return false; } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs index bf09ee4e9e..f660cc3057 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/Window.cs @@ -363,7 +363,7 @@ namespace Microsoft.Plugin.WindowWalker.Components { if (_handlesToProcessCache.Count > 7000) { - Debug.Print("Clearing Process Cache because it's size is " + _handlesToProcessCache.Count); + Debug.Print("Clearing Process Cache because its size is " + _handlesToProcessCache.Count); _handlesToProcessCache.Clear(); } @@ -381,7 +381,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } else { - // For the dwm process we can not receive the name. This is no problem because the window isn't part of result list. + // For the dwm process we cannot receive the name. This is no problem because the window isn't part of result list. Log.Debug($"Invalid process {processId} ({processName}) for window handle {hWindow}.", typeof(Window)); _handlesToProcessCache.Add(hWindow, new WindowProcess(0, 0, string.Empty)); } diff --git a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowProcess.cs b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowProcess.cs index 0915b13cbb..8029119562 100644 --- a/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowProcess.cs +++ b/src/modules/launcher/Plugins/Microsoft.Plugin.WindowWalker/Components/WindowProcess.cs @@ -203,7 +203,7 @@ namespace Microsoft.Plugin.WindowWalker.Components } /// - /// Kills the process by it's id. If permissions are required, they will be requested. + /// Kills the process by its id. If permissions are required, they will be requested. /// /// Kill process and sub processes. internal void KillThisProcess(bool killProcessTree) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Components/AvailableResult.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Components/AvailableResult.cs index 2741de6e51..b545c28e48 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Components/AvailableResult.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Components/AvailableResult.cs @@ -20,7 +20,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Components internal string Label { get; set; } /// - /// Gets or sets an an alternative search tag that will be evaluated if label doesn't match. For example we like to show the era on searches for 'year' too. + /// Gets or sets an alternative search tag that will be evaluated if label doesn't match. For example we like to show the era on searches for 'year' too. /// internal string AlternativeSearchTag { get; set; } diff --git a/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs b/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs index 9667fc50cb..378027040c 100644 --- a/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs +++ b/src/modules/launcher/PowerLauncher/Helper/EnvironmentHelper.cs @@ -15,7 +15,7 @@ using Stopwatch = Wox.Infrastructure.Stopwatch; namespace PowerLauncher.Helper { /// - /// On Windows operating system the name of environment variables is case insensitive. This means if we have a user and machine variable with differences in their name casing (eg. test vs Test), the name casing from machine level is used and won't be overwritten by the user var. + /// On Windows operating system the name of environment variables is case-insensitive. This means if we have a user and machine variable with differences in their name casing (eg. test vs Test), the name casing from machine level is used and won't be overwritten by the user var. /// Example for Window's behavior: test=ValueMachine (Machine level) + TEST=ValueUser (User level) => test=ValueUser (merged) /// To get the same behavior we use "StringComparer.OrdinalIgnoreCase" as compare property for the HashSet and Dictionaries where we merge machine and user variable names. /// @@ -96,7 +96,7 @@ namespace PowerLauncher.Helper // Determine deleted variables and add them with a "string.Empty" value as marker to the dictionary foreach (DictionaryEntry pVar in oldProcessEnvironment) { - // We must compare case insensitive (see dictionary assignment) to avoid false positives when the variable name has changed (Example: "path" -> "Path") + // We must compare case-insensitive (see dictionary assignment) to avoid false positives when the variable name has changed (Example: "path" -> "Path") if (!newEnvironment.ContainsKey((string)pVar.Key) & !_protectedProcessVariables.Contains((string)pVar.Key)) { newEnvironment.Add((string)pVar.Key, string.Empty); @@ -107,7 +107,7 @@ namespace PowerLauncher.Helper // Later we only like to recreate the changed ones foreach (string varName in newEnvironment.Keys.ToList()) { - // To be able to detect changed names correctly we have to compare case sensitive + // To be able to detect changed names correctly we have to compare case-sensitive if (oldProcessEnvironment.Contains(varName)) { if (oldProcessEnvironment[varName].Equals(newEnvironment[varName])) @@ -155,7 +155,7 @@ namespace PowerLauncher.Helper } catch (Exception ex) { - // The dotnet method "System.Environment.SetEnvironmentVariable" has it's own internal method to check the input parameters. Here we catch the exceptions that we don't check before updating the environment variable and log it to avoid crashes of PT Run. + // The dotnet method "System.Environment.SetEnvironmentVariable" has its own internal method to check the input parameters. Here we catch the exceptions that we don't check before updating the environment variable and log it to avoid crashes of PT Run. Log.Exception($"Unhandled exception while updating the environment variable [{kv.Key}] for the PT Run process. (The variable value has a length of [{varValueLength}].)", ex, typeof(PowerLauncher.Helper.EnvironmentHelper)); } } @@ -189,7 +189,7 @@ namespace PowerLauncher.Helper string uVarKey = (string)uVar.Key; string uVarValue = (string)uVar.Value; - // The variable name of the path variable can be upper case, lower case ore mixed case. So we have to compare case insensitive. + // The variable name of the path variable can be upper case, lower case ore mixed case. So we have to compare case-insensitive. if (!uVarKey.Equals(PathVariableName, StringComparison.OrdinalIgnoreCase)) { environment[uVarKey] = uVarValue; diff --git a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs index eef66490e7..8bed73d83c 100644 --- a/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/MainWindow.xaml.cs @@ -617,7 +617,7 @@ namespace PowerLauncher catch (ArgumentOutOfRangeException ex) { // Due to virtualization being enabled for the listview, the layout system updates elements in a deferred manner using an algorithm that balances performance and concurrency. - // Hence, there can be a situation where the element index that we want to scroll into view is out of range for it's parent control. + // Hence, there can be a situation where the element index that we want to scroll into view is out of range for its parent control. // To mitigate this we use the UpdateLayout function, which forces layout update to ensure that the parent element contains the latest properties. // However, it has a performance impact and is therefore not called each time. Log.Exception("The parent element layout is not updated yet", ex, GetType()); diff --git a/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs b/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs index 96ed4539d8..22eda6e28e 100644 --- a/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs +++ b/src/modules/launcher/Wox.Plugin/Common/VirtualDesktop/VirtualDesktopHelper.cs @@ -91,7 +91,7 @@ namespace Wox.Plugin.Common.VirtualDesktop.Helper /// Method to update the list of Virtual Desktops from Registry /// The data in the registry are always up to date /// - /// If we can not read from registry, we set the list/guid to empty values. + /// If we cannot read from registry, we set the list/guid to empty values. public void UpdateDesktopList() { int userSessionId = Process.GetCurrentProcess().SessionId; diff --git a/src/modules/launcher/Wox.Plugin/PluginPair.cs b/src/modules/launcher/Wox.Plugin/PluginPair.cs index c4249727ec..d31970d16d 100644 --- a/src/modules/launcher/Wox.Plugin/PluginPair.cs +++ b/src/modules/launcher/Wox.Plugin/PluginPair.cs @@ -223,7 +223,7 @@ namespace Wox.Plugin { if (Plugin == null) { - Log.Warn($"Can not initialize {Metadata.Name} plugin as it was not loaded", GetType()); + Log.Warn($"Cannot initialize {Metadata.Name} plugin as it was not loaded", GetType()); return false; } diff --git a/src/modules/poweraccent/PowerAccentKeyboardService/pch.h b/src/modules/poweraccent/PowerAccentKeyboardService/pch.h index 21199686d5..b10d0155ca 100644 --- a/src/modules/poweraccent/PowerAccentKeyboardService/pch.h +++ b/src/modules/poweraccent/PowerAccentKeyboardService/pch.h @@ -1,4 +1,4 @@ #pragma once -#include +#include #include #include diff --git a/src/modules/powerrename/PowerRenameContextMenu/dllmain.cpp b/src/modules/powerrename/PowerRenameContextMenu/dllmain.cpp index ce5669fde8..ea90a51ff1 100644 --- a/src/modules/powerrename/PowerRenameContextMenu/dllmain.cpp +++ b/src/modules/powerrename/PowerRenameContextMenu/dllmain.cpp @@ -218,12 +218,12 @@ private: if (UuidCreate(&temp_uuid) == RPC_S_UUID_NO_ADDRESS) { auto val = get_last_error_message(GetLastError()); - Logger::warn(L"UuidCreate can not create guid. {}", val.has_value() ? val.value() : L""); + Logger::warn(L"UuidCreate cannot create guid. {}", val.has_value() ? val.value() : L""); } else if (UuidToString(&temp_uuid, reinterpret_cast(& uuid_chars)) != RPC_S_OK) { auto val = get_last_error_message(GetLastError()); - Logger::warn(L"UuidToString can not convert to string. {}", val.has_value() ? val.value() : L""); + Logger::warn(L"UuidToString cannot convert to string. {}", val.has_value() ? val.value() : L""); } if (uuid_chars != nullptr) diff --git a/src/modules/powerrename/PowerRenameUILib/pch.h b/src/modules/powerrename/PowerRenameUILib/pch.h index f3b4f298f3..f94264a6b4 100644 --- a/src/modules/powerrename/PowerRenameUILib/pch.h +++ b/src/modules/powerrename/PowerRenameUILib/pch.h @@ -3,10 +3,10 @@ #define NOMINMAX #include -#include +#include #include #include -#include +#include // Undefine GetCurrentTime macro to prevent // conflict with Storyboard::GetCurrentTime diff --git a/src/modules/powerrename/dll/pch.h b/src/modules/powerrename/dll/pch.h index 2d9c5fb252..d36298664d 100644 --- a/src/modules/powerrename/dll/pch.h +++ b/src/modules/powerrename/dll/pch.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/modules/previewpane/README.md b/src/modules/previewpane/README.md index 10653a4811..4526f14723 100644 --- a/src/modules/previewpane/README.md +++ b/src/modules/previewpane/README.md @@ -19,7 +19,7 @@ To add a new Previewer update the `Product.wxs` file in `PowerToysSetup` similar **[Important] This method of registering Preview Handler DLL's is not recommended. It could lead to registry corruption.** #### Registering Preview Handler 1. Restart Visual studio as administrator. -2. Sign `XYZPreviewHandler` and it's dependencies. To sign an assembly in VS, follow steps given [here](https://learn.microsoft.com/dotnet/standard/assembly/sign-strong-name#create-and-sign-an-assembly-with-a-strong-name-by-using-visual-studio). +2. Sign `XYZPreviewHandler` and its dependencies. To sign an assembly in VS, follow steps given [Create and sign an assembly with a strong name by using Visual Studio](https://learn.microsoft.com/en-us/dotnet/standard/assembly/sign-strong-name#create-and-sign-an-assembly-with-a-strong-name-by-using-visual-studio). 3. Build `XYZPreviewHandler` project. 4. Open developer command prompt from `Tools > Command Line > Developer Command Prompt`. 5. Run following command for each nuget and project dependency to add them to Global Assembly Cache(GAC). diff --git a/src/modules/previewpane/powerpreview/powerpreview.base.rc b/src/modules/previewpane/powerpreview/powerpreview.base.rc index 817eced580..0de3cc578b 100644 --- a/src/modules/previewpane/powerpreview/powerpreview.base.rc +++ b/src/modules/previewpane/powerpreview/powerpreview.base.rc @@ -52,9 +52,9 @@ STRINGTABLE BEGIN IDS_EXPLR_ICONS_PREV_STTNGS_GROUP_HEADER_ID L"EXPLR_ICONS_PREV_STTNGS_GROUP_HEADER_ID" IDS_PRVPANE_FILE_PREV_STTNGS_GROUP_HEADER_ID L"PRVPANE_FILE_PREV_STTNGS_GROUP_HEADER_ID" - IDS_PREVPANE_MD_BOOL_TOGGLE_CONTROLL L"PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID" - IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL L"IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL" - IDS_EXPLR_SVG_BOOL_TOGGLE_CONTROLL L"EXPLR_SVG_BOOL_TOGGLE_CONTROLL" + IDS_PREVPANE_MD_BOOL_TOGGLE_CONTROL L"PREVPANE_MD_BOOL_TOGGLE_CONTROLL_ID" + IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROL L"IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROL" + IDS_EXPLR_SVG_BOOL_TOGGLE_CONTROL L"EXPLR_SVG_BOOL_TOGGLE_CONTROLL" END // Non-localizable diff --git a/src/modules/previewpane/powerpreview/resource.base.h b/src/modules/previewpane/powerpreview/resource.base.h index e567ede222..02047727fa 100644 --- a/src/modules/previewpane/powerpreview/resource.base.h +++ b/src/modules/previewpane/powerpreview/resource.base.h @@ -10,9 +10,9 @@ #define ORIGINAL_FILENAME "PowerToys.powerpreview.dll" #define IDS_EXPLR_ICONS_PREV_STTNGS_GROUP_HEADER_ID 1001 #define IDS_PRVPANE_FILE_PREV_STTNGS_GROUP_HEADER_ID 1002 -#define IDS_PREVPANE_MD_BOOL_TOGGLE_CONTROLL 1003 -#define IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROLL 1004 -#define IDS_EXPLR_SVG_BOOL_TOGGLE_CONTROLL 1005 +#define IDS_PREVPANE_MD_BOOL_TOGGLE_CONTROL 1003 +#define IDS_PREVPANE_SVG_BOOL_TOGGLE_CONTROL 1004 +#define IDS_EXPLR_SVG_BOOL_TOGGLE_CONTROL 1005 // Non-localizable ////////////////////////////// diff --git a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs index daae306006..b3073669f7 100644 --- a/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs +++ b/src/modules/registrypreview/RegistryPreviewUILib/RegistryPreviewMainPage.Utilities.cs @@ -196,7 +196,7 @@ namespace RegistryPreviewUILib return false; } - // REG files have to start with one of two headers and it's case insensitive + // REG files have to start with one of two headers and it's case-insensitive registryLine = registryLines[0]; registryLine = registryLine.ToLowerInvariant(); @@ -232,7 +232,7 @@ namespace RegistryPreviewUILib } else if (registryLine.StartsWith("@=", StringComparison.InvariantCulture)) { - // This is the a Value called "(Default)" so we tweak the line for the UX + // This is the Value called "(Default)" so we tweak the line for the UX registryLine = registryLine.Replace("@=", "\"(Default)\"="); } diff --git a/src/runner/main.cpp b/src/runner/main.cpp index c2f45868f6..ba893678c1 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -132,7 +132,7 @@ int runner(bool isProcessElevated, bool openSettings, std::string settingsWindow } }.detach(); chdir_current_executable(); - // Load Powertoys DLLs + // Load PowerToys DLLs std::vector knownModules = { L"PowerToys.FancyZonesModuleInterface.dll", diff --git a/src/runner/settings_window.cpp b/src/runner/settings_window.cpp index 6127eb2c60..4c2787194e 100644 --- a/src/runner/settings_window.cpp +++ b/src/runner/settings_window.cpp @@ -93,7 +93,7 @@ std::optional dispatch_json_action_to_module(const json::JsonObjec else if (action == L"restart_maintain_elevation") { // this was added to restart and maintain elevation, which is needed after settings are change from outside the normal process. - // since a normal PostQuitMessage(0) would usually cause this process to save it's in memory settings to disk, we need to + // since a normal PostQuitMessage(0) would usually cause this process to save its in memory settings to disk, we need to // send a PostQuitMessage(1) and check for that on exit, and skip the settings-flush. auto loaded = PTSettingsHelper::load_general_settings(); @@ -348,12 +348,12 @@ void run_settings_window(bool show_oobe_window, bool show_scoobe_window, std::op if (UuidCreate(&temp_uuid) == RPC_S_UUID_NO_ADDRESS) { auto val = get_last_error_message(GetLastError()); - Logger::warn(L"UuidCreate can not create guid. {}", val.has_value() ? val.value() : L""); + Logger::warn(L"UuidCreate cannot create guid. {}", val.has_value() ? val.value() : L""); } else if (UuidToString(&temp_uuid, reinterpret_cast(&uuid_chars)) != RPC_S_OK) { auto val = get_last_error_message(GetLastError()); - Logger::warn(L"UuidToString can not convert to string. {}", val.has_value() ? val.value() : L""); + Logger::warn(L"UuidToString cannot convert to string. {}", val.has_value() ? val.value() : L""); } if (uuid_chars != nullptr) diff --git a/src/settings-ui/Settings.UI.Library/KeysDataModel.cs b/src/settings-ui/Settings.UI.Library/KeysDataModel.cs index 1232d384b8..a5a21a02d2 100644 --- a/src/settings-ui/Settings.UI.Library/KeysDataModel.cs +++ b/src/settings-ui/Settings.UI.Library/KeysDataModel.cs @@ -281,7 +281,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library return (string.IsNullOrEmpty(NewRemapString) || NewRemapString == "*Unsupported*") ? MapKeys(NewRemapKeys) : new List { NewRemapString }; } - // Instead of doing something fancy pants, we 'll just display the RunProgramFilePath data when it's IsRunProgram + // Instead of doing something fancy pants, we'll just display the RunProgramFilePath data when it's IsRunProgram // It truncates the start of the program to run, if it's long and truncates the end of the args if it's long // e.g.: c:\MyCool\PathIs\Long\software.exe myArg1 myArg2 myArg3 -> (something like) "...ng\software.exe myArg1..." // the idea is you get the most important part of the program to run and some of the args in case that the only thing thats different, diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml.cs index 4aa0e9a31b..c7a84eb5d0 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/KeyboardManagerPage.xaml.cs @@ -43,7 +43,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views private void OnConfigFileUpdate() { // Note: FileSystemWatcher raise notification multiple times for single update operation. - // Todo: Handle duplicate events either by somehow suppress them or re-read the configuration everytime since we will be updating the UI only if something is changed. + // Todo: Handle duplicate events either by somehow suppress them or re-read the configuration every time since we will be updating the UI only if something is changed. if (ViewModel.LoadProfile()) { this.DispatcherQueue.TryEnqueue(() => diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml.cs b/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml.cs index 989bd9f0c6..f29056245f 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml.cs +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/MouseWithoutBordersPage.xaml.cs @@ -52,7 +52,7 @@ namespace Microsoft.PowerToys.Settings.UI.Views private void OnConfigFileUpdate() { // Note: FileSystemWatcher raise notification multiple times for single update operation. - // Todo: Handle duplicate events either by somehow suppress them or re-read the configuration everytime since we will be updating the UI only if something is changed. + // Todo: Handle duplicate events either by somehow suppress them or re-read the configuration every time since we will be updating the UI only if something is changed. this.DispatcherQueue.TryEnqueue(() => { if (ViewModel.LoadUpdatedSettings()) 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 2b885d7719..c2a3b11269 100644 --- a/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw +++ b/src/settings-ui/Settings.UI/Strings/en-us/Resources.resw @@ -4579,7 +4579,7 @@ Activate by holding the key for the character you want to add an accent to, then Rules defined by your organization - You can not change, remove or disable these enforced rules. + You cannot change, remove or disable these enforced rules. Open settings diff --git a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs index bf56b312dd..5cfc22d644 100644 --- a/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/MouseWithoutBordersViewModel.cs @@ -418,7 +418,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels InitializeEnabledValue(); InitializePolicyValues(); - // MouseWithoutBorders settings may be changed by the logic in the utility as machines connect. We need to get a fresh version everytime instead of using a repository. + // MouseWithoutBorders settings may be changed by the logic in the utility as machines connect. We need to get a fresh version every time instead of using a repository. MouseWithoutBordersSettings moduleSettings; moduleSettings = SettingsUtils.GetSettingsOrDefault("MouseWithoutBorders"); diff --git a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs index ee0781ce91..67473e84e5 100644 --- a/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs +++ b/src/settings-ui/Settings.UI/ViewModels/PowerLauncherViewModel.cs @@ -50,7 +50,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels { if (settings == null) { - throw new ArgumentException("settings argument can not be null"); + throw new ArgumentException("settings argument cannot be null"); } this.settings = settings; diff --git a/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp b/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp index 42e5fe2b0d..6b5f4f0180 100644 --- a/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp +++ b/tools/BugReportTool/BugReportTool/ZipTools/zipfolder.cpp @@ -14,7 +14,7 @@ void ZipFolder(std::filesystem::path zipPath, std::filesystem::path folderPath) struct zip_t* zip = zip_open(tmpZipPath.string().c_str(), ZIP_DEFAULT_COMPRESSION_LEVEL, 'w'); if (!zip) { - printf("Can not open zip."); + printf("Cannot open zip."); throw -1; }