<?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: HyphenM</title>
    <description>The latest articles on DEV Community by HyphenM (@hyphenm).</description>
    <link>https://dev.to/hyphenm</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%2F3960673%2F40303400-cd92-426a-a818-5ae8c4e37333.png</url>
      <title>DEV Community: HyphenM</title>
      <link>https://dev.to/hyphenm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hyphenm"/>
    <language>en</language>
    <item>
      <title>Simple Snap Layout Overlay for Tauri v2</title>
      <dc:creator>HyphenM</dc:creator>
      <pubDate>Sun, 31 May 2026 04:52:25 +0000</pubDate>
      <link>https://dev.to/hyphenm/simple-snap-layout-overlay-for-tauri-v2-3op4</link>
      <guid>https://dev.to/hyphenm/simple-snap-layout-overlay-for-tauri-v2-3op4</guid>
      <description>&lt;p&gt;Firstly, hello everyone who reads this.&lt;/p&gt;

&lt;p&gt;I made a little plugin for Tauri v2 to easily enable the Windows 11 snap layout overlay when running your app in decoration-free (borderless) mode. I wanted a sleek and custom look without losing Windows 11 functionality, but I couldn't find an existing solution that quite did it for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quick how it works.
&lt;/h3&gt;

&lt;p&gt;It tracks a specific HTML element ID on your frontend, gets its dimensions, and creates a transparent native overlay. This tricks Windows 11 into bringing up the native snap layout when a user hovers over your custom maximize button.&lt;/p&gt;

&lt;p&gt;Just want to try it? Here's the github.&lt;br&gt;
👉 &lt;a href="https://github.com/Hyph-M/tauri-plugin-snap-layout" rel="noopener noreferrer"&gt;tauri-plugin-snap-layout&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Storytime
&lt;/h1&gt;

&lt;h2&gt;
  
  
  So ... why?
&lt;/h2&gt;

&lt;p&gt;I'm trying to build sort of a productivity helper for the things I'm interested in making (rather than actually making those things because who does that?). I wanted it to be borderless an minimalist.&lt;/p&gt;

&lt;p&gt;However, I quickly found an issue with that on Windows: if you disable native window decorations in Tauri, you lose access to the Windows 11 snap layout overlay.&lt;/p&gt;

&lt;p&gt;I looked around, asked AI, and found awesome projects like &lt;a href="https://github.com/clearlysid/tauri-plugin-decorum" rel="noopener noreferrer"&gt;tauri-plugin-decorum&lt;/a&gt; and &lt;a href="https://github.com/clarifei/tauri-plugin-frame/" rel="noopener noreferrer"&gt;tauri-plugin-frame&lt;/a&gt;. I couldn't work decorum for some reason, I couldn't say why. Frame worked mostly how I wanted it, but I had to tinker in its code to get it exact.&lt;/p&gt;

&lt;p&gt;Worried that updates might break my prodding and poking, I decided to build a focused solution that handles just this one job precisely.&lt;/p&gt;

&lt;h2&gt;
  
  
  I am not a programmer person.
&lt;/h2&gt;

&lt;p&gt;Definitely not a professional one at least. I've messed around with game making, customizing existing things here and there, but never released anything.&lt;/p&gt;

&lt;p&gt;I pretty frankensteined the hell out of bits of frame and my limited understanding. Full disclosure: I used AI to refactor the code and catch edge cases. It claimed to remove deadlocks, race conditions, and unused code. Did it? I couldn't say, but I definitely hope so!&lt;/p&gt;

&lt;p&gt;The development cycle was a beautiful loop of: AI breaks it &amp;gt; I kind of fix it &amp;gt; AI modifies it &amp;gt; I break it this time &amp;gt; AI fixes it. After multiple refactors and rewriting the README three times to get the instructions feeling smooth, it finally worked beautifully.&lt;/p&gt;

&lt;h1&gt;
  
  
  Anyway...
&lt;/h1&gt;

&lt;p&gt;This is basically what it does.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Connects frontend to backend.&lt;/strong&gt; Dynamically getting the HTML Element's dimensions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tricks Windows.&lt;/strong&gt; Intercepts WM_NCHITTEST messages to display the native snap layout overlay, exactly over your button.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handles Clicks.&lt;/strong&gt; Because it intercepts mouse events it needs to act as a native maximize/restore toggle.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Preserves UI States.&lt;/strong&gt; Forwards hover eventsto the frontend, and forces your CSS :hover states to trigger.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Safe Cross-Platform.&lt;/strong&gt; No-Ops on macOS, Linux, and Windows versions older than Windows 11.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Quick Setup
&lt;/h2&gt;

&lt;p&gt;Full instructions are in the repo, but quickly for here.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add&lt;/strong&gt; the crate to &lt;code&gt;Cargo.toml&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Run&lt;/strong&gt; &lt;code&gt;npm install tauri-plugin-snap-layout&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add&lt;/strong&gt; &lt;code&gt;"snap-layout:default"&lt;/code&gt; to the your Tauri permissions in &lt;code&gt;default.json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set&lt;/strong&gt; &lt;code&gt;"decorations": false&lt;/code&gt; in your &lt;code&gt;tauri.conf.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Initialize&lt;/strong&gt; the plugin in &lt;code&gt;lib.rs&lt;/code&gt;.
&lt;code&gt;.plugin(tauri_plugin_snap_layout::init().button_id("your-custom-id").build())&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assign&lt;/strong&gt; the ID to your HTML's maximize button&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Wrapping Up
&lt;/h1&gt;

&lt;p&gt;I don't plan on adding extra features to this because it is meant to do just one thing. If it helps anyone else trying to build custom title bars in Tauri v2, that is awesome!&lt;/p&gt;

&lt;p&gt;Feel free to try it out, submit an issue, or drop a ⭐ on GitHub if it saves you some headache.&lt;/p&gt;

</description>
      <category>tauri</category>
      <category>rust</category>
      <category>webdev</category>
      <category>webview</category>
    </item>
  </channel>
</rss>
