<?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: Saikat Roy</title>
    <description>The latest articles on DEV Community by Saikat Roy (@njmsaikat).</description>
    <link>https://dev.to/njmsaikat</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F803772%2F4dcd43cc-6195-44b0-92f7-82272b5a6199.jpeg</url>
      <title>DEV Community: Saikat Roy</title>
      <link>https://dev.to/njmsaikat</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/njmsaikat"/>
    <language>en</language>
    <item>
      <title>I missed Windows' Win+V on Linux, so I built it in 360 KB of C</title>
      <dc:creator>Saikat Roy</dc:creator>
      <pubDate>Sat, 14 Nov 2026 06:19:39 +0000</pubDate>
      <link>https://dev.to/njmsaikat/i-missed-windows-winv-on-linux-so-i-built-it-in-360-kb-of-c-4fdk</link>
      <guid>https://dev.to/njmsaikat/i-missed-windows-winv-on-linux-so-i-built-it-in-360-kb-of-c-4fdk</guid>
      <description>&lt;p&gt;I moved from Windows to Linux a while ago, and I was happy with almost everything. Almost. Every few minutes my fingers pressed &lt;strong&gt;Win+V&lt;/strong&gt; out of habit, expecting the little clipboard history panel that Windows has had since 2018. On Linux, nothing happened.&lt;/p&gt;

&lt;p&gt;So I built it. &lt;strong&gt;SuperV&lt;/strong&gt; brings Windows' Win+V clipboard history to Linux, and over a few releases it grew a few more Windows shortcuts I missed: the Win+. emoji panel, Win+Shift+S screenshots, copying text from the screen, a colour picker and paste-as-plain-text.&lt;/p&gt;

&lt;p&gt;This post is the story of how it works, the parts that were harder than they looked, and how I kept the whole thing to a single program of about 360 KB.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqwi1tfhf96xie17a8aim.png" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqwi1tfhf96xie17a8aim.png" alt="SuperV clipboard history panel, dark and light" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What it does
&lt;/h2&gt;

&lt;p&gt;Press &lt;strong&gt;Super+V&lt;/strong&gt; and a small panel shows the last 25 things you copied, text and images. Click one (or press Enter) and it is pasted straight into the app you were using. You can pin items you want to keep; everything else is cleared when you reboot, exactly like Windows.&lt;/p&gt;

&lt;p&gt;One thing Windows doesn't do: if you paste several items one after another, SuperV puts a ✓ on each one you've already pasted, marks the latest as &lt;strong&gt;Last pasted&lt;/strong&gt;, and opens the next time with the following item already selected. Copy ten things, then press Super+V, Enter, Super+V, Enter… without losing your place.&lt;/p&gt;

&lt;p&gt;Everything else is &lt;strong&gt;off until you turn it on&lt;/strong&gt; in the settings:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Shortcut&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Super+.&lt;/td&gt;
&lt;td&gt;Emoji panel: emoji, kaomoji ¯\_(ツ)_/¯ and symbols, typed where you're writing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Super+Shift+S&lt;/td&gt;
&lt;td&gt;Screenshot tool: select an area, draw arrows, boxes, text, blur or numbers, then copy, save or pin it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Super+Shift+T&lt;/td&gt;
&lt;td&gt;Copy text from anywhere on screen (OCR with Tesseract, offline)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Super+Shift+C&lt;/td&gt;
&lt;td&gt;Colour picker: HEX, RGB and HSL&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ctrl+Super+Alt+V&lt;/td&gt;
&lt;td&gt;Paste as plain text&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A feature that is off isn't loaded and doesn't hold its shortcut, so your desktop keeps it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rules I set myself
&lt;/h2&gt;

&lt;p&gt;Before writing any code I wrote down what I wanted, because clipboard managers are something you run all day:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Tiny.&lt;/strong&gt; No Electron, no runtime, no background polling. It should cost nothing when you're not using it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant.&lt;/strong&gt; The panel has to be on screen the moment you press the key. Anything slow on that path is a bug.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Private.&lt;/strong&gt; No network access at all, history stored only on your machine, and passwords from password managers never recorded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Behave like Windows.&lt;/strong&gt; Same keys, same habits, unless there's a good Linux reason not to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Work everywhere.&lt;/strong&gt; GNOME, Cinnamon, MATE, Xfce and KDE Plasma, on Wayland and X11.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That pointed to &lt;strong&gt;C and GTK 3&lt;/strong&gt;. GTK 3 is already loaded by most Linux desktops, so the program itself only has to carry its own logic.&lt;/p&gt;

&lt;h2&gt;
  
  
  Watching the clipboard without polling
&lt;/h2&gt;

&lt;p&gt;The naive way to build a clipboard history is to check the clipboard every half second. That wakes the CPU forever and still misses things.&lt;/p&gt;

&lt;p&gt;SuperV listens to &lt;strong&gt;XFixes selection events&lt;/strong&gt; instead: the X server tells it when the clipboard's owner changes, and only then does it read the new content. Between copies the process is asleep; idle CPU use is literally zero.&lt;/p&gt;

&lt;p&gt;But what about Wayland? SuperV runs as an X11 client, through XWayland on Wayland desktops. GNOME (and most other Wayland desktops) keeps the Wayland and XWayland clipboards in sync, so copies from native Wayland apps show up too. It's not the "pure" Wayland approach, but it works today on every major desktop with no extensions or portals.&lt;/p&gt;

&lt;p&gt;When an app offers several formats, SuperV picks carefully. Images are stored as images, text as text, and a few traps need special handling: office suites offer a picture of the selected text alongside the real text, so those copies are stored as text. Copies marked with &lt;code&gt;x-kde-passwordManagerHint&lt;/code&gt; (what KeePassXC and others set for passwords) are skipped entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hard part: pasting into another app
&lt;/h2&gt;

&lt;p&gt;Showing a list is easy. &lt;strong&gt;Pasting&lt;/strong&gt; the item you picked into the app you were using is not.&lt;/p&gt;

&lt;p&gt;On Windows, the clipboard panel simply pastes. On Linux, an app can put data on the clipboard, but it can't make another app paste it. So SuperV does what you would do: it puts the item on the clipboard, gives focus back to your app, and &lt;strong&gt;presses the paste keys for you&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Which keys? Ctrl+V doesn't work in terminals, and Ctrl+Shift+V doesn't work in most other apps. &lt;strong&gt;Shift+Insert&lt;/strong&gt; pastes in both, on any keyboard layout. So SuperV puts the item on both the CLIPBOARD and PRIMARY selections and presses Shift+Insert.&lt;/p&gt;

&lt;p&gt;Pressing keys is the next problem:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;On &lt;strong&gt;X11&lt;/strong&gt;, the XTest extension lets an app send key presses. Easy.&lt;/li&gt;
&lt;li&gt;On &lt;strong&gt;Wayland&lt;/strong&gt;, apps can't fake input into other apps, by design. The only reliable way is a virtual keyboard through the kernel's &lt;strong&gt;uinput&lt;/strong&gt; device, which needs a one-time permission: a udev rule that lets the logged-in user open &lt;code&gt;/dev/uinput&lt;/code&gt;. The packages install that rule; without it, SuperV shows an &lt;strong&gt;Enable&lt;/strong&gt; button that asks for your password through the desktop's normal dialog.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The emoji panel that never steals focus
&lt;/h2&gt;

&lt;p&gt;An emoji panel has an odd requirement: you type in its search box, but the emoji has to appear in &lt;em&gt;another&lt;/em&gt; app, and the panel should stay open so you can pick several in a row.&lt;/p&gt;

&lt;p&gt;If the panel took keyboard focus like a normal window, your app would lose focus and the emoji couldn't be typed into it. So the visible panel never takes focus at all. An invisible 1×1 pixel helper window holds the keyboard and forwards keys to the panel. When you pick an emoji:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;SuperV remembers what's on your clipboard.&lt;/li&gt;
&lt;li&gt;It puts the emoji on the clipboard, marked as a password so clipboard histories (including its own) don't record it.&lt;/li&gt;
&lt;li&gt;It hands focus back to your app and presses Shift+Insert.&lt;/li&gt;
&lt;li&gt;As soon as the app has read the emoji, it puts your original clipboard back, and takes the keyboard again for the next pick.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All 2,800 emoji, kaomoji and symbols, with their search keywords from Unicode's CLDR data, are compiled into the program. No data files, no downloads.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjzr28cwf4rcmn1enqgj9.png" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjzr28cwf4rcmn1enqgj9.png" alt="The emoji panel" width="400" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Screenshots without the "Share screenshot?" dialog
&lt;/h2&gt;

&lt;p&gt;The screenshot tool works like Flameshot: the screen freezes, you drag over an area, annotate it, then copy, save or pin it on top of everything.&lt;/p&gt;

&lt;p&gt;On X11, reading the screen is one function call. On GNOME's Wayland session it isn't: apps must ask through the desktop portal, and GNOME shows a "Share screenshot?" dialog &lt;strong&gt;every single time&lt;/strong&gt;. For a tool you use dozens of times a day, that's unusable.&lt;/p&gt;

&lt;p&gt;GNOME's own screenshot shortcut, though, takes a picture instantly with no dialog. So SuperV presses it for you (through the same virtual keyboard), watches GNOME's Screenshots folder, takes the picture GNOME saves, deletes the file, and puts back what you had on the clipboard. A few details made this robust:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It only takes a picture GNOME made &lt;strong&gt;after&lt;/strong&gt; the key press, identified by the &lt;code&gt;Software=gnome-screenshot&lt;/code&gt; tag GNOME writes into the PNG. A picture you saved in that folder yourself is never touched.&lt;/li&gt;
&lt;li&gt;The Screenshots folder name is translated (on a Bengali desktop it's "স্ক্রিনশট"), so SuperV asks GNOME's own translation for it.&lt;/li&gt;
&lt;li&gt;If GNOME doesn't answer within a few seconds, it falls back to the portal.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The same frozen screen is used for &lt;strong&gt;Super+Shift+T&lt;/strong&gt;: drag over some text, let go, and Tesseract reads it locally and copies the text.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making it fast
&lt;/h2&gt;

&lt;p&gt;My target was "the panel is there before you notice it opening." Measuring showed I wasn't there yet: with ten large images in the history, the &lt;strong&gt;first&lt;/strong&gt; opening of the panel took &lt;strong&gt;562 ms&lt;/strong&gt;, because every row decoded a full-size PNG to draw its preview.&lt;/p&gt;

&lt;p&gt;The fixes, roughly in order of impact:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Small previews.&lt;/strong&gt; Each image gets a small preview file next to the full one, and the list only loads those.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Saving in the background.&lt;/strong&gt; Hashing and saving a 4K screenshot happens in a worker thread, so copying never makes the panel wait.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build rows only when something changed.&lt;/strong&gt; The list is rebuilt only if the history changed since it was last shown; reopening just shows it again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Warm up quietly.&lt;/strong&gt; A window's first opening is its slowest: GTK loads fonts and styles and measures every label. SuperV does that once in the background after login.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Redraw only what moved.&lt;/strong&gt; In the screenshot tool and colour picker, a mouse move used to repaint the entire frozen screen (two 4K monitors, sixty times a second). Now only the area around the pointer, or around the selection, is redrawn, from a surface prepared once.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now the clipboard panel opens in about &lt;strong&gt;30 ms&lt;/strong&gt;, the first time after login in about 50 ms, and with ten pictures in the history the first opening takes about 100 ms instead of 562.&lt;/p&gt;

&lt;p&gt;Memory got the same treatment. Only what's turned on is loaded. Rows and previews are freed a few minutes after the panel closes, and the screenshot tool frees the frozen screen as soon as you're done. glibc is asked to give memory back (&lt;code&gt;malloc_trim&lt;/code&gt;) after big operations. As installed, with only the clipboard on, SuperV uses about &lt;strong&gt;5.5 MB&lt;/strong&gt; of private memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keyboard shortcuts on five desktops
&lt;/h2&gt;

&lt;p&gt;There is no standard way for an app to say "register Super+V for me." GNOME, Cinnamon, MATE, Xfce and KDE each store custom shortcuts differently, and on Ubuntu Super+V is already taken by the notification list.&lt;/p&gt;

&lt;p&gt;A small Python helper (&lt;code&gt;superv-setup&lt;/code&gt;) handles each desktop: it registers the shortcut, moves a conflicting desktop shortcut out of the way, and records exactly what it changed. Uninstalling puts &lt;strong&gt;exactly&lt;/strong&gt; that back, in the original order, so your desktop ends up as it was. It also has a &lt;code&gt;--doctor&lt;/code&gt; mode that checks everything and says what's wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing what you can't easily test
&lt;/h2&gt;

&lt;p&gt;A clipboard tool is all about interacting with other windows, which is painful to test by hand. I run everything in &lt;strong&gt;Docker&lt;/strong&gt; with a virtual X server (Xvfb) and &lt;code&gt;xdotool&lt;/code&gt; to press keys and click:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;copy text and images, open the panel, paste, and check what arrived;&lt;/li&gt;
&lt;li&gt;take screenshots, draw on them, and compare the copied image;&lt;/li&gt;
&lt;li&gt;set up shortcuts on GNOME, Cinnamon, MATE, Xfce and KDE settings, remove them, and check the desktop is exactly as before;&lt;/li&gt;
&lt;li&gt;repeat every action dozens of times while watching memory, to catch leaks;&lt;/li&gt;
&lt;li&gt;run all of it again under AddressSanitizer and UndefinedBehaviorSanitizer.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;None of it touches my real desktop, and the same scripts measure how fast each panel opens.&lt;/p&gt;

&lt;h2&gt;
  
  
  Packaging
&lt;/h2&gt;

&lt;p&gt;For a desktop tool, installation matters as much as the code. SuperV ships as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;PPA&lt;/strong&gt; for Ubuntu and Linux Mint, so updates arrive through the normal updater;&lt;/li&gt;
&lt;li&gt;a &lt;code&gt;.deb&lt;/code&gt;, an &lt;code&gt;.rpm&lt;/code&gt; (Fedora, openSUSE) and an Arch package, built by GitHub Actions for every release tag;&lt;/li&gt;
&lt;li&gt;an &lt;code&gt;install.sh&lt;/code&gt; for everything else, which builds from source if needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The app restarts itself into the new version after an update, keeping what's on your clipboard.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;p&gt;On Ubuntu or Linux Mint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo add-apt-repository ppa:saikatnjm/superv
sudo apt install superv
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then open &lt;strong&gt;SuperV&lt;/strong&gt; once from your app menu. That sets up Super+V. Turn on the other features in its settings (Super+V, then ⚙).&lt;/p&gt;

&lt;p&gt;Other distros: packages and instructions are on the &lt;a href="https://saikatnjm.github.io/superv/" rel="noopener noreferrer"&gt;website&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Source:&lt;/strong&gt; &lt;a href="https://github.com/saikatnjm/superv" rel="noopener noreferrer"&gt;github.com/saikatnjm/superv&lt;/a&gt; (MIT)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website:&lt;/strong&gt; &lt;a href="https://saikatnjm.github.io/superv/" rel="noopener noreferrer"&gt;saikatnjm.github.io/superv&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's a young project. If you try it, I'd love to hear what works, what breaks on your desktop, and which Windows shortcut you miss most on Linux. And if it saves you time, a ⭐ on GitHub helps other people find it.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>opensource</category>
      <category>showdev</category>
      <category>c</category>
    </item>
  </channel>
</rss>
