<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
      <title>Snamellit - desktop</title>
      <link>https://www.snamellit.com</link>
      <description></description>
      <generator>Zola</generator>
      <language>en</language>
      <atom:link href="https://www.snamellit.com/categories/desktop/rss.xml" rel="self" type="application/rss+xml"/>
      <lastBuildDate>Sat, 25 Oct 2025 14:19:00 +0200</lastBuildDate>
      <item>
          <title>Screenshot in Sway with GUIX</title>
          <pubDate>Sat, 25 Oct 2025 14:19:00 +0200</pubDate>
          <author>Peter Tillemans</author>
          <link>https://www.snamellit.com/posts/20251025t141904-screenshot-in-sway-with-guix-guix-linux/</link>
          <guid>https://www.snamellit.com/posts/20251025t141904-screenshot-in-sway-with-guix-guix-linux/</guid>
          <description xml:base="https://www.snamellit.com/posts/20251025t141904-screenshot-in-sway-with-guix-guix-linux/">&lt;h2 id=&quot;screenshots-in-sway-with-guix-home-manager&quot;&gt;Screenshots in Sway with Guix Home Manager&lt;&#x2F;h2&gt;
&lt;p&gt;A &lt;a href=&quot;https:&#x2F;&#x2F;kaibreucker.dev&#x2F;en&#x2F;content&#x2F;foss&#x2F;sway&#x2F;screenshots&#x2F;&quot;&gt;blog post&lt;&#x2F;a&gt; documented an elegant way to configure screenshots in
wayland using &lt;strong&gt;grim&lt;&#x2F;strong&gt; and &lt;strong&gt;grimshot&lt;&#x2F;strong&gt;. After moving my sway config to use
the &lt;strong&gt;GUIX&lt;&#x2F;strong&gt; &lt;code&gt;sway-service&lt;&#x2F;code&gt; to generate the config file Iost my configured
screenshot bindings.&lt;&#x2F;p&gt;
&lt;h3 id=&quot;output-files&quot;&gt;Output Files&lt;&#x2F;h3&gt;
&lt;p&gt;The screenshots will be placed  in the &lt;code&gt;Pictures&#x2F;screenshots&lt;&#x2F;code&gt; folder
with the timestamp as filename.  To avoid duplication and ensure
consistency we&#x27;ll add  a variable to generate the filename&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;scheme&quot; style=&quot;background-color:#2e3440;color:#d8dee9;&quot; class=&quot;language-scheme &quot;&gt;&lt;code class=&quot;language-scheme&quot; data-lang=&quot;scheme&quot;&gt;&lt;span&gt;(sway-configuration
&lt;&#x2F;span&gt;&lt;span&gt;  (variables (append %sway-default-variables
&lt;&#x2F;span&gt;&lt;span&gt;		     `((menu .  ,#~(string-append
&lt;&#x2F;span&gt;&lt;span&gt;                                    #$fuzzel
&lt;&#x2F;span&gt;&lt;span&gt;                                    &amp;quot;&#x2F;bin&#x2F;fuzzel&amp;quot;
&lt;&#x2F;span&gt;&lt;span&gt;                                    &amp;quot; -w 50 -x 8 -y 8 -r 3 -b 232635ff -t A6Accdff -s A6Accdff -S 232635ff -C c792eacc -m c792eacc -f \&amp;quot;JetBrains Mono:weight=light:size=10\&amp;quot; --icon-theme=\&amp;quot;Papirus-Dark\&amp;quot; --no-exit-on-keyboard-focus-loss&amp;quot;))
&lt;&#x2F;span&gt;&lt;span&gt;		       (term . ,(file-append alacritty &amp;quot;&#x2F;bin&#x2F;alacritty&amp;quot;))
&lt;&#x2F;span&gt;&lt;span&gt;		       (screenshot_out . &amp;quot;$(xdg-user-dir PICTURES)&#x2F;screenshots&#x2F;$(date +\&amp;quot;%Y%m%d-%H%M%S\&amp;quot;).png&amp;quot;))
&lt;&#x2F;span&gt;&lt;span&gt;		     ))
&lt;&#x2F;span&gt;&lt;span&gt;  ...)
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h3 id=&quot;key-bindings&quot;&gt;Key Bindings&lt;&#x2F;h3&gt;
&lt;p&gt;I often use various screenshots pasted in chat windows or Jira tickets
so the clipboard is an important destination.
Alternatively saving them to move them to a target folder for
inclusion whereverr they needed is an important secondary use-case.&lt;&#x2F;p&gt;
&lt;p&gt;We can now use the variable made previously and add the following keybindings:&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;scheme&quot; style=&quot;background-color:#2e3440;color:#d8dee9;&quot; class=&quot;language-scheme &quot;&gt;&lt;code class=&quot;language-scheme&quot; data-lang=&quot;scheme&quot;&gt;&lt;span&gt;(sway-configuration
&lt;&#x2F;span&gt;&lt;span&gt;	    ...
&lt;&#x2F;span&gt;&lt;span&gt;	    (keybindings (append
&lt;&#x2F;span&gt;&lt;span&gt;			  `(...
&lt;&#x2F;span&gt;&lt;span&gt;			    ;; Special key to take a screenshot with grim
&lt;&#x2F;span&gt;&lt;span&gt;			    ($mod+Shift+p . &amp;quot;exec grimshot copy anything&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;			    ($mod+Shift+s . &amp;quot;exec grimshot save screen $screenshot_out&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;			    ($mod+Shift+w . &amp;quot;exec grimshot save window $screenshot_out&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;			    ($mod+Shift+a . &amp;quot;exec grimshot save area $screenshot_out&amp;quot;)
&lt;&#x2F;span&gt;&lt;span&gt;			    ...
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;			    )
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;span&gt;
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;h2 id=&quot;deploying-the-configuration&quot;&gt;Deploying the configuration&lt;&#x2F;h2&gt;
&lt;p&gt;To activate the configuration&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;shell&quot; style=&quot;background-color:#2e3440;color:#d8dee9;&quot; class=&quot;language-shell &quot;&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;$ make home
&lt;&#x2F;span&gt;&lt;span&gt;echo Loading modules from ~&#x2F;.config&#x2F;dotfiles&#x2F;guix&#x2F;src
&lt;&#x2F;span&gt;&lt;span&gt;Loading modules from &#x2F;home&#x2F;pti&#x2F;.config&#x2F;dotfiles&#x2F;guix&#x2F;src
&lt;&#x2F;span&gt;&lt;span&gt;guix home reconfigure -L ~&#x2F;.config&#x2F;dotfiles&#x2F;guix&#x2F;channel -c 32 ~&#x2F;.config&#x2F;dotfiles&#x2F;guix&#x2F;home-config-`hostname | cut -d. -f1`.scm
&lt;&#x2F;span&gt;&lt;span&gt;...
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;which quickly (for some value of quick) updates the home
configuration, writing a new &lt;strong&gt;~&#x2F;.config&#x2F;sway&#x2F;config&lt;&#x2F;strong&gt; file.&lt;&#x2F;p&gt;
&lt;p&gt;When the prompt returns a quick reload of the sway config with
&lt;code&gt;$mod+Shift+c&lt;&#x2F;code&gt; and testing if the modifications are active.&lt;&#x2F;p&gt;
&lt;h2 id=&quot;testing-it-out&quot;&gt;Testing it Out&lt;&#x2F;h2&gt;
&lt;p&gt;I opened libre office writer to paste copied screenshots and made a
mess to show the &lt;code&gt;copy anything&lt;&#x2F;code&gt; works as expected. It does, it
highlights what it understands depending on your mouse location, a
window if hovering over a window, a rectangle if you start selecting
and all the screen if you move the mouse outside all windows (i.e. the
boundary on a tiling wm). It is a bit fiddly so sometimes I select the
wrong thing, but since it only clobbers the clipboard and I can
quickly try again, this seems reasonable.&lt;&#x2F;p&gt;
&lt;p&gt;Similarly using the 3 other bindings to save different type of
screenshots.&lt;&#x2F;p&gt;
&lt;pre data-lang=&quot;shell&quot; style=&quot;background-color:#2e3440;color:#d8dee9;&quot; class=&quot;language-shell &quot;&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span&gt;  $ ls ~&#x2F;Pictures&#x2F;screenshots&#x2F;
&lt;&#x2F;span&gt;&lt;span&gt;20251025-141106.png  20251025-145006.png  20251025-145019.png
&lt;&#x2F;span&gt;&lt;&#x2F;code&gt;&lt;&#x2F;pre&gt;
&lt;p&gt;Cool, that made a mess in the folder and &lt;strong&gt;displaying&lt;&#x2F;strong&gt; them show that it
are actually screenshots. Cool.&lt;&#x2F;p&gt;
</description>
      </item>
    </channel>
</rss>
