<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  
  
  <channel>
    <title>chrisjrob: wallpaper</title>
    <link>https://chrisjrob.com</link>
    <atom:link href="https://chrisjrob.com/tag/wallpaper/feed/index.xml" rel="self" type="application/rss+xml" />
    <description>GNU Linux, Perl and FLOSS</description>
    <language>en-gb</language>
    <pubDate>Fri, 13 Feb 2026 17:22:31 +0000</pubDate>
    <lastBuildDate>Fri, 13 Feb 2026 17:22:31 +0000</lastBuildDate>
    
    <item>
      <title>XKCD Wallpaper</title>
      <link>https://chrisjrob.com/2011/03/21/xkcd-wallpaper/</link>
      <pubDate>Mon, 21 Mar 2011 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2011/03/21/xkcd-wallpaper</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/xkcd-wallpaper_300.png" align="right" alt="Featured Image">
         
         <p>I confess, I like <a href="http://xkcd.com/">XKCD</a>. Even though some of them are
<a href="http://xkcd.com/871/">unfunny</a> and others <a href="http://xkcd.com/849/">beyond my understanding</a>, 
sometimes, just sometimes, they 
<a href="http://xkcd.com/208/">strike a chord</a>.</p>

<!--more-->

<p>Once I <a href="/tag/pekwm">moved to pekwm</a> I found myself with a black plain
desktop, what could be better, I thought, than the current XKCD comic in
the centre, with the tooltip comment located underneath in an
appropriate font.</p>

<p><img src="/assets/xkcd-wallpaper.png" alt="XKCD Wallpaper Screenshot" />
After some trial and error, I ended up writing 
<a href="http://pastebin.com/vqtmyRWW">this script</a>. 
It is far from perfect, and will
probably end up being broken at some point, although it survived 
<a href="http://xkcd.com/859/">its first trial</a> unscathed. I’m a little embarrassed
by my tortuous curl/perl one-liner, ideally I would re-write this whole
thing in perl, but it has worked reliably for a couple of months, so I
dare say that I will never get around to it.</p>

<p>Currently it works for pekwm, and I dare say it will work for other
lightweight window managers, like openbox, that can use <code class="language-plaintext highlighter-rouge">feh</code> to set the
desktop wallpaper. If not, then it shouldn’t be too difficult to modify
the script for your window manager or desktop environment. You can also
run the script without the <code class="language-plaintext highlighter-rouge">-w</code> switch in order to just create the XKCD
image in the directory for your own purposes.</p>

<p>You will obviously need <code class="language-plaintext highlighter-rouge">perl, curl, wget, and fold</code>, if they aren’t
already installed on your system. Create a directory, say <code class="language-plaintext highlighter-rouge">~/.xkcd</code> and
save this script in there, along with the 
<a href="http://antiyawn.com/uploads/Humor-Sans.ttf">XKCD font</a>, mark the script as
executable. If you read the script, it is fairly self-explanatory I
think.</p>

<p>You basically run it like this:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>/path/to/.xkcd/xkcd -w -d '/path/to/.xkcd'
</code></pre></div></div>

<p>For pekwm, just add a line at the end of the <code class="language-plaintext highlighter-rouge">~/.pekwm/start</code> file:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>(sleep 30 &amp;&amp; /path/to/.xkcd/xkcd -w -d '/path/to/.xkcd') &amp;
</code></pre></div></div>

<p>I hope it works for you, feel free to comment any suggestions or
criticisms. If you do start using it, it would be fantastic if you could
add a comment to let me know.</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>Desktop Wallpaper</title>
      <link>https://chrisjrob.com/2010/09/18/desktop-wallpaper/</link>
      <pubDate>Sat, 18 Sep 2010 00:00:03 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2010/09/18/desktop-wallpaper</guid>
      <description>
       <![CDATA[
         
           <img src="https://chrisjrob.com/assets/trident-wallpaper-300.png" align="right" alt="Featured Image">
         
         <p>When I launched our first LTSP server, I was very keen to make the system as pleasurable for the users as possible; to this end, I left users able to customise their desktop pretty much how they liked.  I decided that this free-for-all had gone too far, when I saw customers sitting in front of one user’s computer, sporting a desktop wallpaper of his baby son.  At the time I just set a system default of a fairly neutral blue / dark blue radial gradient, and put an item on my to-do list to create a desktop wallpaper.</p>

<!--more-->

<p>Those who read <a href="/2010/06/26/kde-wallpaper/">my earlier post regarding KDE Wallpaper</a> may have seen examples, and basically I created a red background with company logo and a few lighting affects, making suitable wallpapers for most of the common screen sizes.  It was when I went to implement these wallpapers that I realised that I had a problem - KDE only allows you to force one single wallpaper to all users, regardless of screen size.  I could allow the users to set their own wallpaper, from a select list, but it would be impossible to restrict them only to that list.  And what if they hop from one computer to another - the screen size will be wrong again.  No, I needed a way of changing the wallpaper at login to the correct wallpaper for their screensize, and that meant a perl script running at login.  The task could be broken into three parts:</p>

<ol>
  <li>Determine screen size</li>
  <li>Choose best wallpaper</li>
  <li>Set wallpaper</li>
</ol>

<p>To determine the screen size, I used a small Perl Tk routine:</p>

<div class="language-pl highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">sub </span><span class="nf">get_screen_size</span> <span class="p">{</span>
    <span class="k">use</span> <span class="nv">Tk</span><span class="p">;</span>
    <span class="k">my</span> <span class="nv">$mw</span><span class="o">=</span><span class="nv">tkinit</span><span class="p">;</span>
    <span class="nv">$mw</span><span class="o">-&gt;</span><span class="nv">withdraw</span><span class="p">;</span>
    <span class="k">return</span><span class="p">(</span><span class="nv">$mw</span><span class="o">-&gt;</span><span class="nv">screenwidth</span><span class="p">,</span> <span class="nv">$mw</span><span class="o">-&gt;</span><span class="nv">screenheight</span><span class="p">,</span> <span class="nv">$mw</span><span class="o">-&gt;</span><span class="nv">screendepth</span><span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>

<p>To select the best wallpaper, I found this far more complicated that I would have liked - the issue is that NX users have screen sizes that are non-standard, so I couldn’t rely on exact matches.  In any case, if I relied on perfect matches I would have been creating new wallpapers for each and every obscure monitor resolution.  The best approach I found was to score each wallpaper based on aspect, width and height, calculating the percentage error for each compared to the users screen size, summing the errors and picking the wallpaper with the lowest error.  Logically aspect would be far more important that the other errors, so I trebled the aspect error to make that the dominant criteria.</p>

<p>Lastly, I set the wallpaper using a simple dcop command:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>`dcop kdesktop KBackgroundIface setWallpaper "$newwallpaper" 6`;
</code></pre></div></div>

<p>After testing it thoroughly, I inserted a shortcut to the script in all users’ Autostart directories last night.</p>

<p>I arrived this morning to the comment <em>“it’s a bit bright any chance we could tone it down a bit”</em>.</p>

<p>I was very polite.</p>


       ]]>
      </description>
    </item>
    
    <item>
      <title>KDE Wallpaper</title>
      <link>https://chrisjrob.com/2010/06/26/kde-wallpaper/</link>
      <pubDate>Sat, 26 Jun 2010 00:00:00 +0000</pubDate>
      <author>chrisjrob@gmail.com (Chris Roberts)</author>
      <guid>https://chrisjrob.com/2010/06/26/kde-wallpaper</guid>
      <description>
       <![CDATA[
         
         <p>In an effort to make my desktop a little more elegant, I have designed some new wallpapers for use with KDE on Debian.  They may be a little too bling for some of you, but I’m quite pleased with them.  All created using free software, in the form of The Gimp.  In the spirit of free software, I have uploaded to <a href="http://kde-look.org/usermanager/search.php?username=chrisjrob&amp;action=contents">KDE Look</a> under a Creative Commons licence.</p>

       ]]>
      </description>
    </item>
    
  </channel> 
</rss>
