<?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: Dzmitry Salavei</title>
    <description>The latest articles on DEV Community by Dzmitry Salavei (@demonazgh).</description>
    <link>https://dev.to/demonazgh</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%2F842475%2F0dc001b0-cdd8-4a55-8a12-7efb373a35f8.png</url>
      <title>DEV Community: Dzmitry Salavei</title>
      <link>https://dev.to/demonazgh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/demonazgh"/>
    <language>en</language>
    <item>
      <title>I rewrote my Electron app in Tauri and cut the installer from 120MB to 8MB — here's what actually broke</title>
      <dc:creator>Dzmitry Salavei</dc:creator>
      <pubDate>Sun, 31 May 2026 22:29:24 +0000</pubDate>
      <link>https://dev.to/demonazgh/i-rewrote-my-electron-app-in-tauri-and-cut-the-installer-from-120mb-to-8mb-heres-what-actually-40lh</link>
      <guid>https://dev.to/demonazgh/i-rewrote-my-electron-app-in-tauri-and-cut-the-installer-from-120mb-to-8mb-heres-what-actually-40lh</guid>
      <description>&lt;h2&gt;
  
  
  The problem with Electron
&lt;/h2&gt;

&lt;p&gt;I built the first version of LazyWords in Electron. It worked. It also shipped a 120MB installer for an app whose entire job is showing a small floating flashcard every few minutes.&lt;/p&gt;

&lt;p&gt;That felt wrong. So I rewrote it in Tauri v2.&lt;/p&gt;

&lt;p&gt;Final result: 8MB installer, same functionality, noticeably less RAM. But the migration wasn't smooth — here's what actually bit me.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is LazyWords
&lt;/h2&gt;

&lt;p&gt;Before the technical stuff: LazyWords is a passive vocabulary app for Windows. It runs in the system tray and shows word flashcards as an always-on-top overlay over whatever you're working on. Cards appear every few minutes, stay a few seconds, disappear. No interaction required.&lt;/p&gt;

&lt;p&gt;The idea was "radio for vocabulary" — you don't focus on it, but it's there, and things stick over time.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5n206r7cpkll2v4yzpb.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo5n206r7cpkll2v4yzpb.gif" alt="LazyWords demo" width="720" height="540"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  What broke during migration
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Global shortcuts behaved differently
&lt;/h3&gt;

&lt;p&gt;Electron's &lt;code&gt;globalShortcut&lt;/code&gt; and Tauri's plugin handle edge cases differently. My main issue was &lt;code&gt;Ctrl+Shift+N&lt;/code&gt; — show next card immediately. In the Electron version this was straightforward. In Tauri I needed the shortcut to both show a card &lt;em&gt;and&lt;/em&gt; reset the timer interval, without triggering a double card.&lt;/p&gt;

&lt;p&gt;The fix was a &lt;code&gt;manual_trigger&lt;/code&gt; Tokio &lt;code&gt;Notify&lt;/code&gt; in the timer loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="nn"&gt;tokio&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nd"&gt;select!&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;tokio&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;time&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;Duration&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from_secs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
    &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;manual_trigger&lt;/span&gt;&lt;span class="nf"&gt;.notified&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the shortcut fires, it notifies the trigger, the timer resets its interval. Clean, no double card.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Always-on-top + fullscreen detection
&lt;/h3&gt;

&lt;p&gt;Getting a transparent frameless window that floats over normal apps but disappears during actual fullscreen (games, video players, presentations) had no built-in Tauri solution. I ended up calling &lt;code&gt;winapi&lt;/code&gt; directly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;unsafe&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;hwnd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;GetForegroundWindow&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;monitor_info&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;MONITORINFO&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;mem&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;zeroed&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;monitor_info&lt;/span&gt;&lt;span class="py"&gt;.cbSize&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;std&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;mem&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;size_of&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MONITORINFO&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nb"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;monitor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;MonitorFromWindow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hwnd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MONITOR_DEFAULTTONEAREST&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nf"&gt;GetMonitorInfoW&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;monitor&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;mut&lt;/span&gt; &lt;span class="n"&gt;monitor_info&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="c1"&gt;// compare window rect to monitor rect&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Not pretty, but it works reliably.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Settings window deadlock on first open
&lt;/h3&gt;

&lt;p&gt;If you create the settings window on demand (on &lt;code&gt;Ctrl+Shift+W&lt;/code&gt;), there's a subtle deadlock risk on the first call when AppState is involved. The fix was to pre-create the settings window hidden at startup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// At startup — create hidden, never destroy&lt;/span&gt;
&lt;span class="n"&gt;settings_window&lt;/span&gt;&lt;span class="nf"&gt;.hide&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// On shortcut — just show it&lt;/span&gt;
&lt;span class="n"&gt;settings_window&lt;/span&gt;&lt;span class="nf"&gt;.show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="n"&gt;settings_window&lt;/span&gt;&lt;span class="nf"&gt;.set_focus&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also intercepting &lt;code&gt;CloseRequested&lt;/code&gt; with &lt;code&gt;prevent_close()&lt;/code&gt; + &lt;code&gt;hide()&lt;/code&gt; so the window is never destroyed — just hidden. This also fixed the window only being openable once.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Single-instance lock
&lt;/h3&gt;

&lt;p&gt;Electron has this built in. In Tauri on Windows I handled it manually with a named mutex:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;mutex_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;windows&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;core&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nd"&gt;w!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"LazyWords_SingleInstanceMutex"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;mutex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;CreateMutexW&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mutex_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nf"&gt;GetLastError&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;ERROR_ALREADY_EXISTS&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(());&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Second launch exits immediately, first instance continues normally.&lt;/p&gt;




&lt;h2&gt;
  
  
  What worked better than expected
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Multi-monitor positioning.&lt;/strong&gt; Tauri's &lt;code&gt;cursor_position()&lt;/code&gt; + &lt;code&gt;available_monitors()&lt;/code&gt; just worked. The card always appears on whichever monitor the cursor is on, no hacks needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The async timer loop.&lt;/strong&gt; Tokio's &lt;code&gt;select!&lt;/code&gt; macro made the timer logic genuinely elegant — sleeping on interval OR manual trigger, whichever comes first. This would have been messier in Electron.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bundle size.&lt;/strong&gt; 8MB vs 120MB speaks for itself. Tauri uses the system WebView (WebView2 on Windows) instead of bundling Chromium.&lt;/p&gt;




&lt;h2&gt;
  
  
  The AI-assisted workflow
&lt;/h2&gt;

&lt;p&gt;One more thing worth mentioning: this app was built almost entirely with Claude.&lt;/p&gt;

&lt;p&gt;The workflow that worked for me:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Describe a feature or bug to Claude in chat&lt;/li&gt;
&lt;li&gt;Claude produces a Markdown task spec — what to implement, edge cases, approach&lt;/li&gt;
&lt;li&gt;Paste the spec into Claude Code in VS Code terminal&lt;/li&gt;
&lt;li&gt;Claude Code implements it&lt;/li&gt;
&lt;li&gt;Test, report results, iterate&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The key insight: Claude chat is good at architecture and tradeoffs. Claude Code is good at executing a well-scoped task. Separating the two produced much better results than asking Claude Code to also design the solution.&lt;/p&gt;

&lt;p&gt;I also keep a &lt;code&gt;CLAUDE.md&lt;/code&gt; in the repo root that Claude Code reads at the start of every session — current architecture, known bugs, version history. Without it, context resets every session.&lt;/p&gt;




&lt;h2&gt;
  
  
  Result
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Before (Electron)&lt;/th&gt;
&lt;th&gt;After (Tauri v2)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Installer size&lt;/td&gt;
&lt;td&gt;~120MB&lt;/td&gt;
&lt;td&gt;~8MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;RAM idle&lt;/td&gt;
&lt;td&gt;~200MB&lt;/td&gt;
&lt;td&gt;~30MB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unit tests&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;27&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Live on Microsoft Store and GitHub.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/DemonazGH/LazyWords-Tauri" rel="noopener noreferrer"&gt;github.com/DemonazGH/LazyWords-Tauri&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy to answer questions about any of the Tauri-specific solutions above.&lt;/p&gt;

</description>
      <category>tauri</category>
      <category>rust</category>
      <category>electron</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
