[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/actions/spell-check/
^\.gitmodules$
(?:^|/)WindowsSettings\.json$

View File

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

View File

@ -131,6 +131,9 @@ build:
- '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\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\ManagedTelemetry.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}
{0351ADA4-0C32-4652-9BA0-41F7B602372B} = {0351ADA4-0C32-4652-9BA0-41F7B602372B}
{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}
{74F1B9ED-F59C-4FE7-B473-7B453E30837E} = {74F1B9ED-F59C-4FE7-B473-7B453E30837E}
{4BABF3FE-3451-42FD-873F-3C332E18DCEF} = {4BABF3FE-3451-42FD-873F-3C332E18DCEF}
@ -343,6 +344,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShortcutGuideModuleInterfac
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ShortcutGuide", "src\modules\ShortcutGuide\ShortcutGuide\ShortcutGuide.vcxproj", "{2EDB3EB4-FA92-4BFF-B2D8-566584837231}"
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
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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}.Release|x64.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -805,6 +812,7 @@ Global
{106CBECA-0701-4FC3-838C-9DF816A19AE2} = {4574FDD0-F61D-4376-98BF-E5A1262C11EC}
{2D604C07-51FC-46BB-9EB7-75AECC7F5E81} = {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
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C3A2F9D1-7930-4EF4-A6FC-7EE0A99821D0}

View File

@ -298,6 +298,10 @@
<Directory Id="SystemPluginFolder" Name="System">
<Directory Id="SystemImagesFolder" Name="Images" />
</Directory>
<Directory Id="WindowsSettingsPluginFolder" Name="Microsoft.PowerToys.Run.Plugin.WindowsSettings">
<Directory Id="WindowsSettingsImagesFolder" Name="Images" />
<Directory Id="WindowsSettingsLanguagesFolder" Name="Languages" />
</Directory>
</Directory>
</Directory>
</Directory>
@ -911,7 +915,7 @@
<Fragment>
<!-- Resource directories should be added only if the installer is built on the build farm -->
<?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)">
<!-- Resource file directories -->
<?foreach Language in $(var.LocLanguageList)?>
@ -1002,6 +1006,9 @@
<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" />
</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?>
<?endforeach?>
<?endif?>
@ -1184,6 +1191,17 @@
<File Id="SystemSleepLightIcon" Source="$(var.BinX64Dir)modules\launcher\Plugins\System\Images\sleep.light.png" />
</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>
</Fragment>
</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"
}