<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Humberto Schoenwald</title>
    <description>The latest articles on DEV Community by Humberto Schoenwald (@humbertoschoenwald).</description>
    <link>https://dev.to/humbertoschoenwald</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3876226%2Fc34ea179-ad20-40ec-ac9b-bb47a5f4f471.jpeg</url>
      <title>DEV Community: Humberto Schoenwald</title>
      <link>https://dev.to/humbertoschoenwald</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/humbertoschoenwald"/>
    <language>en</language>
    <item>
      <title>A .NET 11 Windows theme switcher (Win32 interop &amp; local solar math)</title>
      <dc:creator>Humberto Schoenwald</dc:creator>
      <pubDate>Mon, 13 Apr 2026 09:04:58 +0000</pubDate>
      <link>https://dev.to/humbertoschoenwald/a-net-11-windows-theme-switcher-win32-interop-local-solar-math-271a</link>
      <guid>https://dev.to/humbertoschoenwald/a-net-11-windows-theme-switcher-win32-interop-local-solar-math-271a</guid>
      <description>&lt;p&gt;I just built an app and I want GitHub stars. If it works for your personal use, perfect.&lt;/p&gt;

&lt;p&gt;Now, for the developers (which is probably all of you, haha):&lt;/p&gt;

&lt;p&gt;I built this app for fun and because auto dark-mode is genuinely a feature I miss from macOS when I'm using Windows. I made it extremely lightweight—it currently uses around 34MB active and 8MB idle. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is a fun fact about the development:&lt;/strong&gt; I initially built the first version using WPF. It looked beautiful, but it was consuming around 130MB of RAM just sitting there doing nothing. I knew people were going to hate that, and I knew I could do better. I scrapped that UI layer and rewrote it using raw Win32. Even though I honestly wouldn't care if it consumed 300MB of RAM on my own machine, rewriting it to be that light became a fun optimization challenge.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Another fun fact regarding the repository quality:&lt;/strong&gt; I manually whitelist every single Spanish word used in the &lt;code&gt;LÉEME.md&lt;/code&gt; (Spanish README). Instead of "contaminando" my environment with standard language extensions, I maintain dedicated &lt;code&gt;.txt&lt;/code&gt; dictionaries inside a &lt;code&gt;.cspell&lt;/code&gt; directory. This ensures that only intentional, approved terms are permitted and prevents English typos from being masked as valid Spanish words during the CI process.&lt;/p&gt;

&lt;p&gt;I focused on keeping it private and secure, obviously, without storing coordinates in plain text by using Windows DPAPI. (This doesn't protect your coordinates against a massive virus taking over your PC, but it keeps them properly encrypted locally).&lt;/p&gt;

&lt;h3&gt;
  
  
  Technical implementation facts:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Math over APIs:&lt;/strong&gt; It calculates the solar schedule locally using the Julian day and observer coordinates instead of pinging external weather APIs. It natively handles mathematical edge cases like Polar Nights and Midnight Sun.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native Application Lifecycle:&lt;/strong&gt; I'm bypassing heavy frameworks. The app runs on a sealed &lt;code&gt;NativeApplication&lt;/code&gt; class that handles single-instance locking via &lt;code&gt;Mutex&lt;/code&gt;, manual &lt;code&gt;ServiceProvider&lt;/code&gt; validation, and a pure native Win32 message loop via &lt;code&gt;NativeInterop.RunMessageLoop()&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero UI Frameworks:&lt;/strong&gt; Everything is built using raw Win32 interop via &lt;code&gt;LibraryImport&lt;/code&gt;. To make the theme transition seamless without requiring app restarts or causing screen flickers, it hooks into undocumented &lt;code&gt;uxtheme.dll&lt;/code&gt; exports (#104 and #136).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High-Quality Tooling:&lt;/strong&gt; I set up a strict GitHub Actions pipeline enforcing Conventional Commits via &lt;code&gt;commitlint&lt;/code&gt;, spell-checking via &lt;code&gt;cspell&lt;/code&gt; (using my custom local dictionaries), and automatic CalVer releases.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My purpose in uploading this: to get stars to build reputation and make money from this (using it as a portfolio), besides validating the time I invested in it haha.&lt;/p&gt;

&lt;p&gt;If anyone finds the technical stuff useful to copy, go ahead. Here is what you can learn or reuse from the repo:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to structure a Modular Monolith with Vertical Slices.&lt;/li&gt;
&lt;li&gt;Implementing zero-framework native Win32 UIs in C#.&lt;/li&gt;
&lt;li&gt;Replacing exceptions with the functional &lt;code&gt;Result&amp;lt;T&amp;gt;&lt;/code&gt; pattern.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Bonus:&lt;/strong&gt; I also included my entire &lt;code&gt;.cursor/rules&lt;/code&gt; directory and &lt;code&gt;AGENTS.md&lt;/code&gt;. These are file-scoped rules that prevent AI agents (like Cursor) from hallucinating and keep them strictly following C# 15 / .NET 11 standards.&lt;/p&gt;

&lt;p&gt;🔗 &lt;strong&gt;&lt;a href="https://github.com/humbertoschoenwald/auto-theme-solar-engine" rel="noopener noreferrer"&gt;auto-theme-solar-engine on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>dotnet</category>
      <category>csharp</category>
      <category>windows</category>
    </item>
  </channel>
</rss>
