├── .gitattributes
├── .github
└── FUNDING.yml
├── .gitignore
├── LICENSE
├── README.md
├── Win11 Tweaker.sln
├── Win11 Tweaker
├── App.xaml
├── App.xaml.cs
├── Assets
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ ├── Wide310x150Logo.scale-200.png
│ ├── coffee_dark.png
│ ├── coffee_light.png
│ ├── github_dark.png
│ ├── github_light.png
│ └── win11tweaker icon.png
├── Case Converter
│ ├── Case Converter.exe
│ └── Case Converter.ini
├── CaseConverterHelper.cs
├── Clean Desktop
│ └── Clean Desktop.exe
├── CleanDesktopHelper.cs
├── LoggerHelper.cs
├── MainWindow.xaml
├── MainWindow.xaml.cs
├── Package.appxmanifest
├── Properties
│ └── launchSettings.json
├── RegistryHelper.cs
├── SettingsHelper.cs
├── ThemeHelper.cs
├── ToggleStateHelper.cs
├── Win11 Tweaker.csproj
├── WindowHelper.cs
├── app.manifest
└── win11tweaker icon.ico
└── publish.bat
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # Replace with a single Open Collective username
6 | ko_fi: iandiv
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12 | polar: # Replace with a single Polar username
13 | buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14 | thanks_dev: # Replace with a single thanks.dev username
15 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Ww][Ii][Nn]32/
27 | [Aa][Rr][Mm]/
28 | [Aa][Rr][Mm]64/
29 | bld/
30 | [Bb]in/
31 | [Oo]bj/
32 | [Oo]ut/
33 | [Ll]og/
34 | [Ll]ogs/
35 |
36 | # Visual Studio 2015/2017 cache/options directory
37 | .vs/
38 | # Uncomment if you have tasks that create the project's static files in wwwroot
39 | #wwwroot/
40 |
41 | # Visual Studio 2017 auto generated files
42 | Generated\ Files/
43 |
44 | # MSTest test Results
45 | [Tt]est[Rr]esult*/
46 | [Bb]uild[Ll]og.*
47 |
48 | # NUnit
49 | *.VisualState.xml
50 | TestResult.xml
51 | nunit-*.xml
52 |
53 | # Build Results of an ATL Project
54 | [Dd]ebugPS/
55 | [Rr]eleasePS/
56 | dlldata.c
57 |
58 | # Benchmark Results
59 | BenchmarkDotNet.Artifacts/
60 |
61 | # .NET Core
62 | project.lock.json
63 | project.fragment.lock.json
64 | artifacts/
65 |
66 | # ASP.NET Scaffolding
67 | ScaffoldingReadMe.txt
68 |
69 | # StyleCop
70 | StyleCopReport.xml
71 |
72 | # Files built by Visual Studio
73 | *_i.c
74 | *_p.c
75 | *_h.h
76 | *.ilk
77 | *.meta
78 | *.obj
79 | *.iobj
80 | *.pch
81 | *.pdb
82 | *.ipdb
83 | *.pgc
84 | *.pgd
85 | *.rsp
86 | *.sbr
87 | *.tlb
88 | *.tli
89 | *.tlh
90 | *.tmp
91 | *.tmp_proj
92 | *_wpftmp.csproj
93 | *.log
94 | *.vspscc
95 | *.vssscc
96 | .builds
97 | *.pidb
98 | *.svclog
99 | *.scc
100 |
101 | # Chutzpah Test files
102 | _Chutzpah*
103 |
104 | # Visual C++ cache files
105 | ipch/
106 | *.aps
107 | *.ncb
108 | *.opendb
109 | *.opensdf
110 | *.sdf
111 | *.cachefile
112 | *.VC.db
113 | *.VC.VC.opendb
114 |
115 | # Visual Studio profiler
116 | *.psess
117 | *.vsp
118 | *.vspx
119 | *.sap
120 |
121 | # Visual Studio Trace Files
122 | *.e2e
123 |
124 | # TFS 2012 Local Workspace
125 | $tf/
126 |
127 | # Guidance Automation Toolkit
128 | *.gpState
129 |
130 | # ReSharper is a .NET coding add-in
131 | _ReSharper*/
132 | *.[Rr]e[Ss]harper
133 | *.DotSettings.user
134 |
135 | # TeamCity is a build add-in
136 | _TeamCity*
137 |
138 | # DotCover is a Code Coverage Tool
139 | *.dotCover
140 |
141 | # AxoCover is a Code Coverage Tool
142 | .axoCover/*
143 | !.axoCover/settings.json
144 |
145 | # Coverlet is a free, cross platform Code Coverage Tool
146 | coverage*.json
147 | coverage*.xml
148 | coverage*.info
149 |
150 | # Visual Studio code coverage results
151 | *.coverage
152 | *.coveragexml
153 |
154 | # NCrunch
155 | _NCrunch_*
156 | .*crunch*.local.xml
157 | nCrunchTemp_*
158 |
159 | # MightyMoose
160 | *.mm.*
161 | AutoTest.Net/
162 |
163 | # Web workbench (sass)
164 | .sass-cache/
165 |
166 | # Installshield output folder
167 | [Ee]xpress/
168 |
169 | # DocProject is a documentation generator add-in
170 | DocProject/buildhelp/
171 | DocProject/Help/*.HxT
172 | DocProject/Help/*.HxC
173 | DocProject/Help/*.hhc
174 | DocProject/Help/*.hhk
175 | DocProject/Help/*.hhp
176 | DocProject/Help/Html2
177 | DocProject/Help/html
178 |
179 | # Click-Once directory
180 | publish/
181 |
182 | # Publish Web Output
183 | *.[Pp]ublish.xml
184 | *.azurePubxml
185 | # Note: Comment the next line if you want to checkin your web deploy settings,
186 | # but database connection strings (with potential passwords) will be unencrypted
187 | *.pubxml
188 | *.publishproj
189 |
190 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
191 | # checkin your Azure Web App publish settings, but sensitive information contained
192 | # in these scripts will be unencrypted
193 | PublishScripts/
194 |
195 | # NuGet Packages
196 | *.nupkg
197 | # NuGet Symbol Packages
198 | *.snupkg
199 | # The packages folder can be ignored because of Package Restore
200 | **/[Pp]ackages/*
201 | # except build/, which is used as an MSBuild target.
202 | !**/[Pp]ackages/build/
203 | # Uncomment if necessary however generally it will be regenerated when needed
204 | #!**/[Pp]ackages/repositories.config
205 | # NuGet v3's project.json files produces more ignorable files
206 | *.nuget.props
207 | *.nuget.targets
208 |
209 | # Microsoft Azure Build Output
210 | csx/
211 | *.build.csdef
212 |
213 | # Microsoft Azure Emulator
214 | ecf/
215 | rcf/
216 |
217 | # Windows Store app package directories and files
218 | AppPackages/
219 | BundleArtifacts/
220 | Package.StoreAssociation.xml
221 | _pkginfo.txt
222 | *.appx
223 | *.appxbundle
224 | *.appxupload
225 |
226 | # Visual Studio cache files
227 | # files ending in .cache can be ignored
228 | *.[Cc]ache
229 | # but keep track of directories ending in .cache
230 | !?*.[Cc]ache/
231 |
232 | # Others
233 | ClientBin/
234 | ~$*
235 | *~
236 | *.dbmdl
237 | *.dbproj.schemaview
238 | *.jfm
239 | *.pfx
240 | *.publishsettings
241 | orleans.codegen.cs
242 |
243 | # Including strong name files can present a security risk
244 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
245 | #*.snk
246 |
247 | # Since there are multiple workflows, uncomment next line to ignore bower_components
248 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
249 | #bower_components/
250 |
251 | # RIA/Silverlight projects
252 | Generated_Code/
253 |
254 | # Backup & report files from converting an old project file
255 | # to a newer Visual Studio version. Backup files are not needed,
256 | # because we have git ;-)
257 | _UpgradeReport_Files/
258 | Backup*/
259 | UpgradeLog*.XML
260 | UpgradeLog*.htm
261 | ServiceFabricBackup/
262 | *.rptproj.bak
263 |
264 | # SQL Server files
265 | *.mdf
266 | *.ldf
267 | *.ndf
268 |
269 | # Business Intelligence projects
270 | *.rdl.data
271 | *.bim.layout
272 | *.bim_*.settings
273 | *.rptproj.rsuser
274 | *- [Bb]ackup.rdl
275 | *- [Bb]ackup ([0-9]).rdl
276 | *- [Bb]ackup ([0-9][0-9]).rdl
277 |
278 | # Microsoft Fakes
279 | FakesAssemblies/
280 |
281 | # GhostDoc plugin setting file
282 | *.GhostDoc.xml
283 |
284 | # Node.js Tools for Visual Studio
285 | .ntvs_analysis.dat
286 | node_modules/
287 |
288 | # Visual Studio 6 build log
289 | *.plg
290 |
291 | # Visual Studio 6 workspace options file
292 | *.opt
293 |
294 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
295 | *.vbw
296 |
297 | # Visual Studio LightSwitch build output
298 | **/*.HTMLClient/GeneratedArtifacts
299 | **/*.DesktopClient/GeneratedArtifacts
300 | **/*.DesktopClient/ModelManifest.xml
301 | **/*.Server/GeneratedArtifacts
302 | **/*.Server/ModelManifest.xml
303 | _Pvt_Extensions
304 |
305 | # Paket dependency manager
306 | .paket/paket.exe
307 | paket-files/
308 |
309 | # FAKE - F# Make
310 | .fake/
311 |
312 | # CodeRush personal settings
313 | .cr/personal
314 |
315 | # Python Tools for Visual Studio (PTVS)
316 | __pycache__/
317 | *.pyc
318 |
319 | # Cake - Uncomment if you are using it
320 | # tools/**
321 | # !tools/packages.config
322 |
323 | # Tabs Studio
324 | *.tss
325 |
326 | # Telerik's JustMock configuration file
327 | *.jmconfig
328 |
329 | # BizTalk build output
330 | *.btp.cs
331 | *.btm.cs
332 | *.odx.cs
333 | *.xsd.cs
334 |
335 | # OpenCover UI analysis results
336 | OpenCover/
337 |
338 | # Azure Stream Analytics local run output
339 | ASALocalRun/
340 |
341 | # MSBuild Binary and Structured Log
342 | *.binlog
343 |
344 | # NVidia Nsight GPU debugger configuration file
345 | *.nvuser
346 |
347 | # MFractors (Xamarin productivity tool) working folder
348 | .mfractor/
349 |
350 | # Local History for Visual Studio
351 | .localhistory/
352 |
353 | # BeatPulse healthcheck temp database
354 | healthchecksdb
355 |
356 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
357 | MigrationBackup/
358 |
359 | # Ionide (cross platform F# VS Code tools) working folder
360 | .ionide/
361 |
362 | # Fody - auto-generated XML schema
363 | FodyWeavers.xsd
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 ianDiv
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Win11 Tweaker
2 | A Free & Powerful Tool for Personalizing and Enhancing Windows 11
3 |
4 | 
5 |
6 | ## Features
7 | Win11 Tweaker allows you to customize and optimize Windows 11 with ease.
8 |
9 | | Feature | Description |
10 | |---------|------------|
11 | | **Case Converter** 🆕 | Convert text to different text cases. |
12 | | **Clean Desktop** 🆕 | Hide icons by double-clicking on the desktop. |
13 | | **Disable Background Apps** 🆕 | Prevent apps from running in the background. |
14 | | **Classic Context Menu** | Restore the classic right-click menu for a familiar user experience. |
15 | | **Compact View** | Enable or disable compact view in File Explorer. |
16 | | **Details Pane in Context Menu** | Add a Details Pane to File Explorer's right-click menu. |
17 | | **Disable Web Search** | Remove web search results from the Start menu. |
18 | | **Disable Lock Screen** | Skip the Windows 11 lock screen and go directly to login. |
19 | | **Print Screen Sound Notification** | Play a sound when pressing the Print Screen key. |
20 |
21 |
22 | ## Preview
23 |
24 | 
25 |
26 | ## Download
27 | 📥 Get the latest version from the [Releases](https://github.com/iandiv/Win11Tweaker/releases) page.
28 |
29 | ## Reviews & Mentions 🌟
30 | Win11 Tweaker has been featured on various tech sites:
31 |
32 | - [Softpedia](https://www.softpedia.com/get/Tweak/System-Tweak/Win11-Tweaker.shtml)
33 | - [MajorGeeks](https://www.majorgeeks.com/files/details/win11_tweaker.html)
34 | - [FileCR](https://filecr.com/windows/win11-tweaker/)
35 | - [Instalki.pl](https://www.instalki.pl/download/programy/windows/narzedzia/narzedzia-systemowe/win11_tweaker/)
36 | - [Pesktop](https://pesktop.com/en/windows/win11-tweaker)
37 | - [KaranPC](https://karanpc.com/win11-tweaker-free-download/)
38 | - [Softaro](https://softaro.jp/win11-tweaker/)
39 | - [RSload.net](https://rsload.net/soft/optimization/40035-win11-tweaker.html)
40 | - [Dwrean.net](https://www.dwrean.net/2023/09/win11-tweaker-windows-11.html)
41 | - [Taiwebs](https://en.taiwebs.com/windows/download-win11-tweaker-10066.html)
42 | - [Donkichirou Blog](https://donkichirou.blog.fc2.com/blog-entry-354.html?sp)
43 |
44 | ## Support the Project ❤️
45 | If you find Win11 Tweaker useful, consider supporting its development:
46 | 👉 [Buy me a coffee on Ko-Fi ☕](https://ko-fi.com/iandiv)
47 |
48 | ## Contribute
49 | Win11 Tweaker is open-source, and community contributions are welcome! Feel free to report issues, suggest new features, or submit improvements.
50 |
51 | ## Disclaimer
52 | Win11 Tweaker is a third-party tool **not affiliated with Microsoft Corporation**. Use it at your own risk. Always create a system restore point before applying changes.
53 |
54 | © 2025 | **IanDiv**
55 |
--------------------------------------------------------------------------------
/Win11 Tweaker.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.13.35806.99
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Win11 Tweaker", "Win11 Tweaker\Win11 Tweaker.csproj", "{9EDE3432-919E-46C3-9527-B560D19CFA45}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|ARM64 = Debug|ARM64
11 | Debug|x64 = Debug|x64
12 | Debug|x86 = Debug|x86
13 | Release|ARM64 = Release|ARM64
14 | Release|x64 = Release|x64
15 | Release|x86 = Release|x86
16 | EndGlobalSection
17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
18 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|ARM64.ActiveCfg = Debug|ARM64
19 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|ARM64.Build.0 = Debug|ARM64
20 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|ARM64.Deploy.0 = Debug|ARM64
21 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|x64.ActiveCfg = Debug|x64
22 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|x64.Build.0 = Debug|x64
23 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|x64.Deploy.0 = Debug|x64
24 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|x86.ActiveCfg = Debug|x86
25 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|x86.Build.0 = Debug|x86
26 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Debug|x86.Deploy.0 = Debug|x86
27 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|ARM64.ActiveCfg = Release|ARM64
28 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|ARM64.Build.0 = Release|ARM64
29 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|ARM64.Deploy.0 = Release|ARM64
30 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|x64.ActiveCfg = Release|x64
31 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|x64.Build.0 = Release|x64
32 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|x64.Deploy.0 = Release|x64
33 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|x86.ActiveCfg = Release|x86
34 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|x86.Build.0 = Release|x86
35 | {9EDE3432-919E-46C3-9527-B560D19CFA45}.Release|x86.Deploy.0 = Release|x86
36 | EndGlobalSection
37 | GlobalSection(SolutionProperties) = preSolution
38 | HideSolutionNode = FALSE
39 | EndGlobalSection
40 | GlobalSection(ExtensibilityGlobals) = postSolution
41 | SolutionGuid = {E0733677-C3A4-4C7E-A45D-432E31FF7EA4}
42 | EndGlobalSection
43 | EndGlobal
44 |
--------------------------------------------------------------------------------
/Win11 Tweaker/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | #b0ffffff
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | #30606060
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/Win11 Tweaker/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // To learn more about WinUI, the WinUI project structure,
2 | // and more about our project templates, see: http://aka.ms/winui-project-info.
3 |
4 | using Microsoft.UI.Xaml;
5 |
6 | namespace Win11_Tweaker
7 | {
8 | ///
9 | /// Provides application-specific behavior to supplement the default Application class.
10 | ///
11 | public partial class App : Application
12 | {
13 | ///
14 | /// Initializes the singleton application object. This is the first line of authored code
15 | /// executed, and as such is the logical equivalent of main() or WinMain().
16 | ///
17 | public App()
18 | {
19 | this.InitializeComponent();
20 | }
21 |
22 | ///
23 | /// Invoked when the application is launched.
24 | ///
25 | /// Details about the launch request and process.
26 | protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args)
27 | {
28 | m_window = new MainWindow();
29 | m_window.Activate();
30 | }
31 |
32 | private Window? m_window;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/StoreLogo.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/coffee_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/coffee_dark.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/coffee_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/coffee_light.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/github_dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/github_dark.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/github_light.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/github_light.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Assets/win11tweaker icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Assets/win11tweaker icon.png
--------------------------------------------------------------------------------
/Win11 Tweaker/Case Converter/Case Converter.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Case Converter/Case Converter.exe
--------------------------------------------------------------------------------
/Win11 Tweaker/Case Converter/Case Converter.ini:
--------------------------------------------------------------------------------
1 | ;Ctrl+Shift+W
2 | ^+W
--------------------------------------------------------------------------------
/Win11 Tweaker/CaseConverterHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.IO;
5 | using System.Linq;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Microsoft.UI;
9 | using Microsoft.UI.Xaml;
10 | using Microsoft.UI.Xaml.Controls;
11 | using Microsoft.UI.Xaml.Input;
12 | using Microsoft.UI.Xaml.Media;
13 | using Microsoft.Win32;
14 | using Windows.System;
15 |
16 | namespace Win11_Tweaker
17 | {
18 | public class CaseConverterHelper : ContentDialog
19 | {
20 | private TextBox hotkeyTextBox;
21 | private HashSet pressedKeys = new();
22 | private bool hasModifier = false;
23 | public static string appName = "Case Converter";
24 | private static string configPath = Path.Combine(AppContext.BaseDirectory, appName + ".ini");
25 | private static string exePath = Path.Combine(AppContext.BaseDirectory, appName + ".exe");
26 | private static string startupKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
27 |
28 |
29 |
30 | private readonly Dictionary specialCharacterMapping = new()
31 | {
32 | { (VirtualKey)186, ";" }, { (VirtualKey)187, "=" }, { (VirtualKey)188, "," }, { (VirtualKey)189, "-" },
33 | { (VirtualKey)190, "." }, { (VirtualKey)191, "/" }, { (VirtualKey)192, "`" }, { (VirtualKey)219, "[" },
34 | { (VirtualKey)220, "\\" }, { (VirtualKey)221, "]" }, { (VirtualKey)222, "'" }
35 | };
36 |
37 | public CaseConverterHelper(XamlRoot xamlRoot)
38 | {
39 |
40 | // Register the dialog to auto-update theme
41 | ThemeHelper.RegisterDialog(this);
42 | this.Title = "Press Any Key";
43 | this.PrimaryButtonText = "Save";
44 | this.DefaultButton = ContentDialogButton.Primary;
45 | this.CloseButtonText = "Cancel";
46 | hotkeyTextBox = new TextBox
47 | {
48 | PlaceholderText = "...",
49 | FontSize = 24,
50 | FontWeight = Microsoft.UI.Text.FontWeights.Bold,
51 | Background = new SolidColorBrush(ColorHelper.FromArgb(0x30, 0x90, 0x90, 0x90)),
52 | BorderThickness = new Microsoft.UI.Xaml.Thickness(0),
53 | IsReadOnly = true,
54 | Padding = new Microsoft.UI.Xaml.Thickness(10),
55 | TextAlignment = TextAlignment.Center,
56 | VerticalAlignment = VerticalAlignment.Center,
57 | HorizontalAlignment = HorizontalAlignment.Center,
58 | CornerRadius = new CornerRadius(8)
59 | };
60 |
61 | hotkeyTextBox.Style = Application.Current.Resources["NoUnderlineTextBoxStyle"] as Style;
62 | hotkeyTextBox.Resources["TextControlBackgroundFocused"] = new SolidColorBrush(ColorHelper.FromArgb(0x30, 0x60, 0x60, 0x60));
63 | hotkeyTextBox.Resources["TextControlBackgroundPointerOver"] = new SolidColorBrush(ColorHelper.FromArgb(0x30, 0x60, 0x60, 0x60));
64 |
65 | this.Content = hotkeyTextBox;
66 | this.XamlRoot = xamlRoot;
67 |
68 | hotkeyTextBox.KeyDown += HotkeyTextBox_KeyDown;
69 | hotkeyTextBox.KeyUp += HotkeyTextBox_KeyUp;
70 |
71 | this.PrimaryButtonClick += async (sender, args) => await SaveHotkeyAsync();
72 | _ = ReadHotKey();
73 | }
74 | private async Task ReadHotKey()
75 | {
76 | string savedHotkey = await ReadHotkeyAsync();
77 | hotkeyTextBox.Text = string.IsNullOrWhiteSpace(savedHotkey) ? "Press a hotkey..." : savedHotkey;
78 | }
79 | private void HotkeyTextBox_KeyDown(object sender, KeyRoutedEventArgs e)
80 | {
81 | e.Handled = true;
82 |
83 | string keyPressed = GetKeyName(e.Key);
84 | if (string.IsNullOrEmpty(keyPressed)) return;
85 |
86 | if (keyPressed == "Ctrl" || keyPressed == "Shift" || keyPressed == "Alt")
87 | {
88 | hasModifier = true;
89 | }
90 | else
91 | {
92 | if (pressedKeys.Any(k => k != "Ctrl" && k != "Shift" && k != "Alt"))
93 | {
94 | return;
95 | }
96 | }
97 |
98 | if (!pressedKeys.Contains(keyPressed))
99 | {
100 | pressedKeys.Add(keyPressed);
101 | }
102 |
103 | hotkeyTextBox.Text = string.Join("+", pressedKeys);
104 | }
105 | private void HotkeyTextBox_KeyUp(object sender, KeyRoutedEventArgs e)
106 | {
107 | pressedKeys.Clear();
108 | hasModifier = false;
109 | }
110 |
111 | private string GetKeyName(VirtualKey key)
112 | {
113 | // Handle modifier keys first
114 | return key switch
115 | {
116 | VirtualKey.Control => "Ctrl",
117 | VirtualKey.LeftControl => "Ctrl",
118 | VirtualKey.RightControl => "Ctrl",
119 | VirtualKey.Shift => "Shift",
120 | VirtualKey.LeftShift => "Shift",
121 | VirtualKey.RightShift => "Shift",
122 | VirtualKey.Menu => "Alt",
123 | VirtualKey.LeftMenu => "Alt",
124 | VirtualKey.RightMenu => "Alt",
125 | _ => specialCharacterMapping.ContainsKey(key) ? specialCharacterMapping[key] : key.ToString()
126 | };
127 | }
128 |
129 | public static Process? RunCaseConverter()
130 | {
131 |
132 | if (File.Exists(exePath))
133 | {
134 | RunAtStartup();
135 | return Process.Start(new ProcessStartInfo { FileName = exePath, UseShellExecute = true });
136 | }
137 |
138 | return null;
139 | }
140 | public static void RunAtStartup()
141 | {
142 | RegistryHelper.SetRegistryValue(Registry.CurrentUser, startupKeyPath, appName, exePath, RegistryValueKind.String);
143 | }
144 |
145 | public static void RemoveFromStartup()
146 | {
147 | RegistryHelper.DeleteRegistryValue(Registry.CurrentUser, startupKeyPath, appName);
148 | }
149 | private async Task SaveHotkeyAsync()
150 | {
151 |
152 |
153 | string convertedKey = ConvertHotkey(hotkeyTextBox.Text);
154 |
155 | try
156 | {
157 | await File.WriteAllTextAsync(configPath, ";" + hotkeyTextBox.Text + "\n" + convertedKey);
158 | Debug.WriteLine("Config saved.");
159 |
160 | string exePath = Path.Combine(AppContext.BaseDirectory, appName + ".exe");
161 | string processName = Path.GetFileNameWithoutExtension(exePath); // Get process name without .exe
162 |
163 | // Check if the process is already running
164 | if (Process.GetProcessesByName(processName).Any())
165 | {
166 | // Start only if it is already running
167 | RunCaseConverter();
168 |
169 | }
170 | else
171 | {
172 | //await ShowErrorDialog("The application is not running.");
173 | }
174 |
175 | }
176 | catch (Exception ex)
177 | {
178 | Debug.WriteLine("Error saving config: " + ex.Message);
179 | }
180 | }
181 | private async Task ShowErrorDialog(string message)
182 | {
183 | var errorDialog = new ContentDialog
184 | {
185 | Title = "Error",
186 | Content = message,
187 | CloseButtonText = "OK",
188 | XamlRoot = this.XamlRoot
189 | };
190 |
191 | // Register the dialog to auto-update theme
192 | ThemeHelper.RegisterDialog(errorDialog);
193 | await errorDialog.ShowAsync();
194 | }
195 |
196 |
197 | private string ConvertHotkey(string plainText)
198 | {
199 | List keys = plainText.Split('+').ToList();
200 | StringBuilder hotkey = new();
201 |
202 | foreach (string key in keys)
203 | {
204 | if (key == "Ctrl")
205 | hotkey.Append("^"); // Ctrl = ^
206 | else if (key == "Alt")
207 | hotkey.Append("!"); // Alt = !
208 | else if (key == "Shift")
209 | hotkey.Append("+"); // Shift = +
210 | else
211 | {
212 | // If Shift was pressed, append key directly (Shift+R = +R)
213 | if (hotkey.Length > 0 && hotkey[^1] == '+')
214 | hotkey.Append(key);
215 | else
216 | hotkey.Append(key);
217 | }
218 | }
219 |
220 | return hotkey.ToString();
221 | }
222 |
223 |
224 |
225 | public static async Task ReadHotkeyAsync()
226 | {
227 |
228 | try
229 | {
230 | if (File.Exists(configPath))
231 | {
232 | string[] lines = await File.ReadAllLinesAsync(configPath);
233 | return lines.FirstOrDefault(line => line.StartsWith(";"))?.TrimStart(';') ?? "No hotkey set";
234 | }
235 | }
236 | catch (Exception ex)
237 | {
238 | Debug.WriteLine("Error reading config: " + ex.Message);
239 | }
240 | return "No hotkey set";
241 | }
242 | }
243 | }
244 |
--------------------------------------------------------------------------------
/Win11 Tweaker/Clean Desktop/Clean Desktop.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/Clean Desktop/Clean Desktop.exe
--------------------------------------------------------------------------------
/Win11 Tweaker/CleanDesktopHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.IO;
4 | using Microsoft.Win32;
5 |
6 | namespace Win11_Tweaker
7 | {
8 | class CleanDesktopHelper
9 | {
10 |
11 | public static string appName = "Clean Desktop";
12 | private static string exePath = Path.Combine(AppContext.BaseDirectory, appName + ".exe");
13 | private static string startupKeyPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
14 |
15 | public static Process? RunCleanDesktop()
16 | {
17 |
18 | if (File.Exists(exePath))
19 | {
20 | RunAtStartup();
21 | return Process.Start(new ProcessStartInfo { FileName = exePath, UseShellExecute = true });
22 | }
23 |
24 | return null;
25 | }
26 | public static void RunAtStartup()
27 | {
28 | RegistryHelper.SetRegistryValue(Registry.CurrentUser, startupKeyPath, appName, exePath, RegistryValueKind.String);
29 | }
30 |
31 | public static void RemoveFromStartup()
32 | {
33 | RegistryHelper.DeleteRegistryValue(Registry.CurrentUser, startupKeyPath, appName);
34 | }
35 | }
36 |
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/Win11 Tweaker/LoggerHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace Win11_Tweaker
5 | {
6 | public static class LoggerHelper
7 | {
8 | private static readonly string logFilePath = Path.Combine(AppContext.BaseDirectory, "log.txt");
9 |
10 | ///
11 | /// Writes a log message to the log file.
12 | ///
13 | public static void Log(string message)
14 | {
15 | try
16 | {
17 | string logEntry = $"{DateTime.Now:yyyy-MM-dd HH:mm:ss} - {message}{Environment.NewLine}";
18 | File.AppendAllText(logFilePath, logEntry);
19 | }
20 | catch (Exception ex)
21 | {
22 | System.Diagnostics.Debug.WriteLine($"Logger Error: {ex.Message}");
23 | }
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Win11 Tweaker/MainWindow.xaml:
--------------------------------------------------------------------------------
1 |
2 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
67 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
--------------------------------------------------------------------------------
/Win11 Tweaker/MainWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using Microsoft.UI.Xaml;
4 | using Microsoft.UI.Xaml.Controls;
5 | using Microsoft.Win32;
6 | using Win11_Tweaker.Helpers;
7 |
8 |
9 | namespace Win11_Tweaker
10 | {
11 |
12 | public sealed partial class MainWindow : Window
13 | {
14 |
15 | private WindowHelper _windowHelper;
16 | private Process caseConverterProcess;
17 | private Process cleanDesktopProcess;
18 |
19 | public MainWindow()
20 | {
21 | this.InitializeComponent();
22 | _windowHelper = new WindowHelper(this);
23 |
24 | _windowHelper.MicaEnabled = true;
25 | _windowHelper.WindowSize = (570, 670);
26 | _windowHelper.MinimumSize = (570, 670);
27 |
28 | ToggleStateHelper.LoadToggleStates(this.Content, runReg);
29 | LoadHotkey();
30 | if (case_converter.IsOn) CaseConverterHelper.RunCaseConverter();
31 |
32 | }
33 |
34 |
35 | private async void LoadHotkey()
36 | {
37 | string savedHotkey = await CaseConverterHelper.ReadHotkeyAsync();
38 | hotkeyText.Text = string.IsNullOrEmpty(savedHotkey) ? "No hotkey set" : savedHotkey;
39 | }
40 | private async void GitHubButton_Click(object sender, RoutedEventArgs e)
41 | {
42 | var uri = new Uri("https://github.com/iandiv");
43 | await Windows.System.Launcher.LaunchUriAsync(uri);
44 | }
45 | private async void CoffeeButton_Click(object sender, RoutedEventArgs e)
46 | {
47 | var uri = new Uri("https://ko-fi.com/iandiv"); // Replace with your GitHub repo URL
48 | await Windows.System.Launcher.LaunchUriAsync(uri);
49 | }
50 |
51 | private async void OpenHotkeyDialog(object sender, RoutedEventArgs e)
52 | {
53 | var dialog = new CaseConverterHelper(this.Content.XamlRoot);
54 | await dialog.ShowAsync();
55 | LoadHotkey();
56 | }
57 | private async void runReg(object sender, RoutedEventArgs e)
58 | {
59 | ToggleSwitch toggle = sender as ToggleSwitch;
60 | if (toggle != null)
61 | {
62 | string keyPath;
63 |
64 | switch (toggle.Name)
65 | {
66 | //DESKTOP
67 | case "case_converter":
68 | if (toggle.IsOn)
69 | {
70 |
71 |
72 | caseConverterProcess = CaseConverterHelper.RunCaseConverter();
73 | }
74 | else
75 | {
76 | CaseConverterHelper.RemoveFromStartup();
77 | if (caseConverterProcess != null && !caseConverterProcess.HasExited)
78 | {
79 | caseConverterProcess.Kill();
80 | caseConverterProcess.Dispose();
81 | caseConverterProcess = null;
82 | }
83 | else
84 | {
85 | var runningProcesses = Process.GetProcessesByName(CaseConverterHelper.appName);
86 | foreach (var proc in runningProcesses)
87 | {
88 | proc.Kill();
89 | }
90 | }
91 | }
92 | break;
93 | case "clean_desktop":
94 | if (toggle.IsOn)
95 | {
96 |
97 |
98 | cleanDesktopProcess = CleanDesktopHelper.RunCleanDesktop();
99 | }
100 | else
101 | {
102 | CleanDesktopHelper.RemoveFromStartup();
103 | if (cleanDesktopProcess != null && !cleanDesktopProcess.HasExited)
104 | {
105 | cleanDesktopProcess.Kill();
106 | cleanDesktopProcess.Dispose();
107 | cleanDesktopProcess = null;
108 | }
109 | else
110 | {
111 | var runningProcesses = Process.GetProcessesByName(CleanDesktopHelper.appName);
112 | foreach (var proc in runningProcesses)
113 | {
114 | proc.Kill();
115 | }
116 | }
117 | }
118 | break;
119 | //FILE EXPLORER
120 | case "classic_context_menu":
121 | keyPath = @"Software\Classes\CLSID\{86ca1aa0-34aa-4e8b-a509-50c905bae2a2}\InprocServer32";
122 |
123 | if (toggle.IsOn)
124 | {
125 | RegistryHelper.SetRegistryValue(
126 | Registry.CurrentUser,
127 | keyPath,
128 | "", // Default value (empty string)
129 | "",
130 | RegistryValueKind.String
131 | );
132 | }
133 | else
134 | {
135 | RegistryHelper.DeleteRegistryKey(Registry.CurrentUser, keyPath);
136 | }
137 |
138 |
139 | await RegistryHelper.ShowActionDialog(RegistryHelper.ActionTypes.RestartExplorer, toggle.XamlRoot);
140 |
141 |
142 |
143 | break;
144 | case "compact_view":
145 | RegistryHelper.SetRegistryValue(
146 | Registry.CurrentUser,
147 | @"SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced",
148 | "UseCompactMode",
149 | toggle.IsOn ? 1 : 0,
150 | RegistryValueKind.DWord
151 | );
152 | break;
153 |
154 | case "details_pane":
155 |
156 |
157 | if (toggle.IsOn)
158 | {
159 | string[] keyPaths =
160 | {
161 | @"AllFilesystemObjects\shell\Windows.previewpane",
162 | @"Directory\Background\shell\Windows.previewpane",
163 | @"Drive\shell\Windows.previewpane",
164 | @"LibraryFolder\background\shell\Windows.previewpane"
165 | };
166 |
167 | foreach (string path in keyPaths)
168 | {
169 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "CanonicalName", "{1380d028-a77f-4c12-96c7-ea276333f982}", RegistryValueKind.String);
170 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "Description", "@shell32.dll,-31416", RegistryValueKind.String);
171 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "Icon", "shell32.dll,-16814", RegistryValueKind.String);
172 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "MUIVerb", "@shell32.dll,-31415", RegistryValueKind.String);
173 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "PaneID", "{43abf98b-89b8-472d-b9ce-e69b8229f019}", RegistryValueKind.String);
174 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "PaneVisibleProperty", "PreviewPaneSizer_Visible", RegistryValueKind.String);
175 | RegistryHelper.SetRegistryValue(Registry.ClassesRoot, path, "PolicyID", "{17067f8d-981b-42c5-98f8-5bc016d4b073}", RegistryValueKind.String);
176 | }
177 | }
178 | else
179 | {
180 | RegistryHelper.DeleteRegistryKey(Registry.ClassesRoot, @"AllFilesystemObjects\shell\Windows.previewpane");
181 | RegistryHelper.DeleteRegistryKey(Registry.ClassesRoot, @"Directory\Background\shell\Windows.previewpane");
182 | RegistryHelper.DeleteRegistryKey(Registry.ClassesRoot, @"Drive\shell\Windows.previewpane");
183 | RegistryHelper.DeleteRegistryKey(Registry.ClassesRoot, @"LibraryFolder\background\shell\Windows.previewpane");
184 | }
185 |
186 | break;
187 | //START MENU
188 | case "web_search":
189 | keyPath = @"SOFTWARE\Policies\Microsoft\Windows\Explorer";
190 |
191 | if (toggle.IsOn)
192 | {
193 | RegistryHelper.SetRegistryValue(
194 | Registry.CurrentUser,
195 | keyPath,
196 | "DisableSearchBoxSuggestions",
197 | 1,
198 | RegistryValueKind.DWord
199 | );
200 | }
201 | else
202 | {
203 | RegistryHelper.DeleteRegistryValue(
204 | Registry.CurrentUser,
205 | keyPath,
206 | "DisableSearchBoxSuggestions"
207 | );
208 | }
209 |
210 |
211 | await RegistryHelper.ShowActionDialog(RegistryHelper.ActionTypes.SignOut, toggle.XamlRoot);
212 |
213 |
214 |
215 |
216 | break;
217 | //LOCK SCREEN
218 | case "lock_screen":
219 |
220 | RegistryHelper.SetRegistryValue(
221 | Registry.LocalMachine,
222 | @"SOFTWARE\Policies\Microsoft\Windows\Personalization",
223 | "NoLockScreen",
224 | toggle.IsOn ? 1 : 0,
225 | RegistryValueKind.DWord
226 | );
227 | break;
228 |
229 |
230 | //OTHER
231 | case "print_scr":
232 | keyPath = @"AppEvents\Schemes\Apps\.Default\SnapShot";
233 |
234 | if (toggle.IsOn)
235 | {
236 | RegistryHelper.SetRegistryValue(
237 | Registry.CurrentUser,
238 | $"{keyPath}\\.Current",
239 | null,
240 | @"C:\Windows\media\Windows Notify System Generic.wav",
241 | RegistryValueKind.String
242 | );
243 |
244 | RegistryHelper.SetRegistryValue(
245 | Registry.CurrentUser,
246 | $"{keyPath}\\.Default",
247 | null,
248 | @"C:\Windows\media\Windows Notify System Generic.wav",
249 | RegistryValueKind.String
250 | );
251 | }
252 | else
253 | {
254 | RegistryHelper.DeleteRegistryKey(Registry.CurrentUser, keyPath);
255 | }
256 |
257 | break;
258 | case "disable_background_apps":
259 | RegistryHelper.SetRegistryValue(
260 | Registry.CurrentUser,
261 | @"Software\Microsoft\Windows\CurrentVersion\BackgroundAccessApplications",
262 | "GlobalUserDisabled",
263 | toggle.IsOn ? 1 : 0,
264 | RegistryValueKind.DWord
265 | );
266 |
267 | await RegistryHelper.ShowActionDialog(RegistryHelper.ActionTypes.SignOut, toggle.XamlRoot);
268 |
269 |
270 |
271 | break;
272 | default:
273 | Debug.WriteLine("Unknown toggle switch.");
274 | break;
275 | }
276 | SettingsHelper.SaveToggleState(toggle.Name, toggle.IsOn);
277 |
278 |
279 | }
280 | }
281 |
282 |
283 | }
284 | }
285 |
--------------------------------------------------------------------------------
/Win11 Tweaker/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
14 |
15 |
16 |
17 |
18 | Win11 Tweaker
19 | Ian Divinagracia
20 | Assets\StoreLogo.png
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
36 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/Win11 Tweaker/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Win11 Tweaker (Package)": {
4 | "commandName": "MsixPackage"
5 | },
6 | "Win11 Tweaker (Unpackaged)": {
7 | "commandName": "Project"
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/Win11 Tweaker/RegistryHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Threading.Tasks;
4 | using Microsoft.UI.Xaml;
5 | using Microsoft.UI.Xaml.Controls;
6 | using Microsoft.Win32;
7 |
8 | namespace Win11_Tweaker
9 | {
10 | class RegistryHelper
11 | {
12 | ///
13 | /// Displays a confirmation dialog for system actions.
14 | ///
15 | public static class ActionTypes
16 | {
17 | public const string SignOut = "signout";
18 | public const string RestartExplorer = "restart_explorer";
19 | public const string RestartSystem = "restart_system";
20 | }
21 | public static async Task ShowActionDialog(string actionType, XamlRoot xamlRoot)
22 | {
23 | if (xamlRoot != null)
24 | {
25 | await ShowDialog(actionType, xamlRoot);
26 | }
27 | else
28 | {
29 | LoggerHelper.Log("XamlRoot is null. Dialog not shown.");
30 | }
31 | }
32 | public static async Task ShowDialog(string actionType, XamlRoot xamlRoot)
33 | {
34 | string title = "";
35 | string message = "";
36 | string confirmText = "Proceed";
37 |
38 | switch (actionType)
39 | {
40 | case ActionTypes.SignOut:
41 | title = "Sign Out";
42 | message = "Are you sure you want to sign out?";
43 | break;
44 | case ActionTypes.RestartExplorer:
45 | title = "Restart Explorer";
46 | message = "Are you sure you want to restart Windows Explorer?";
47 | break;
48 | case ActionTypes.RestartSystem:
49 | title = "Restart System";
50 | message = "Are you sure you want to restart your computer?";
51 | confirmText = "Restart";
52 | break;
53 | default:
54 | LoggerHelper.Log("Unknown action.");
55 | return;
56 | }
57 |
58 | ContentDialog dialog = new ContentDialog
59 | {
60 | Title = title,
61 | Content = message,
62 | PrimaryButtonText = confirmText,
63 | DefaultButton = ContentDialogButton.Primary,
64 | CloseButtonText = "I'll do it later",
65 | XamlRoot = xamlRoot // ✅ Set XamlRoot to fix the issue
66 | };
67 | ThemeHelper.RegisterDialog(dialog);
68 |
69 |
70 | var result = await dialog.ShowAsync();
71 |
72 | if (result == ContentDialogResult.Primary)
73 | {
74 | ExecuteAction(actionType);
75 | }
76 | }
77 |
78 |
79 |
80 | ///
81 | /// Executes system actions like sign out, restart explorer, or restart system.
82 | ///
83 | public static void ExecuteAction(string actionType)
84 | {
85 | ProcessStartInfo psi;
86 |
87 | switch (actionType)
88 | {
89 | case "signout":
90 | psi = new ProcessStartInfo
91 | {
92 | FileName = "shutdown",
93 | Arguments = "/l",
94 | UseShellExecute = false,
95 | CreateNoWindow = true
96 | };
97 | Process.Start(psi);
98 | break;
99 |
100 | case "restart_explorer":
101 | psi = new ProcessStartInfo
102 | {
103 | FileName = "taskkill",
104 | Arguments = "/F /IM explorer.exe",
105 | RedirectStandardOutput = true,
106 | RedirectStandardError = true,
107 | UseShellExecute = false,
108 | CreateNoWindow = true
109 | };
110 |
111 | var process = Process.Start(psi);
112 | process?.WaitForExit(); // Ensure Explorer is fully terminated before restarting
113 |
114 | psi = new ProcessStartInfo
115 | {
116 | FileName = "explorer.exe",
117 | UseShellExecute = true
118 | };
119 | Process.Start(psi);
120 | break;
121 |
122 | case "restart_system":
123 | psi = new ProcessStartInfo
124 | {
125 | FileName = "shutdown",
126 | Arguments = "/r /t 0",
127 | UseShellExecute = false,
128 | CreateNoWindow = true
129 | };
130 | Process.Start(psi);
131 | break;
132 |
133 | default:
134 | LoggerHelper.Log("Unknown action.");
135 | break;
136 | }
137 | }
138 | public static void SetRegistryValue(RegistryKey rootKey, string keyPath, string valueName, object value, RegistryValueKind valueKind = RegistryValueKind.DWord)
139 | {
140 | try
141 | {
142 | using (RegistryKey key = rootKey.OpenSubKey(keyPath, writable: true))
143 | {
144 | if (key != null)
145 | {
146 | key.SetValue(valueName, value, valueKind);
147 | }
148 | else
149 | {
150 | using (RegistryKey newKey = rootKey.CreateSubKey(keyPath, writable: true))
151 | {
152 | newKey?.SetValue(valueName, value, valueKind);
153 | }
154 | }
155 | }
156 |
157 | LoggerHelper.Log($"Successfully set {valueName} in {keyPath}");
158 | }
159 | catch (Exception ex)
160 | {
161 | LoggerHelper.Log($"Registry Error: {ex.Message} in {keyPath}");
162 | }
163 | }
164 | public static void DeleteRegistryValue(RegistryKey rootKey, string keyPath, string valueName)
165 | {
166 | try
167 | {
168 | using (RegistryKey key = rootKey.OpenSubKey(keyPath, writable: true))
169 | {
170 | if (key != null && key.GetValue(valueName) != null)
171 | {
172 | key.DeleteValue(valueName);
173 | LoggerHelper.Log($"Successfully deleted {valueName} from {keyPath}");
174 | }
175 | }
176 | }
177 | catch (Exception ex)
178 | {
179 | LoggerHelper.Log($"Error deleting registry value: {ex.Message} from {keyPath}");
180 | }
181 | }
182 | ///
183 | /// Deletes a registry key and all its subkeys.
184 | ///
185 | public static void DeleteRegistryKey(RegistryKey rootKey, string keyPath)
186 | {
187 | try
188 | {
189 | rootKey.DeleteSubKeyTree(keyPath, throwOnMissingSubKey: false);
190 | LoggerHelper.Log($"Successfully deleted: {keyPath}");
191 | }
192 | catch (Exception ex)
193 | {
194 | LoggerHelper.Log($"Error deleting registry key: {ex.Message}from {keyPath} ");
195 | }
196 | }
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/Win11 Tweaker/SettingsHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using IniParser;
4 | using IniParser.Model;
5 |
6 | namespace Win11_Tweaker
7 | {
8 |
9 |
10 |
11 | public static class SettingsHelper
12 | {
13 | private static string configPath = Path.Combine(AppContext.BaseDirectory, "settings.ini");
14 |
15 | public static bool LoadToggleState(string key)
16 | {
17 | if (!File.Exists(configPath))
18 | return false; // Default to 'false' if no config file exists
19 |
20 | var parser = new FileIniDataParser();
21 | IniData data = parser.ReadFile(configPath);
22 |
23 | // ✅ Ensure "Toggles" section exists before accessing it
24 | if (!data.Sections.ContainsSection("Toggles") || !data["Toggles"].ContainsKey(key))
25 | return false;
26 |
27 | return data["Toggles"][key] == "1";
28 | }
29 |
30 |
31 | public static void SaveToggleState(string key, bool isOn)
32 | {
33 | var parser = new FileIniDataParser();
34 | IniData data = File.Exists(configPath) ? parser.ReadFile(configPath) : new IniData();
35 |
36 | // ✅ Ensure "Toggles" section exists
37 | if (!data.Sections.ContainsSection("Toggles"))
38 | data.Sections.AddSection("Toggles");
39 |
40 | data["Toggles"][key] = isOn ? "1" : "0";
41 | parser.WriteFile(configPath, data);
42 | }
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/Win11 Tweaker/ThemeHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Microsoft.UI.Xaml;
3 | using Microsoft.UI.Xaml.Controls;
4 |
5 | namespace Win11_Tweaker
6 | {
7 |
8 | public static class ThemeHelper
9 | {
10 | private static ElementTheme _currentTheme;
11 | private static List _dialogs = new();
12 |
13 | ///
14 | /// Applies the current theme to all registered ContentDialogs.
15 | ///
16 | public static void ApplyThemeToDialogs()
17 | {
18 | foreach (var dialog in _dialogs)
19 | {
20 | dialog.RequestedTheme = _currentTheme;
21 | }
22 | }
23 |
24 | ///
25 | /// Registers a ContentDialog to be updated when the theme changes.
26 | ///
27 | public static void RegisterDialog(ContentDialog dialog)
28 | {
29 | if (!_dialogs.Contains(dialog))
30 | {
31 | _dialogs.Add(dialog);
32 | dialog.RequestedTheme = _currentTheme;
33 | }
34 | }
35 |
36 | ///
37 | /// Unregisters a ContentDialog when it's closed.
38 | ///
39 | public static void UnregisterDialog(ContentDialog dialog)
40 | {
41 | _dialogs.Remove(dialog);
42 | }
43 |
44 | ///
45 | /// Updates the stored theme and applies it to all dialogs.
46 | ///
47 | public static void UpdateTheme(ElementTheme newTheme)
48 | {
49 | _currentTheme = newTheme;
50 | ApplyThemeToDialogs();
51 | }
52 | }
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/Win11 Tweaker/ToggleStateHelper.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Diagnostics;
3 | using Microsoft.UI.Xaml;
4 | using Microsoft.UI.Xaml.Controls;
5 | using Microsoft.UI.Xaml.Media;
6 |
7 | namespace Win11_Tweaker
8 | {
9 | class ToggleStateHelper
10 | {
11 | public static void LoadToggleStates(UIElement root, RoutedEventHandler toggleHandler)
12 | {
13 | ScrollViewer scrollViewer = FindChild(root);
14 | if (scrollViewer == null)
15 | {
16 | Debug.WriteLine("Error: ScrollViewer not found.");
17 | return;
18 | }
19 |
20 | FrameworkElement searchRoot = scrollViewer.Content as FrameworkElement;
21 | if (searchRoot == null)
22 | {
23 | Debug.WriteLine("Error: Unable to find UI content inside ScrollViewer.");
24 | return;
25 | }
26 |
27 | Debug.WriteLine($"Searching inside {searchRoot.GetType().Name}");
28 |
29 | var toggles = FindChildren(searchRoot);
30 | if (toggles.Count == 0)
31 | {
32 | Debug.WriteLine("No ToggleSwitch controls found in the UI.");
33 | return;
34 | }
35 |
36 | foreach (var toggleSwitch in toggles)
37 | {
38 | if (!string.IsNullOrEmpty(toggleSwitch.Name))
39 | {
40 | toggleSwitch.Toggled -= toggleHandler;
41 | toggleSwitch.IsOn = SettingsHelper.LoadToggleState(toggleSwitch.Name);
42 | toggleSwitch.Toggled += toggleHandler;
43 | Debug.WriteLine($"Loaded Toggle: {toggleSwitch.Name} -> {toggleSwitch.IsOn}");
44 | }
45 | else
46 | {
47 | Debug.WriteLine("Found an unnamed ToggleSwitch.");
48 | }
49 | }
50 |
51 | Debug.WriteLine("All toggle states loaded successfully.");
52 | }
53 |
54 | public static List FindChildren(DependencyObject parent) where T : DependencyObject
55 | {
56 | List children = new List();
57 | int count = VisualTreeHelper.GetChildrenCount(parent);
58 |
59 | for (int i = 0; i < count; i++)
60 | {
61 | DependencyObject child = VisualTreeHelper.GetChild(parent, i);
62 | if (child is T tChild)
63 | {
64 | children.Add(tChild);
65 | }
66 | children.AddRange(FindChildren(child));
67 | }
68 |
69 | return children;
70 | }
71 |
72 | public static T FindChild(DependencyObject parent) where T : DependencyObject
73 | {
74 | int count = VisualTreeHelper.GetChildrenCount(parent);
75 | for (int i = 0; i < count; i++)
76 | {
77 | DependencyObject child = VisualTreeHelper.GetChild(parent, i);
78 | if (child is T tChild)
79 | return tChild;
80 | T foundChild = FindChild(child);
81 | if (foundChild != null)
82 | return foundChild;
83 | }
84 | return null;
85 | }
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/Win11 Tweaker/Win11 Tweaker.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | WinExe
4 | net8.0-windows10.0.19041.0
5 | 10.0.17763.0
6 | Win11_Tweaker
7 | x86;x64;ARM64
8 | win-x86;win-x64;win-arm64
9 | win-$(Platform).pubxml
10 | true
11 | true
12 | None
13 | enable
14 | true
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
38 |
39 |
40 | PreserveNewest
41 | PreserveNewest
42 | Case Converter.exe
43 |
44 |
45 | PreserveNewest
46 | PreserveNewest
47 | Case Converter.ini
48 |
49 |
50 | PreserveNewest
51 | PreserveNewest
52 | Clean Desktop.exe
53 |
54 |
55 |
56 |
57 |
58 |
63 |
64 |
65 |
66 |
67 |
68 | True
69 | \
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
86 |
87 | true
88 |
89 |
90 |
91 |
92 | False
93 | True
94 | False
95 | True
96 | app.manifest
97 | win11tweaker icon.ico
98 | win11tweaker icon.png
99 |
100 |
101 | True
102 |
103 |
104 | True
105 |
106 |
107 | True
108 |
109 |
110 | True
111 |
112 |
113 | True
114 |
115 |
116 | True
117 |
118 |
--------------------------------------------------------------------------------
/Win11 Tweaker/WindowHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Microsoft.UI;
4 | using Microsoft.UI.Composition.SystemBackdrops;
5 | using Microsoft.UI.Windowing;
6 | using Microsoft.UI.Xaml;
7 | using Microsoft.UI.Xaml.Media;
8 | using Windows.Graphics;
9 | using WinRT.Interop;
10 |
11 | namespace Win11_Tweaker.Helpers
12 | {
13 | public class WindowHelper
14 | {
15 | private readonly Window _window;
16 | private AppWindow _appWindow;
17 | private IntPtr _hWnd;
18 | private SystemBackdropConfiguration _configurationSource;
19 | private MicaBackdrop _micaBackdrop;
20 | private bool _micaEnabled;
21 |
22 | private int _minWidth = 570;
23 | private int _minHeight = 600;
24 |
25 | // Add DPI-related imports and constants
26 | [DllImport("user32.dll")]
27 | private static extern int GetDpiForWindow(IntPtr hWnd);
28 |
29 | private const int USER_DEFAULT_SCREEN_DPI = 96;
30 |
31 | public delegate int SUBCLASSPROC(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, uint dwRefData);
32 |
33 | [DllImport("Comctl32.dll", SetLastError = true)]
34 | public static extern bool SetWindowSubclass(IntPtr hWnd, SUBCLASSPROC pfnSubclass, uint uIdSubclass, uint dwRefData);
35 |
36 | [DllImport("Comctl32.dll", SetLastError = true)]
37 | public static extern int DefSubclassProc(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam);
38 |
39 | private const int WM_GETMINMAXINFO = 0x0024;
40 |
41 | private struct MINMAXINFO
42 | {
43 | public System.Drawing.Point ptReserved;
44 | public System.Drawing.Point ptMaxSize;
45 | public System.Drawing.Point ptMaxPosition;
46 | public System.Drawing.Point ptMinTrackSize;
47 | public System.Drawing.Point ptMaxTrackSize;
48 | }
49 |
50 | private readonly SUBCLASSPROC _subClassDelegate;
51 |
52 | public WindowHelper(Window window)
53 | {
54 | _window = window ?? throw new ArgumentNullException(nameof(window));
55 | _subClassDelegate = new SUBCLASSPROC(WindowSubClass);
56 | InitializeWindow();
57 | }
58 |
59 | ///
60 | /// Gets the AppWindow associated with this helper.
61 | ///
62 | public AppWindow AppWindow => _appWindow;
63 |
64 | ///
65 | /// Gets the native window handle.
66 | ///
67 | public IntPtr WindowHandle => _hWnd;
68 |
69 | ///
70 | /// Gets or sets whether Mica is enabled.
71 | ///
72 | public bool MicaEnabled
73 | {
74 | get => _micaEnabled;
75 | set
76 | {
77 | _micaEnabled = value;
78 | TrySetMicaBackdrop();
79 | }
80 | }
81 |
82 | ///
83 | /// Gets or sets the minimum window size.
84 | ///
85 | public (int Width, int Height) MinimumSize
86 | {
87 | get => (_minWidth, _minHeight);
88 | set
89 | {
90 | _minWidth = value.Width;
91 | _minHeight = value.Height;
92 | }
93 | }
94 |
95 | ///
96 | /// Gets or sets the window size.
97 | ///
98 | public (int Width, int Height) WindowSize
99 | {
100 | get => (_appWindow.Size.Width, _appWindow.Size.Height);
101 | set => SetSize(value.Width, value.Height);
102 | }
103 |
104 | ///
105 | /// Gets the current DPI scaling factor for the window
106 | ///
107 | public float GetDpiScale()
108 | {
109 | int dpi = GetDpiForWindow(_hWnd);
110 | return (float)dpi / USER_DEFAULT_SCREEN_DPI;
111 | }
112 |
113 | private void InitializeWindow()
114 | {
115 | _hWnd = WindowNative.GetWindowHandle(_window);
116 | var windowId = Win32Interop.GetWindowIdFromWindow(_hWnd);
117 | _appWindow = AppWindow.GetFromWindowId(windowId);
118 |
119 | SetWindowSubclass(_hWnd, _subClassDelegate, 0, 0);
120 | SetSize(710, 850);
121 | TrySetMicaBackdrop();
122 | CenterWindow();
123 | CustomizeTitleBar();
124 | if (_window.Content is FrameworkElement root)
125 | {
126 | root.ActualThemeChanged += (sender, args) =>
127 | {
128 | UpdateTheme(root.ActualTheme);
129 | };
130 | }
131 | }
132 |
133 | private void UpdateTheme(ElementTheme newTheme)
134 | {
135 | if (_configurationSource != null)
136 | {
137 | _configurationSource.Theme = newTheme == ElementTheme.Dark
138 | ? SystemBackdropTheme.Dark
139 | : SystemBackdropTheme.Light;
140 | }
141 |
142 | TrySetMicaBackdrop();
143 | UpdateTitleBarColors();
144 |
145 | // Apply theme to all dialogs
146 | ThemeHelper.UpdateTheme(newTheme);
147 | }
148 |
149 | private void RefreshThemeResources()
150 | {
151 | if (_window.Content is FrameworkElement root)
152 | {
153 | root.Resources.MergedDictionaries.Clear(); // Clear old theme resources
154 | root.RequestedTheme = root.ActualTheme; // Force UI refresh
155 | }
156 | }
157 |
158 | ///
159 | /// Sets the window size, accounting for display scaling.
160 | ///
161 | public void SetSize(int width, int height)
162 | {
163 | // Apply DPI scaling when setting size
164 | float scale = GetDpiScale();
165 | int scaledWidth = (int)(width * scale);
166 | int scaledHeight = (int)(height * scale);
167 | _appWindow.Resize(new SizeInt32(scaledWidth, scaledHeight));
168 | }
169 |
170 | ///
171 | /// Sets the logical window size, accounting for display scaling.
172 | ///
173 | public void SetLogicalSize(int logicalWidth, int logicalHeight)
174 | {
175 | _appWindow.Resize(new SizeInt32(logicalWidth, logicalHeight));
176 | }
177 |
178 | ///
179 | /// Attempts to apply the Mica backdrop effect.
180 | ///
181 | private void TrySetMicaBackdrop()
182 | {
183 | if (!MicaController.IsSupported() || !_micaEnabled)
184 | {
185 | _window.SystemBackdrop = null;
186 | return;
187 | }
188 |
189 | if (_micaBackdrop == null)
190 | {
191 | _micaBackdrop = new MicaBackdrop();
192 | }
193 |
194 | if (_configurationSource == null)
195 | {
196 | _configurationSource = new SystemBackdropConfiguration();
197 | }
198 |
199 | _configurationSource.Theme = (_window.Content as FrameworkElement)?.ActualTheme == ElementTheme.Dark
200 | ? SystemBackdropTheme.Dark
201 | : SystemBackdropTheme.Light;
202 |
203 | _window.SystemBackdrop = _micaBackdrop;
204 | }
205 |
206 | ///
207 | /// Centers the window on the screen.
208 | ///
209 | private void CenterWindow()
210 | {
211 | var displayArea = DisplayArea.GetFromWindowId(_appWindow.Id, DisplayAreaFallback.Primary);
212 | var centerX = (displayArea.WorkArea.Width - _appWindow.Size.Width) / 2;
213 | var centerY = (displayArea.WorkArea.Height - _appWindow.Size.Height) / 2;
214 | _appWindow.Move(new PointInt32(centerX, centerY));
215 | }
216 |
217 | ///
218 | /// Customizes the title bar.
219 | ///
220 | private void CustomizeTitleBar()
221 | {
222 | if (_appWindow == null) return;
223 |
224 | var titleBar = _appWindow.TitleBar;
225 | titleBar.ExtendsContentIntoTitleBar = true;
226 | titleBar.ButtonBackgroundColor = Colors.Transparent;
227 | titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
228 |
229 | _window.SetTitleBar(null);
230 | }
231 |
232 | private void UpdateTitleBarColors()
233 | {
234 | var titleBar = _appWindow.TitleBar;
235 | var isDarkMode = (_window.Content as FrameworkElement)?.ActualTheme == ElementTheme.Dark;
236 |
237 | titleBar.ButtonForegroundColor = isDarkMode ? Colors.White : Colors.Black;
238 | }
239 |
240 | ///
241 | /// Handles setting the minimum window size.
242 | ///
243 | private int WindowSubClass(IntPtr hWnd, uint uMsg, IntPtr wParam, IntPtr lParam, IntPtr uIdSubclass, uint dwRefData)
244 | {
245 | if (uMsg == WM_GETMINMAXINFO)
246 | {
247 | MINMAXINFO mmi = (MINMAXINFO)Marshal.PtrToStructure(lParam, typeof(MINMAXINFO));
248 |
249 | // Apply DPI scaling to minimum size
250 | float scale = GetDpiScale();
251 | mmi.ptMinTrackSize.X = (int)(_minWidth * scale);
252 | mmi.ptMinTrackSize.Y = (int)(_minHeight * scale);
253 |
254 | Marshal.StructureToPtr(mmi, lParam, false);
255 | return 0;
256 | }
257 | return DefSubclassProc(hWnd, uMsg, wParam, lParam);
258 | }
259 | }
260 | }
--------------------------------------------------------------------------------
/Win11 Tweaker/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | PerMonitorV2
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Win11 Tweaker/win11tweaker icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iandiv/Win11Tweaker/90110cccd073121cde41d7b6d355687c4d0f5986/Win11 Tweaker/win11tweaker icon.ico
--------------------------------------------------------------------------------
/publish.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | echo Publishing Win11 Tweaker...
3 | cd Win11 Tweaker
4 | dotnet publish -c Release -r win-x64 --self-contained true
5 | echo Publish complete!
6 | pause
7 |
--------------------------------------------------------------------------------