[Run-Plugin] Settings plugin (#11663)

* Current settings plugin state on fresh master

* typo fixes

* Add to YML

* Add to WXS

* Address feedback - highlight the note in the tool-tip a little bit

* Address feedback add extra note for "Manage known networks"

* Address feedback - Show type of settings in sub-line and remove extra ControlPanel prefix in json

* Add "WiFi" as alternative name for each Wi-Fi setting

* Add a few more alternative names

* Make RESX happy

* exclude WindowsSettings.json from spell checker because all entries are placeholders  for the translation

* Translate all alternative names

* Translate all notes

* fix for not find "wifi"

* fix typo

* typo fixes and remove debug

* Address feedback - correct author

* Address feedback - settings entries

* Address feedback - code changes

* Address feedback - RESX changes and tool-tip

* fix typo

* Address feedback - remove superfluous interface

* Address feedback - Update RESX

* Address feedback - simplification

* Address feedback - remove enumeration

* Address feedback - move big function in extra helper classes

* Address feedback - move big function in extra helper class

* Address feedback - correct namespace

* Address feedback - move translation to translation helper and make translation more robust

* fix typo

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Main.cs

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/ResultHelper.cs

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Main.cs

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* fix build

* Address feedback

* ups

* Address feedback - Correct windows update settings name

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/WindowsSettings.json

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* adding in dependencies so when you build Launcher, all plugins are included

* Address feedback - add optional updates

* Address feedback - use build numebr instaed of Windows version

* Address feedback - Log difference between registry values + fix wrong ValueType (ushort -> uint)

* Address feebdback - improved warning message on different registry values

* fix typo

* removed not need using

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* Update src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.WindowsSettings/Helper/UnsupportedSettingsHelper.cs

Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>

* Addrress feedback, don't copy embed file

* Address feedback - Remove duplicated or not available settings

* Address feedback - Improve scoring

* Address feedback - Add extra filter

* Address feedback - replace the are filter sign with a better one

* Address feedback - fix unwanted behavior

* Address feedback - Change class name

* Address feedback - Rename settings type

* typo fix

* Fix installer

* Comment out localization support

Co-authored-by: Sekan, Tobias <tobias.sekan@startmail.com>
Co-authored-by: Heiko <61519853+htcfreek@users.noreply.github.com>
Co-authored-by: crutkas <crutkas@microsoft.com>
This commit is contained in:
Mykhailo Pylyp 2021-06-09 18:04:03 +03:00 committed by GitHub
parent fc9d7e4f1b
commit c9c54b7780
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 8567 additions and 4 deletions

View File

@ -40,3 +40,4 @@ ignore$
^\.github/ ^\.github/
^\.github/actions/spell-check/ ^\.github/actions/spell-check/
^\.gitmodules$ ^\.gitmodules$
(?:^|/)WindowsSettings\.json$

View File

@ -12,6 +12,8 @@ Acceleratorkeys
ACCEPTFILES ACCEPTFILES
accessibile accessibile
accessibilityinsights accessibilityinsights
accessoryapps
accountinfo
Acl Acl
aclapi aclapi
AColumn AColumn
@ -22,18 +24,26 @@ actioned
activatable activatable
ACTIVATEAPP ACTIVATEAPP
activationaction activationaction
activityhistory
Addavirtualdesktop Addavirtualdesktop
Addins
addphone
addrum addrum
ADDUNDORECORD ADDUNDORECORD
ADifferent ADifferent
ADMINS ADMINS
adopsinsider
advancedgraphics
advapi advapi
advertisingid
advfirewall advfirewall
AFeature AFeature
AFX AFX
AGGREGATABLE AGGREGATABLE
AHybrid AHybrid
airplanemode
Aissue Aissue
akamaihd
ALarger ALarger
alekhyareddy alekhyareddy
ALIGNLEFT ALIGNLEFT
@ -63,6 +73,7 @@ APIIs
APPBARDATA APPBARDATA
appcontainer appcontainer
appdata appdata
appdiagnostics
APPICON APPICON
appid appid
appium appium
@ -74,7 +85,10 @@ appmanifest
appmodel appmodel
appref appref
apps apps
appsfeatures
appsforwebsites
appwindow appwindow
Appwiz
appx appx
appxmanifest appxmanifest
APSTUDIO APSTUDIO
@ -102,6 +116,8 @@ asm
asmx asmx
aspnet aspnet
aspx aspx
assignedaccess
asyncwebview
ASYNCWINDOWPLACEMENT ASYNCWINDOWPLACEMENT
ASYNCWINDOWPOS ASYNCWINDOWPOS
atl atl
@ -120,7 +136,9 @@ autocomplete
autogenerated autogenerated
autogenerates autogenerates
AUTOHIDE AUTOHIDE
automaticfiledownloads
AUTOMATIONPROPERTIES AUTOMATIONPROPERTIES
autoplay
Autorun Autorun
AUTOSIZECOLUMNS AUTOSIZECOLUMNS
autoupdate autoupdate
@ -129,8 +147,10 @@ AWAYMODE
azurecr azurecr
azurewebsites azurewebsites
backend backend
backgroundapps
backtracer backtracer
bak bak
batterysaver
bbwe bbwe
bcc bcc
bck bck
@ -155,6 +175,7 @@ bla
blockquote blockquote
blog blog
BLUEGRAY BLUEGRAY
bluetooth
BLURBEHIND BLURBEHIND
BLURREGION BLURREGION
bmi bmi
@ -165,11 +186,15 @@ Bokm
BOKMAL BOKMAL
Bools Bools
bootstrapper bootstrapper
Bopomofo
BOTTOMALIGN BOTTOMALIGN
BPBF BPBF
bpmf
bpmfime
bpp bpp
bricelam bricelam
BRIGHTGREEN BRIGHTGREEN
broadfilesystemaccess
Browsable Browsable
bsd bsd
bstr bstr
@ -186,7 +211,11 @@ buildtransitive
BValue BValue
bytearray bytearray
callbackptr callbackptr
callhistory
Cangjie
cangjieime
CANRENAME CANRENAME
capitalized
Captureascreenshot Captureascreenshot
CAPTURECHANGED CAPTURECHANGED
CASESENSITIVE CASESENSITIVE
@ -203,6 +232,7 @@ CDeclaration
CDEF CDEF
cdpx cdpx
cdpxwin cdpxwin
CECEE
CENTERALIGN CENTERALIGN
cfg cfg
cguid cguid
@ -219,6 +249,8 @@ CHILDWINDOW
chrdavis chrdavis
chrono chrono
Chrzan Chrzan
chrzan
chsime
CHT CHT
CImage CImage
cinttypes cinttypes
@ -234,6 +266,8 @@ CLIENTPULL
clientside clientside
CLIPCHILDREN CLIPCHILDREN
CLIPSIBLINGS CLIPSIBLINGS
CLogo
closedcaptioning
clrcall clrcall
Cls Cls
CLSCTX CLSCTX
@ -260,6 +294,7 @@ COINIT
colorconv colorconv
colorhistory colorhistory
colorhistorylimit colorhistorylimit
colorfilter
colorpicker colorpicker
COLORREF COLORREF
colorscheme colorscheme
@ -281,6 +316,7 @@ concrt
config config
CONFLICTINGMODIFIERKEY CONFLICTINGMODIFIERKEY
CONFLICTINGMODIFIERSHORTCUT CONFLICTINGMODIFIERSHORTCUT
connecteddevices
Connectquickaction Connectquickaction
CONOUT CONOUT
Consolas Consolas
@ -319,6 +355,9 @@ cref
CRename CRename
critsec critsec
crlf crlf
CRM
crmcustomerinsightsapp
crossdevice
CRSEL CRSEL
crutkas crutkas
CSearch CSearch
@ -346,10 +385,12 @@ Ctrls
Ctx Ctx
CUI CUI
currentculture currentculture
cursorandpointersize
CURSORINFO CURSORINFO
cursorpos cursorpos
customaction customaction
CUSTOMACTIONTEST CUSTOMACTIONTEST
customdevices
cvd cvd
cwchar cwchar
cwd cwd
@ -370,8 +411,11 @@ DARKPURPLE
DARKRED DARKRED
DARKTEAL DARKTEAL
DARKYELLOW DARKYELLOW
Dataflows
datausage
Datavalue Datavalue
DATAW DATAW
dateandtime
davidegiacometti davidegiacometti
Dayof Dayof
dbdfc dbdfc
@ -389,6 +433,7 @@ declspec
decltype decltype
Dedup Dedup
Deduplicate Deduplicate
defaultapps
DEFAULTCOLOR DEFAULTCOLOR
defaultcommand defaultcommand
DEFAULTFLAGS DEFAULTFLAGS
@ -423,11 +468,17 @@ DEU
devblogs devblogs
devdocs devdocs
devenum devenum
deviceencryption
devicemanagenent
DEVMON DEVMON
DFactory DFactory
DHCP
Dialpad
diffing diffing
difftime difftime
dimm dimm
directaccess
dirname
dirs dirs
DISABLEASACTIONKEY DISABLEASACTIONKEY
dispid dispid
@ -450,11 +501,15 @@ dllhost
dllmain dllmain
DNLEN DNLEN
docsmsft docsmsft
Dns
doctype doctype
domainlexicon
DONTVALIDATEPATH DONTVALIDATEPATH
dotnet dotnet
DOUBLEBUFFER DOUBLEBUFFER
DOverlay DOverlay
downlevel
downloadmaps
DOWNLOADONLY DOWNLOADONLY
dpi dpi
DPICHANGED DPICHANGED
@ -475,6 +530,7 @@ dupenv
dutil dutil
DVASPECT DVASPECT
DVASPECTINFO DVASPECTINFO
DVR
DVTARGETDEVICE DVTARGETDEVICE
DWindow DWindow
DWINRT DWINRT
@ -493,7 +549,45 @@ dword
dworigin dworigin
dwrite dwrite
dxgi dxgi
dynamiclock
EABF
EAC
EACB
EACC
EADA
EADB
EADF
EAE
EAEE
EAEF
EAF
EAFC
EAFD
Easeof Easeof
easeofaccess
eb
EBC
EBD
EBDA
EBE
EBEC
EBEE
EBEF
EBF
EBFC
ECAA
ECAB
ECAC
ECAF
ECCA
ECCB
ECCD
ECDC
ECDE
ECDF
ECEB
ECED
ECEE
ecef ecef
ecount ecount
EDB EDB
@ -508,6 +602,7 @@ efgh
EFile EFile
egistry egistry
elseif elseif
emailandaccounts
Emoji Emoji
emptyrecyclebin emptyrecyclebin
ENABLEDPOPUP ENABLEDPOPUP
@ -574,6 +669,8 @@ EXTENDEDKEY
EXTENDEDVERBS EXTENDEDVERBS
EXTENIONONLY EXTENIONONLY
EXTENSIONONLY EXTENSIONONLY
eyecontrol
eyetracker
FAFAFA FAFAFA
fallthrough fallthrough
fancyzones fancyzones
@ -600,6 +697,8 @@ FILETYPE
FILEVERSION FILEVERSION
Filterkeyboard Filterkeyboard
finalizer finalizer
findfast
findmydevice
findstr findstr
FIXEDFILEINFO FIXEDFILEINFO
FLASHZONES FLASHZONES
@ -633,6 +732,8 @@ gabime
GAC GAC
gacutil gacutil
Gamebar Gamebar
gamedvr
gamemode
GBs GBs
gcnew gcnew
gdi gdi
@ -657,6 +758,7 @@ gmx
GNumber GNumber
google google
GPTR GPTR
Grayscale
gui gui
guiddef guiddef
GUITHREADINFO GUITHREADINFO
@ -694,6 +796,7 @@ HHmmss
HHOOK HHOOK
HICON HICON
HIDEWINDOW HIDEWINDOW
highcontrast
HIMAGELIST HIMAGELIST
himl himl
hinst hinst
@ -722,6 +825,7 @@ hostname
hotkeycontrol hotkeycontrol
hotkeys hotkeys
hotlight hotlight
hotspot
HPAINTBUFFER HPAINTBUFFER
hpj hpj
hpp hpp
@ -848,6 +952,7 @@ impl
IMulti IMulti
INDEXTOSTATEIMAGEMASK INDEXTOSTATEIMAGEMASK
indierawk indierawk
Inetcpl
Infobar Infobar
INFOEXAMPLE INFOEXAMPLE
Infotip Infotip
@ -960,6 +1065,7 @@ IView
IVirtual IVirtual
IWeb IWeb
IXml IXml
IWindows
ixx ixx
IZone IZone
IZoom IZoom
@ -974,11 +1080,13 @@ jpe
jpeg jpeg
jpg jpg
JPN JPN
jpnime
json json
JSONOf JSONOf
jsonval jsonval
jsoref jsoref
JSX JSX
jsx
junja junja
jxr jxr
jyuwono jyuwono
@ -993,6 +1101,7 @@ KEYBOARDMANAGEREDITOR
keyboardmanagerstate keyboardmanagerstate
keyboardmanagerui keyboardmanagerui
keycode keycode
keyconfig
keydown keydown
keydropdowncontrol keydropdowncontrol
keyevent keyevent
@ -1011,9 +1120,13 @@ LAlt
Lambson Lambson
lamotile lamotile
langword langword
langword
Lastdevice Lastdevice
LASTEXITCODE LASTEXITCODE
Laute Laute
launchfaceenrollment
launchfingerprintenrollment
laute
laviusmotileng laviusmotileng
LAYOUTRTL LAYOUTRTL
LBUTTON LBUTTON
@ -1064,6 +1177,7 @@ LOCALPACKAGE
localport localport
localtime localtime
LOCATIONCHANGE LOCATIONCHANGE
lockscreen
Lockyour Lockyour
logconsole logconsole
logfile logfile
@ -1185,7 +1299,11 @@ MINMAXINFO
Miracast Miracast
MJPG MJPG
mkdir mkdir
mmi Mlcfg
MLogo
MMI
Mmsys
mobilehotspot
mockapi mockapi
MODECHANGE MODECHANGE
moderncop moderncop
@ -1197,11 +1315,13 @@ MONITORINFOEXW
monitorinfof monitorinfof
Monthand Monthand
Moq Moq
moredetails
MOUSEACTIVATE MOUSEACTIVATE
MOUSEHWHEEL MOUSEHWHEEL
MOUSEINPUT MOUSEINPUT
MOUSEMOVE MOUSEMOVE
MOUSESWITCH MOUSESWITCH
mousetouchpad
MOUSEWHEEL MOUSEWHEEL
MOVESIZEEND MOVESIZEEND
MOVESIZESTART MOVESIZESTART
@ -1253,6 +1373,7 @@ nameof
NAMEONLY NAMEONLY
namespace namespace
NATIVEFNTCTL NATIVEFNTCTL
navbar
NCACTIVATE NCACTIVATE
ncc ncc
NCCALCSIZE NCCALCSIZE
@ -1277,10 +1398,13 @@ ndp
Nefario Nefario
neq neq
NESW NESW
netconnections
netcore netcore
netcoreapp netcoreapp
Netcpl
netframework netframework
NETFX NETFX
netsetup
netsh netsh
netstandard netstandard
Neue Neue
@ -1289,9 +1413,11 @@ newitem
newpath newpath
newrow newrow
Newtonsoft Newtonsoft
nfctransactions
niels niels
nielslaute nielslaute
NIF NIF
nightlight
NLD NLD
nlog nlog
NLSTEXT NLSTEXT
@ -1356,6 +1482,7 @@ NUMLOCK
NUMPAD NUMPAD
nunit nunit
Nvidia Nvidia
nwc
NWSE NWSE
Objbase Objbase
OBJID OBJID
@ -1388,6 +1515,8 @@ opensource
Openthe Openthe
openxmlformats openxmlformats
OPTIMIZEFORINVOKE OPTIMIZEFORINVOKE
optin
optionalfeatures
OPTIONSGROUP OPTIONSGROUP
ORPHANEDDIALOGTITLE ORPHANEDDIALOGTITLE
oss oss
@ -1396,6 +1525,8 @@ ostream
ostringstream ostringstream
OSVERSIONINFOEXW OSVERSIONINFOEXW
otating otating
otheroptions
otherusers
OUTOFCONTEXT OUTOFCONTEXT
OUTOFMEMORY OUTOFMEMORY
Outptr Outptr
@ -1444,6 +1575,10 @@ pgp
pguid pguid
phbm phbm
phbmp phbmp
Phishing
phonecalls
php
phptest
phwnd phwnd
pici pici
pid pid
@ -1473,11 +1608,14 @@ popd
popup popup
POPUPWINDOW POPUPWINDOW
posix posix
powerappscds
powercfg
powerlauncher powerlauncher
powerpreview powerpreview
powerrename powerrename
POWERRENAMETEST POWERRENAMETEST
powershell powershell
powersleep
powertoy powertoy
powertoysinterop powertoysinterop
powertoyssetup powertoyssetup
@ -1561,7 +1699,13 @@ Queryable
QUERYENDSESSION QUERYENDSESSION
QUERYOPEN QUERYOPEN
QUEUESYNC QUEUESYNC
quickime
QUICKLAYOUTSWITCH QUICKLAYOUTSWITCH
quiethours
quietmomentsgame
quietmomentshome
quietmomentspresentation
quietmomentsscheduled
qwertyuiopasdfghjklzxcvbnm qwertyuiopasdfghjklzxcvbnm
qword qword
qwrtyuiopsghjklzxvnm qwrtyuiopsghjklzxvnm
@ -1599,6 +1743,8 @@ REFIID
REGCLS REGCLS
regedit regedit
regex regex
regionformatting
regionlanguage
REGISTERCLASSFAILED REGISTERCLASSFAILED
Registery Registery
registrypath registrypath
@ -1610,6 +1756,7 @@ remappings
REMAPSUCCESSFUL REMAPSUCCESSFUL
REMAPUNSUCCESSFUL REMAPUNSUCCESSFUL
Remotable Remotable
remotedesktop
REMOTEDISPLAY REMOTEDISPLAY
REMOTESESSION REMOTESESSION
Removelnk Removelnk
@ -1628,6 +1775,7 @@ Resizable
resizers resizers
resmimetype resmimetype
RESOURCEID RESOURCEID
restartoptions
RESTORESIZE RESTORESIZE
RESTORETOMAXIMIZED RESTORETOMAXIMIZED
restrictedcapabilities restrictedcapabilities
@ -1658,6 +1806,7 @@ royvou
Rpc Rpc
RRF RRF
rshift rshift
RSHIFT
Rsp Rsp
rst rst
Rstrtmgr Rstrtmgr
@ -1669,6 +1818,7 @@ ruleset
RUNACTIVEXCTLS RUNACTIVEXCTLS
runas runas
Rundialogbox Rundialogbox
rundll
rungameid rungameid
RUNLEVEL RUNLEVEL
runsettings runsettings
@ -1686,17 +1836,21 @@ safeprojectname
SAMEKEYPREVIOUSLYMAPPED SAMEKEYPREVIOUSLYMAPPED
SAMESHORTCUTPREVIOUSLYMAPPED SAMESHORTCUTPREVIOUSLYMAPPED
SAVEFAILED SAVEFAILED
savelocations
scancode scancode
scanled scanled
schedtasks
Scn Scn
SCOOBE SCOOBE
SCOPEID SCOPEID
screenrotation
screenshot screenshot
scrollable scrollable
scrollviewer scrollviewer
sddl sddl
sdk sdk
SDKDDK SDKDDK
SDNS
searchbox searchbox
SEARCHFOR SEARCHFOR
SEARCHREPLACEGROUP SEARCHREPLACEGROUP
@ -1710,6 +1864,7 @@ serializationexception
serializer serializer
serizalization serizalization
serverside serverside
sessioncleanup
SETCONTEXT SETCONTEXT
setcursor setcursor
setenv setenv
@ -1773,6 +1928,8 @@ sidepanel
siex siex
SIGABRT SIGABRT
sigdn sigdn
Signin
signinoptions
signtool signtool
SINGLEKEY SINGLEKEY
singlekeyremapcontrol singlekeyremapcontrol
@ -1807,6 +1964,8 @@ spdo
spdth spdth
spec'ing spec'ing
specialfolder specialfolder
speechrecognition
speechtyping
spesi spesi
splitwstring splitwstring
sppd sppd
@ -1858,9 +2017,12 @@ stdout
STEPIT STEPIT
stgm stgm
STGMEDIUM STGMEDIUM
Sticpl
stoi stoi
stol stol
stoll stoll
storagepolicies
storagesense
stoul stoul
stoull stoull
strcmp strcmp
@ -1886,6 +2048,7 @@ SUBLANG
subquery subquery
substr substr
Superbar Superbar
surfacehub
sut sut
SVE SVE
svg svg
@ -1903,6 +2066,7 @@ SYSCHAR
SYSCOLORCHANGE SYSCOLORCHANGE
SYSCOMMAND SYSCOMMAND
SYSDEADCHAR SYSDEADCHAR
Sysdm
SYSICONINDEX SYSICONINDEX
SYSKEY SYSKEY
syskeydown syskeydown
@ -1912,7 +2076,12 @@ SYSMENU
systemd systemd
SYSTEMTIME SYSTEMTIME
Tadele Tadele
sz
tabletmode
tadele
Tahoma Tahoma
talenthrcore
talktocortana
talynone talynone
TApp TApp
TApplication TApplication
@ -1956,6 +2125,8 @@ thre
tif tif
TILEDWINDOW TILEDWINDOW
timediff timediff
timedate
Timeline
TIMERID TIMERID
timeunion timeunion
timeutil timeutil
@ -1975,6 +2146,7 @@ tooltip
toolwindow toolwindow
TOPDOWNDIB TOPDOWNDIB
toplevel toplevel
touchpad
toupper toupper
Towindow Towindow
towlower towlower
@ -1984,6 +2156,8 @@ traies
TRAYMOUSEMESSAGE TRAYMOUSEMESSAGE
TRK TRK
trl trl
trueplay
truetype
trunc trunc
TStr TStr
tsx tsx
@ -1999,6 +2173,7 @@ UAC
UAL UAL
uap uap
udit udit
udp
UIA UIA
Uid Uid
uifabric uifabric
@ -2052,6 +2227,8 @@ Uptool
upvote upvote
uri uri
url url
usagedetails
usb
USEDEFAULT USEDEFAULT
USEFILEATTRIBUTES USEFILEATTRIBUTES
USERDATA USERDATA
@ -2091,6 +2268,7 @@ Versioning
VFT VFT
vid vid
VIDEOINFOHEADER VIDEOINFOHEADER
videoplayback
viewbox viewbox
viewmodel viewmodel
virtualization virtualization
@ -2102,7 +2280,10 @@ VKey
VKTAB VKTAB
vmax vmax
vmin vmin
voiceactivation
Voicemail
VOS VOS
vpn
VREDRAW VREDRAW
VSC VSC
VSCBD VSCBD
@ -2140,11 +2321,16 @@ webclient
webpack webpack
webpage webpage
website website
webview
wekyb wekyb
Wevtapi Wevtapi
Wgpocpl
Whichdoes Whichdoes
whitespaces whitespaces
WIC WIC
Wifi
wificalling
wifisettings
wifstream wifstream
wih wih
wiki wiki
@ -2155,6 +2341,7 @@ winapi
wincolor wincolor
windef windef
windevbuildagents windevbuildagents
windir
Windowcontrols Windowcontrols
WINDOWCREATED WINDOWCREATED
WINDOWEDGE WINDOWEDGE
@ -2162,10 +2349,14 @@ WINDOWNAME
WINDOWPLACEMENT WINDOWPLACEMENT
WINDOWPOSCHANGED WINDOWPOSCHANGED
WINDOWPOSCHANGING WINDOWPOSCHANGING
Windowsapp windowsanywhere
windowsapp
WINDOWSBUILDNUMBER WINDOWSBUILDNUMBER
windowsdefender
windowsdesktop windowsdesktop
windowsinsider
windowssearch windowssearch
windowsupdate
windowsx windowsx
windowwalker windowwalker
winerror winerror
@ -2233,6 +2424,8 @@ wsz
wtoi wtoi
WTS WTS
WTSAT WTSAT
wu
wubi
Wwan Wwan
www www
wxs wxs
@ -2241,6 +2434,8 @@ xaml
XAttribute XAttribute
xbf xbf
XBind XBind
Xbox
xboxnetworking
XBUTTON XBUTTON
XBUTTONDBLCLK XBUTTONDBLCLK
XBUTTONDOWN XBUTTONDOWN
@ -2272,6 +2467,8 @@ YIncrement
yinwang yinwang
yml yml
YOffset YOffset
yourinfo
YourUserName
YStr YStr
YUY YUY
YUYV YUYV

View File

@ -131,6 +131,9 @@ build:
- 'modules\launcher\Plugins\Microsoft.Plugin.Program\ManagedTelemetry.dll' - 'modules\launcher\Plugins\Microsoft.Plugin.Program\ManagedTelemetry.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry\Microsoft.PowerToys.Run.Plugin.Registry.dll' - 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry\Microsoft.PowerToys.Run.Plugin.Registry.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry\ManagedTelemetry.dll' - 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.Registry\ManagedTelemetry.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\ManagedTelemetry.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll'
- 'modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\WindowsSettings.json'
- 'modules\launcher\Plugins\Microsoft.Plugin.Shell\Microsoft.Plugin.Shell.dll' - 'modules\launcher\Plugins\Microsoft.Plugin.Shell\Microsoft.Plugin.Shell.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Shell\ManagedTelemetry.dll' - 'modules\launcher\Plugins\Microsoft.Plugin.Shell\ManagedTelemetry.dll'
- 'modules\launcher\Plugins\Microsoft.Plugin.Uri\Microsoft.Plugin.Uri.dll' - 'modules\launcher\Plugins\Microsoft.Plugin.Uri\Microsoft.Plugin.Uri.dll'

View File

@ -154,6 +154,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerLauncher", "src\module
{C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0} = {C21BFF9C-2C99-4B5F-B7C9-A5E6DDDB37B0}
{0351ADA4-0C32-4652-9BA0-41F7B602372B} = {0351ADA4-0C32-4652-9BA0-41F7B602372B} {0351ADA4-0C32-4652-9BA0-41F7B602372B} = {0351ADA4-0C32-4652-9BA0-41F7B602372B}
{787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} {787B8AA6-CA93-4C84-96FE-DF31110AD1C4} = {787B8AA6-CA93-4C84-96FE-DF31110AD1C4}
{5043CECE-E6A7-4867-9CBE-02D27D83747A} = {5043CECE-E6A7-4867-9CBE-02D27D83747A}
{F8B870EB-D5F5-45BA-9CF7-A5C459818820} = {F8B870EB-D5F5-45BA-9CF7-A5C459818820} {F8B870EB-D5F5-45BA-9CF7-A5C459818820} = {F8B870EB-D5F5-45BA-9CF7-A5C459818820}
{74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {74F1B9ED-F59C-4FE7-B473-7B453E30837E} {74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {74F1B9ED-F59C-4FE7-B473-7B453E30837E}
{4BABF3FE-3451-42FD-873F-3C332E18DCEF} = {4BABF3FE-3451-42FD-873F-3C332E18DCEF} {4BABF3FE-3451-42FD-873F-3C332E18DCEF} = {4BABF3FE-3451-42FD-873F-3C332E18DCEF}
@ -343,6 +344,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShortcutGuideModuleInterfac
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShortcutGuide", "src\modules\ShortcutGuide\ShortcutGuide\ShortcutGuide.vcxproj", "{2EDB3EB4-FA92-4BFF-B2D8-566584837231}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShortcutGuide", "src\modules\ShortcutGuide\ShortcutGuide\ShortcutGuide.vcxproj", "{2EDB3EB4-FA92-4BFF-B2D8-566584837231}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.PowerToys.Run.Plugin.WindowsSettings", "src\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj", "{5043CECE-E6A7-4867-9CBE-02D27D83747A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64 Debug|x64 = Debug|x64
@ -699,6 +702,10 @@ Global
{2EDB3EB4-FA92-4BFF-B2D8-566584837231}.Debug|x64.Build.0 = Debug|x64 {2EDB3EB4-FA92-4BFF-B2D8-566584837231}.Debug|x64.Build.0 = Debug|x64
{2EDB3EB4-FA92-4BFF-B2D8-566584837231}.Release|x64.ActiveCfg = Release|x64 {2EDB3EB4-FA92-4BFF-B2D8-566584837231}.Release|x64.ActiveCfg = Release|x64
{2EDB3EB4-FA92-4BFF-B2D8-566584837231}.Release|x64.Build.0 = Release|x64 {2EDB3EB4-FA92-4BFF-B2D8-566584837231}.Release|x64.Build.0 = Release|x64
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.ActiveCfg = Debug|x64
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Debug|x64.Build.0 = Debug|x64
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|x64.ActiveCfg = Release|x64
{5043CECE-E6A7-4867-9CBE-02D27D83747A}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -805,6 +812,7 @@ Global
{106CBECA-0701-4FC3-838C-9DF816A19AE2} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC} {106CBECA-0701-4FC3-838C-9DF816A19AE2} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{2D604C07-51FC-46BB-9EB7-75AECC7F5E81} = {106CBECA-0701-4FC3-838C-9DF816A19AE2} {2D604C07-51FC-46BB-9EB7-75AECC7F5E81} = {106CBECA-0701-4FC3-838C-9DF816A19AE2}
{2EDB3EB4-FA92-4BFF-B2D8-566584837231} = {106CBECA-0701-4FC3-838C-9DF816A19AE2} {2EDB3EB4-FA92-4BFF-B2D8-566584837231} = {106CBECA-0701-4FC3-838C-9DF816A19AE2}
{5043CECE-E6A7-4867-9CBE-02D27D83747A} = {4AFC9975-2456-4C70-94A4-84073C1CED93}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0} SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@ -298,6 +298,10 @@
<Directory Id="SystemPluginFolder" Name="System"> <Directory Id="SystemPluginFolder" Name="System">
<Directory Id="SystemImagesFolder" Name="Images" /> <Directory Id="SystemImagesFolder" Name="Images" />
</Directory> </Directory>
<Directory Id="WindowsSettingsPluginFolder" Name="Microsoft.PowerToys.Run.Plugin.WindowsSettings">
<Directory Id="WindowsSettingsImagesFolder" Name="Images" />
<Directory Id="WindowsSettingsLanguagesFolder" Name="Languages" />
</Directory>
</Directory> </Directory>
</Directory> </Directory>
</Directory> </Directory>
@ -911,7 +915,7 @@
<Fragment> <Fragment>
<!-- Resource directories should be added only if the installer is built on the build farm --> <!-- Resource directories should be added only if the installer is built on the build farm -->
<?ifdef env.IsPipeline?> <?ifdef env.IsPipeline?>
<?foreach ParentDirectory in LauncherInstallFolder;FancyZonesInstallFolder;ImageResizerInstallFolder;ColorPickerInstallFolder;FileExplorerPreviewInstallFolder;CalculatorPluginFolder;FolderPluginFolder;ProgramPluginFolder;ShellPluginFolder;IndexerPluginFolder;UnitConverterPluginFolder;UriPluginFolder;WindowWalkerPluginFolder;RegistryPluginFolder;VSCodeWorkspacesPluginFolder;ServicePluginFolder;SystemPluginFolder?> <?foreach ParentDirectory in LauncherInstallFolder;FancyZonesInstallFolder;ImageResizerInstallFolder;ColorPickerInstallFolder;FileExplorerPreviewInstallFolder;CalculatorPluginFolder;FolderPluginFolder;ProgramPluginFolder;ShellPluginFolder;IndexerPluginFolder;UnitConverterPluginFolder;UriPluginFolder;WindowWalkerPluginFolder;RegistryPluginFolder;VSCodeWorkspacesPluginFolder;ServicePluginFolder;SystemPluginFolder;WindowsSettingsPluginFolder?>
<DirectoryRef Id="$(var.ParentDirectory)"> <DirectoryRef Id="$(var.ParentDirectory)">
<!-- Resource file directories --> <!-- Resource file directories -->
<?foreach Language in $(var.LocLanguageList)?> <?foreach Language in $(var.LocLanguageList)?>
@ -1002,6 +1006,9 @@
<Component Id="Launcher_System_$(var.IdSafeLanguage)_Component" Directory="Resource$(var.IdSafeLanguage)SystemPluginFolder"> <Component Id="Launcher_System_$(var.IdSafeLanguage)_Component" Directory="Resource$(var.IdSafeLanguage)SystemPluginFolder">
<File Id="Launcher_System_$(var.IdSafeLanguage)_File" Source="$(var.BinX64Dir)modules\launcher\Plugins\System\$(var.Language)\Microsoft.PowerToys.Run.Plugin.System.resources.dll" /> <File Id="Launcher_System_$(var.IdSafeLanguage)_File" Source="$(var.BinX64Dir)modules\launcher\Plugins\System\$(var.Language)\Microsoft.PowerToys.Run.Plugin.System.resources.dll" />
</Component> </Component>
<!--<Component Id="Launcher_WindowsSettings_$(var.IdSafeLanguage)_Component" Directory="Resource$(var.IdSafeLanguage)WindowsSettingsPluginFolder">
<File Id="Launcher_WindowsSettings_$(var.IdSafeLanguage)_File" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\$(var.Language)\Microsoft.PowerToys.Run.Plugin.WindowsSettings.resources.dll" />
</Component>-->
<?undef IdSafeLanguage?> <?undef IdSafeLanguage?>
<?endforeach?> <?endforeach?>
<?endif?> <?endif?>
@ -1184,6 +1191,17 @@
<File Id="SystemSleepLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\System\Images\sleep.light.png" /> <File Id="SystemSleepLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\System\Images\sleep.light.png" />
</Component> </Component>
<!-- WindowsSettings Plugin -->
<Component Id="WindowsSettingsComponent" Directory="WindowsSettingsPluginFolder" Guid="ACEC2B6D-8E95-43BF-A1E4-137E95F07C96">
<?foreach File in plugin.json;Microsoft.PowerToys.Run.Plugin.WindowsSettings.deps.json;Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll;ManagedTelemetry.dll?>
<File Id="WindowsSettings_$(var.File)" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\$(var.File)" />
<?endforeach?>
</Component>
<Component Id="WindowsSettingsImagesComponent" Directory="WindowsSettingsImagesFolder" Guid="E1CE33A7-6318-4FA6-A46B-9302A00BD6AA">
<File Id="WindowsSettingsDarkIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\Images\WindowsSettings.dark.png" />
<File Id="WindowsSettingsLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\Images\WindowsSettings.light.png" />
</Component>
</ComponentGroup> </ComponentGroup>
</Fragment> </Fragment>
</Wix> </Wix>

View File

@ -0,0 +1,66 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
{
/// <summary>
/// A windows setting
/// </summary>
internal class WindowsSetting
{
/// <summary>
/// Initializes a new instance of the <see cref="WindowsSetting"/> class.
/// </summary>
public WindowsSetting()
{
Name = string.Empty;
Area = string.Empty;
Command = string.Empty;
Type = string.Empty;
}
/// <summary>
/// Gets or sets the name of this setting.
/// </summary>
public string Name { get; set; }
/// <summary>
/// Gets or sets the area of this setting.
/// </summary>
public string Area { get; set; }
/// <summary>
/// Gets or sets the command of this setting.
/// </summary>
public string Command { get; set; }
/// <summary>
/// Gets or sets the type of the windows setting.
/// </summary>
public string Type { get; set; }
/// <summary>
/// Gets or sets the alternative names of this setting.
/// </summary>
public IEnumerable<string>? AltNames { get; set; }
/// <summary>
/// Gets or sets a additional note of this settings.
/// <para>(e.g. why is not supported on your system)</para>
/// </summary>
public string? Note { get; set; }
/// <summary>
/// Gets or sets the minimum need Windows build for this setting.
/// </summary>
public uint? IntroducedInBuild { get; set; }
/// <summary>
/// Gets or sets the Windows build since this settings is not longer present.
/// </summary>
public uint? DeprecatedInBuild { get; set; }
}
}

View File

@ -0,0 +1,71 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Input;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
using Wox.Plugin;
using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with context menu entries
/// </summary>
internal static class ContextMenuHelper
{
/// <summary>
/// Return a list with all context menu entries for the given <see cref="Result"/>
/// <para>Symbols taken from <see href="https://docs.microsoft.com/en-us/windows/uwp/design/style/segoe-ui-symbol-font"/></para>
/// </summary>
/// <param name="result">The result for the context menu entires</param>
/// <param name="assemblyName">The name of the this assembly</param>
/// <returns>A list with context menu entries</returns>
internal static List<ContextMenuResult> GetContextMenu(in Result result, in string assemblyName)
{
if (!(result?.ContextData is WindowsSetting entry))
{
return new List<ContextMenuResult>(0);
}
var list = new List<ContextMenuResult>(1)
{
new ContextMenuResult
{
AcceleratorKey = Key.C,
AcceleratorModifiers = ModifierKeys.Control,
Action = _ => TryToCopyToClipBoard(entry.Command),
FontFamily = "Segoe MDL2 Assets",
Glyph = "\xE8C8", // E8C8 => Symbol: Copy
PluginName = assemblyName,
Title = $"{Resources.CopyCommand} (Ctrl+C)",
},
};
return list;
}
/// <summary>
/// Copy the given text to the clipboard
/// </summary>
/// <param name="text">The text to copy to the clipboard</param>
/// <returns><see langword="true"/>The text successful copy to the clipboard, otherwise <see langword="false"/></returns>
private static bool TryToCopyToClipBoard(in string text)
{
try
{
Clipboard.Clear();
Clipboard.SetText(text);
return true;
}
catch (Exception exception)
{
Log.Exception("Can't copy to clipboard", exception, typeof(Main));
return false;
}
}
}
}

View File

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with the JSON file that contains all Windows settings
/// </summary>
internal static class JsonSettingsListHelper
{
/// <summary>
/// The name of the file that contains all settings for the query
/// </summary>
private const string _settingsFile = "WindowsSettings.json";
/// <summary>
/// Read all possible Windows settings.
/// </summary>
/// <returns>A list with all possible windows settings.</returns>
internal static IEnumerable<WindowsSetting> ReadAllPossibleSettings()
{
var assembly = Assembly.GetExecutingAssembly();
var type = assembly.GetTypes().FirstOrDefault(x => x.Name == nameof(Main));
IEnumerable<WindowsSetting>? settingsList = null;
try
{
var resourceName = $"{type?.Namespace}.{_settingsFile}";
using var stream = assembly.GetManifestResourceStream(resourceName);
if (stream is null)
{
throw new Exception("stream is null");
}
var options = new JsonSerializerOptions();
options.Converters.Add(new JsonStringEnumConverter());
using var reader = new StreamReader(stream);
var text = reader.ReadToEnd();
settingsList = JsonSerializer.Deserialize<IEnumerable<WindowsSetting>>(text, options);
}
catch (Exception exception)
{
Log.Exception("Error loading settings JSON file", exception, typeof(Main));
}
return settingsList ?? Enumerable.Empty<WindowsSetting>();
}
}
}

View File

@ -0,0 +1,188 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
using Wox.Plugin;
using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with results
/// </summary>
internal static class ResultHelper
{
/// <summary>
/// Return a list with <see cref="Result"/>s, based on the given list.
/// </summary>
/// <param name="list">The original result list to convert.</param>
/// <param name="iconPath">The path to the icon of each entry.</param>
/// <returns>A list with <see cref="Result"/>.</returns>
internal static List<Result> GetResultList(
in IEnumerable<WindowsSetting> list,
string query,
in string iconPath)
{
var resultList = new List<Result>(list.Count());
foreach (var entry in list)
{
var result = new Result
{
Action = (_) => DoOpenSettingsAction(entry),
IcoPath = iconPath,
SubTitle = $"{Resources.Area} \"{entry.Area}\" {Resources.SubtitlePreposition} {entry.Type}",
Title = entry.Name,
ContextData = entry,
};
AddOptionalToolTip(entry, result);
resultList.Add(result);
}
SetScores(resultList, query);
return resultList;
}
/// <summary>
/// Add a tool-tip to the given <see cref="Result"/>, based o the given <see cref="IWindowsSetting"/>.
/// </summary>
/// <param name="entry">The <see cref="WindowsSetting"/> that contain informations for the tool-tip.</param>
/// <param name="result">The <see cref="Result"/> that need a tool-tip.</param>
private static void AddOptionalToolTip(WindowsSetting entry, Result result)
{
var toolTipText = new StringBuilder();
toolTipText.AppendLine($"{Resources.Application}: {entry.Type}");
toolTipText.AppendLine($"{Resources.Area}: {entry.Area}");
if (entry.AltNames != null && entry.AltNames.Any())
{
var altList = entry.AltNames.Aggregate((current, next) => $"{current}, {next}");
toolTipText.AppendLine($"{Resources.AlternativeName}: {altList}");
}
toolTipText.Append($"{Resources.Command}: {entry.Command}");
if (!string.IsNullOrEmpty(entry.Note))
{
toolTipText.AppendLine(string.Empty);
toolTipText.AppendLine(string.Empty);
toolTipText.Append($"{Resources.Note}: {entry.Note}");
}
result.ToolTipData = new ToolTipData(entry.Name, toolTipText.ToString());
}
/// <summary>
/// Open the settings page of the given <see cref="IWindowsSetting"/>.
/// </summary>
/// <param name="entry">The <see cref="WindowsSetting"/> that contain the information to open the setting on command level.</param>
/// <returns><see langword="true"/> if the settings could be opened, otherwise <see langword="false"/>.</returns>
private static bool DoOpenSettingsAction(WindowsSetting entry)
{
ProcessStartInfo processStartInfo;
var command = entry.Command;
if (command.Contains("%windir%", StringComparison.InvariantCultureIgnoreCase))
{
var windowsFolder = Environment.GetFolderPath(Environment.SpecialFolder.Windows);
command = command.Replace("%windir%", windowsFolder, StringComparison.InvariantCultureIgnoreCase);
}
if (command.Contains(' '))
{
var commandSplit = command.Split(' ');
var file = commandSplit.FirstOrDefault();
var arguments = command[file.Length..].TrimStart();
processStartInfo = new ProcessStartInfo(file, arguments)
{
UseShellExecute = false,
};
}
else
{
processStartInfo = new ProcessStartInfo(command)
{
UseShellExecute = true,
};
}
try
{
Process.Start(processStartInfo);
return true;
}
catch (Exception exception)
{
Log.Exception("can't open settings", exception, typeof(ResultHelper));
return false;
}
}
/// <summary>
/// Set the score (known as order number or ranking number)
/// for all <see cref="Results"/> in the given list, based on the given query.
/// </summary>
/// <param name="resultList">A list with <see cref="Result"/>s that need scores.</param>
/// <param name="query">The query to calculated the score for the <see cref="Result"/>s.</param>
private static void SetScores(IEnumerable<Result> resultList, string query)
{
var lowScore = 1_000;
var mediumScore = 5_000;
var highScore = 10_000;
foreach (var result in resultList)
{
if (!(result.ContextData is WindowsSetting windowsSetting))
{
continue;
}
if (windowsSetting.Name.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
{
result.Score = highScore--;
continue;
}
// If query starts with second or next word of name, set score.
if (windowsSetting.Name.Contains($" {query}", StringComparison.CurrentCultureIgnoreCase))
{
result.Score = mediumScore--;
continue;
}
if (windowsSetting.Area.StartsWith(query, StringComparison.CurrentCultureIgnoreCase))
{
result.Score = lowScore--;
continue;
}
if (windowsSetting.AltNames is null)
{
result.Score = lowScore--;
continue;
}
if (windowsSetting.AltNames.Any(x => x.StartsWith(query, StringComparison.CurrentCultureIgnoreCase)))
{
result.Score = mediumScore--;
continue;
}
result.Score = lowScore--;
}
}
}
}

View File

@ -0,0 +1,90 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with translations.
/// </summary>
internal static class TranslationHelper
{
/// <summary>
/// Translate all settings of the given list with <see cref="WindowsSetting"/>.
/// </summary>
/// <param name="settingsList">The list that contains <see cref="WindowsSetting"/> to translate.</param>
internal static void TranslateAllSettings(in IEnumerable<WindowsSetting>? settingsList)
{
if (settingsList is null)
{
return;
}
foreach (var settings in settingsList)
{
var area = Resources.ResourceManager.GetString($"Area{settings.Area}");
var name = Resources.ResourceManager.GetString(settings.Name);
var type = Resources.ResourceManager.GetString(settings.Type);
if (string.IsNullOrEmpty(area))
{
Log.Warn($"Resource string for [Area{settings.Area}] not found", typeof(Main));
}
if (string.IsNullOrEmpty(name))
{
Log.Warn($"Resource string for [{settings.Name}] not found", typeof(Main));
}
if (string.IsNullOrEmpty(type))
{
Log.Warn($"Resource string for [{settings.Name}] not found", typeof(Main));
}
settings.Area = area ?? settings.Area ?? string.Empty;
settings.Name = name ?? settings.Name ?? string.Empty;
settings.Type = type ?? settings.Type ?? string.Empty;
if (!string.IsNullOrEmpty(settings.Note))
{
var note = Resources.ResourceManager.GetString(settings.Note);
if (string.IsNullOrEmpty(note))
{
Log.Warn($"Resource string for [{settings.Note}] not found", typeof(Main));
}
settings.Note = note ?? settings.Note ?? string.Empty;
}
if (!(settings.AltNames is null) && settings.AltNames.Any())
{
var translatedAltNames = new Collection<string>();
foreach (var altName in settings.AltNames)
{
if (string.IsNullOrWhiteSpace(altName))
{
continue;
}
var translatedAltName = Resources.ResourceManager.GetString(altName);
if (string.IsNullOrEmpty(translatedAltName))
{
Log.Warn($"Resource string for [{altName}] not found", typeof(Main));
}
translatedAltNames.Add(translatedAltName ?? altName);
}
settings.AltNames = translatedAltNames;
}
}
}
}
}

View File

@ -0,0 +1,89 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
/// <summary>
/// Helper class to easier work with the version of the Windows OS
/// </summary>
internal static class UnsupportedSettingsHelper
{
private const string _keyPath = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion";
private const string _keyNameBuild = "CurrentBuild";
private const string _keyNameBuildNumber = "CurrentBuildNumber";
/// <summary>
/// Remove all <see cref="WindowsSetting"/> of the given list that are not present on the current used Windows build.
/// </summary>
/// <param name="settingsList">The list with <see cref="WindowsSetting"/> to filter.</param>
/// <returns>A new list with <see cref="WindowsSetting"/> that only contain present Windows settings for this OS.</returns>
internal static IEnumerable<WindowsSetting> FilterByBuild(in IEnumerable<WindowsSetting>? settingsList)
{
if (settingsList is null)
{
return Enumerable.Empty<WindowsSetting>();
}
var currentBuild = GetNumericRegistryValue(_keyPath, _keyNameBuild);
var currentBuildNumber = GetNumericRegistryValue(_keyPath, _keyNameBuildNumber);
if (currentBuild != currentBuildNumber)
{
var usedValueName = currentBuild != uint.MinValue ? _keyNameBuild : _keyNameBuildNumber;
var warningMessage =
$"Detecting the Windows version in registry ({_keyPath}) leads to an inconclusive"
+ $" result ({_keyNameBuild}={currentBuild}, {_keyNameBuildNumber}={currentBuildNumber})!"
+ $" For resolving the conflict we use the value of '{usedValueName}'.";
Log.Warn(warningMessage, typeof(UnsupportedSettingsHelper));
}
var currentWindowsBuild = currentBuild != uint.MinValue
? currentBuild
: currentBuildNumber;
var filteredSettingsList = settingsList.Where(found
=> (found.DeprecatedInBuild == null || currentWindowsBuild < found.DeprecatedInBuild)
&& (found.IntroducedInBuild == null || currentWindowsBuild >= found.IntroducedInBuild));
filteredSettingsList = filteredSettingsList.OrderBy(found => found.Name);
return filteredSettingsList;
}
/// <summary>
/// Return a unsigned numeric value from given registry value name inside the given registry key.
/// </summary>
/// <param name="registryKey">The registry key.</param>
/// <param name="valueName">The name of the registry value.</param>
/// <returns>A registry value or <see cref="uint.MinValue"/> on error.</returns>
private static uint GetNumericRegistryValue(in string registryKey, in string valueName)
{
object registryValueData;
try
{
registryValueData = Win32.Registry.GetValue(registryKey, valueName, uint.MinValue);
}
catch (Exception exception)
{
Log.Exception(
$"Can't get registry value for '{valueName}'",
exception,
typeof(UnsupportedSettingsHelper));
return uint.MinValue;
}
return uint.TryParse(registryValueData as string, out var buildNumber)
? buildNumber
: uint.MinValue;
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,217 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using ManagedCommon;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
using Wox.Plugin;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
{
/// <summary>
/// Main class of this plugin that implement all used interfaces.
/// </summary>
public class Main : IPlugin, IContextMenu, IPluginI18n, IDisposable
{
/// <summary>
/// The path to the symbol for a light theme.
/// </summary>
private const string _lightSymbol = "Images/WindowsSettings.light.png";
/// <summary>
/// The path to the symbol for a dark theme.
/// </summary>
private const string _darkSymbol = "Images/WindowsSettings.dark.png";
/// <summary>
/// The name of this assembly.
/// </summary>
private readonly string _assemblyName;
/// <summary>
/// The initial context for this plugin (contains API and meta-data).
/// </summary>
private PluginInitContext? _context;
/// <summary>
/// The path to the icon for each result.
/// </summary>
private string _defaultIconPath;
/// <summary>
/// Indicate that the plugin is disposed.
/// </summary>
private bool _disposed;
/// <summary>
/// List that contain all settings.
/// </summary>
private IEnumerable<WindowsSetting>? _settingsList;
/// <summary>
/// Initializes a new instance of the <see cref="Main"/> class.
/// </summary>
public Main()
{
_assemblyName = Assembly.GetExecutingAssembly().GetName().Name ?? Name;
_defaultIconPath = _lightSymbol;
}
/// <summary>
/// Gets the localized name.
/// </summary>
public string Name => Resources.PluginTitle;
/// <summary>
/// Gets the localized description.
/// </summary>
public string Description => Resources.PluginDescription;
/// <summary>
/// Initialize the plugin with the given <see cref="PluginInitContext"/>.
/// </summary>
/// <param name="context">The <see cref="PluginInitContext"/> for this plugin.</param>
public void Init(PluginInitContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
_context.API.ThemeChanged += OnThemeChanged;
UpdateIconPath(_context.API.GetCurrentTheme());
_settingsList = JsonSettingsListHelper.ReadAllPossibleSettings();
_settingsList = UnsupportedSettingsHelper.FilterByBuild(_settingsList);
TranslationHelper.TranslateAllSettings(_settingsList);
}
/// <summary>
/// Return a filtered list, based on the given query.
/// </summary>
/// <param name="query">The query to filter the list.</param>
/// <returns>A filtered list, can be empty when nothing was found.</returns>
public List<Result> Query(Query query)
{
if (_settingsList is null)
{
return new List<Result>(0);
}
var filteredList = _settingsList
.Where(Predicate)
.OrderBy(found => found.Name);
var newList = ResultHelper.GetResultList(filteredList, query.Search, _defaultIconPath);
return newList;
bool Predicate(WindowsSetting found)
{
if (found.Name.Contains(query.Search, StringComparison.CurrentCultureIgnoreCase))
{
return true;
}
// Search for Area only by key char
if (found.Area.Contains(query.Search.Replace(":", string.Empty), StringComparison.CurrentCultureIgnoreCase)
&& query.Search.EndsWith(":"))
{
return true;
}
if (found.Area.Contains(query.Search, StringComparison.CurrentCultureIgnoreCase))
{
return true;
}
if (!(found.AltNames is null))
{
foreach (var altName in found.AltNames)
{
if (altName.Contains(query.Search, StringComparison.CurrentCultureIgnoreCase))
{
return true;
}
}
}
return false;
}
}
/// <summary>
/// Return a list context menu entries for a given <see cref="Result"/> (shown at the right side of the result).
/// </summary>
/// <param name="selectedResult">The <see cref="Result"/> for the list with context menu entries.</param>
/// <returns>A list context menu entries.</returns>
public List<ContextMenuResult> LoadContextMenus(Result selectedResult)
{
return ContextMenuHelper.GetContextMenu(selectedResult, _assemblyName);
}
/// <inheritdoc/>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Wrapper method for <see cref="Dispose"/> that dispose additional objects and events form the plugin itself.
/// </summary>
/// <param name="disposing">Indicate that the plugin is disposed.</param>
protected virtual void Dispose(bool disposing)
{
if (_disposed || !disposing)
{
return;
}
if (!(_context is null))
{
_context.API.ThemeChanged -= OnThemeChanged;
}
_disposed = true;
}
/// <summary>
/// Gets the localized name.
/// </summary>
public string GetTranslatedPluginTitle()
{
return Name;
}
/// <summary>
/// Gets the localized description.
/// </summary>
public string GetTranslatedPluginDescription()
{
return Description;
}
/// <summary>
/// Change all theme-based elements (typical called when the plugin theme has changed).
/// </summary>
/// <param name="oldtheme">The old <see cref="Theme"/>.</param>
/// <param name="newTheme">The new <see cref="Theme"/>.</param>
private void OnThemeChanged(Theme oldtheme, Theme newTheme)
{
UpdateIconPath(newTheme);
}
/// <summary>
/// Update all icons (typical called when the plugin theme has changed).
/// </summary>
/// <param name="theme">The new <see cref="Theme"/> for the icons.</param>
private void UpdateIconPath(Theme theme)
{
_defaultIconPath = theme == Theme.Light || theme == Theme.HighContrastWhite
? _lightSymbol
: _darkSymbol;
}
}
}

View File

@ -0,0 +1,111 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<Import Project="..\..\..\..\Version.props" />
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<ProjectGuid>{5043CECE-E6A7-4867-9CBE-02D27D83747A}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.PowerToys.Run.Plugin.WindowsSettings</RootNamespace>
<AssemblyName>Microsoft.PowerToys.Run.Plugin.WindowsSettings</AssemblyName>
<Version>$(Version).0</Version>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Platforms>x64</Platforms>
<ErrorReport>prompt</ErrorReport>
<UseWindowsForms>true</UseWindowsForms>
<NeutralLanguage>en-US</NeutralLanguage>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutputPath>..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<Optimize>false</Optimize>
<DebugType>full</DebugType>
<DebugSymbols>true</DebugSymbols>
<LangVersion>8.0</LangVersion>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutputPath>..\..\..\..\..\x64\Release\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<LangVersion>8.0</LangVersion>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Remove="WindowsSettings.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Wox.Infrastructure\Wox.Infrastructure.csproj">
<Private>false</Private>
</ProjectReference>
<ProjectReference Include="..\..\Wox.Plugin\Wox.Plugin.csproj">
<Private>false</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\..\..\codeAnalysis\GlobalSuppressions.cs">
<Link>GlobalSuppressions.cs</Link>
</Compile>
<AdditionalFiles Include="..\..\..\..\codeAnalysis\StyleCop.json">
<Link>StyleCop.json</Link>
</AdditionalFiles>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="WindowsSettings.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers">
<Version>1.1.118</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Update="Images\WindowsSettings.dark.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="Images\WindowsSettings.light.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
{
"ID": "5043CECEE6A748679CBE02D27D83747A",
"ActionKeyword": "$",
"IsGlobal": false,
"Name": "Windows Settings",
"Author": "TobiasSekan",
"Version": "1.0.0",
"Language": "csharp",
"Website": "https://aka.ms/powertoys",
"ExecuteFileName": "Microsoft.PowerToys.Run.Plugin.WindowsSettings.dll",
"IcoPathDark": "Images\\WindowsSettings.dark.png",
"IcoPathLight": "Images\\WindowsSettings.light.png"
}