<?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: Mahdi Hosseinpour</title>
    <description>The latest articles on DEV Community by Mahdi Hosseinpour (@m-hosseinpour).</description>
    <link>https://dev.to/m-hosseinpour</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%2F1009415%2F29cb45ad-d3cc-4558-a076-e26070bdeb77.jpg</url>
      <title>DEV Community: Mahdi Hosseinpour</title>
      <link>https://dev.to/m-hosseinpour</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/m-hosseinpour"/>
    <language>en</language>
    <item>
      <title>Compare Any Two Texts Instantly on Linux (Clipboard + Selection Hack)</title>
      <dc:creator>Mahdi Hosseinpour</dc:creator>
      <pubDate>Fri, 10 Oct 2025 16:30:07 +0000</pubDate>
      <link>https://dev.to/m-hosseinpour/compare-any-two-texts-instantly-on-linux-clipboard-selection-hack-2e6f</link>
      <guid>https://dev.to/m-hosseinpour/compare-any-two-texts-instantly-on-linux-clipboard-selection-hack-2e6f</guid>
      <description>&lt;p&gt;One of my most-used features when coding in IntelliJ is &lt;strong&gt;“Compare with Clipboard”&lt;/strong&gt; — super handy when I want to quickly compare a piece of code with its previous version.&lt;/p&gt;

&lt;p&gt;But when the text or code was &lt;strong&gt;outside IntelliJ&lt;/strong&gt;, I had to open a diff tool manually or use &lt;em&gt;“Open Blank Diff Window”&lt;/em&gt; inside IntelliJ and paste both snippets by hand.&lt;/p&gt;

&lt;p&gt;Recently, I found a much simpler way, and I thought it’s worth sharing here 👇&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(This explanation is for Linux, but Windows users can easily adapt it or… just ask AI 😉)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;🧩 &lt;strong&gt;Setup steps:&lt;/strong&gt;&lt;br&gt;
1️⃣ Install &lt;code&gt;meld&lt;/code&gt; program (or another diff tool with CLI support and use it in the script).&lt;br&gt;
2️⃣ Install &lt;code&gt;xsel&lt;/code&gt; and &lt;code&gt;xclip&lt;/code&gt; packages (&lt;code&gt;wl-clipboard&lt;/code&gt; on Wayland).&lt;br&gt;
3️⃣ Save &lt;a href="https://gist.github.com/m-hosseinpour/5ebf29de25ffa257194fb3d5cc273d1e" rel="noopener noreferrer"&gt;this script&lt;/a&gt; anywhere on your system.&lt;br&gt;
4️⃣ Create a global keyboard shortcut that runs the script.&lt;br&gt;
→ Suggested: &lt;code&gt;Meta + Ctrl + Shift + D&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;✅ Now you can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Copy the &lt;strong&gt;first&lt;/strong&gt; text snippet.&lt;/li&gt;
&lt;li&gt;Select the &lt;strong&gt;second&lt;/strong&gt; text snippet.&lt;/li&gt;
&lt;li&gt;Hit your shortcut.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;meld&lt;/code&gt; will pop up, showing both texts side by side — clipboard on the right, selected text on the left.&lt;/p&gt;

&lt;p&gt;(You can swap &lt;code&gt;f1&lt;/code&gt; and &lt;code&gt;f2&lt;/code&gt; in the script if you prefer the opposite order.)&lt;/p&gt;




&lt;p&gt;💡 This quickly became one of my favorite little productivity hacks.&lt;br&gt;
I can compare any two pieces of text on my system without leaving my current window.&lt;/p&gt;

&lt;p&gt;If you have similar tricks, I’d love to hear them!&lt;/p&gt;

</description>
      <category>linux</category>
      <category>productivity</category>
      <category>diff</category>
      <category>tips</category>
    </item>
  </channel>
</rss>
