My XFCE Setup

I use XFCE for my desktop environment in Linux, and I think it strikes a nice balance between minimalism and functionality.  You can add lots of crazy panels and menus if you want, but you don't have to.  Personally, I find that the crazier, more "user friendly" setups of KDE or Gnome provide way more interface than I need, and are just annoying.  I can launch anything I want by typing it into the terminal, so I don't need to navigate pages and pages of GUI to find something when I already know what it's called.

My setup has a floating taskbar which gives me quick access to the stuff I want to use quickly (like Firefox, Thunderbird, gedit...), but I can still pull up a menu to dig around if I need to find a particularly weird program (which is rare, I pretty much do everything in a terminal).

The coolest thing about my setup (at least I think), is that I've got a huge list of wallpapers loaded up, that change on a cron job every half hour. Here's the relevant shell code:

Dump the current wallpaper image:
xprop -root | grep 'XFDESKTOP_IMAGE_FILE_0(STRING)' | cut -f 2 -d\"

Reload a new image off the list:
xfdesktop -reload
(Note that to do this in a cron job, you may need to set the DISPLAY and XAUTHORITY right.)

I've got another set of scripts that removes the current wallpaper from the list (just using text manipulations on the file), so I can remove the one's I don't like. I'm thinking about auto generating the lists using everything in my "wallpapers" folder, but so far it's been easier to use find and then merge them by hand.

So that was the easy part. The hard part was getting xfdesktop to do something intelligent with it's "auto" setting for stretching/tiling them. In the defense of XFCE, I wanted some weird rules for my distorted aspect-ratio LCD screen. The xfdesktop defaults are to zoom anything that's not tile-able, which makes more sense if the aspect ratios match standard wallpaper sizes. The only really wonky thing they do is zoom in on the upper square of particularly bad aspect-ratio images, but I suppose normal people don't have manga pages and raw hubble footage in their rotation.

So to set that up I had to hack XFCE (see my previous post for getting this to work nice with Gentoo). I'm happy to report that it wasn't too hard. The xfdesktop code I looked through was pretty easy to read.

Basically I made it tile slightly more things, and then not distort things too much. (The specific numbers were chosen by looking at how the standard wallpaper resolutions looked on my monitor.) Here's my final patch:
diff --git a/src/xfce-backdrop.c b/src/xfce-backdrop.c
index 486a796..a028f3f 100644
--- a/src/xfce-backdrop.c
+++ b/src/xfce-backdrop.c
@@ -805,17 +805,34 @@ xfce_backdrop_get_pixbuf(XfceBackdrop *backdrop)
     if(backdrop->priv->image_style == XFCE_BACKDROP_IMAGE_AUTO) {
-        if(ih <= h / 2 && iw <= w / 2)
+        xscale = (gdouble)w / iw;
+     yscale = (gdouble)h / ih;
+     gdouble sDiff = xscale - yscale;
+     if(sDiff < 0) {
+      sDiff = -sDiff;
+     }
+     int xTile = (ih <= h/2);
+     int yTile = (iw <= w/2);
+        if(xTile && yTile) {
             istyle = XFCE_BACKDROP_IMAGE_TILED;
-        else
-            istyle = XFCE_BACKDROP_IMAGE_ZOOMED;
-    } else
+        } else if ((xTile || yTile) && sDiff < 0.36) {
+         istyle = XFCE_BACKDROP_IMAGE_TILED;
+        } else if ( sDiff < 0.30) {
+            istyle = XFCE_BACKDROP_IMAGE_STRETCHED;
+        } else {
+         istyle = XFCE_BACKDROP_IMAGE_SCALED;
+        }
+    } else {
         istyle = backdrop->priv->image_style;
+    }
     /* if the image is the same as the screen size, there's no reason to do
      * any scaling at all */
-    if(w == iw && h == ih)
+    if(w == iw && h == ih) {
+    }
     /* if we don't need to do any scaling, don't do any interpolation.  this
      * fixes a problem where hyper/bilinear filtering causes blurriness in

Now all I have to do is go through my wallpapers and figure out which ones I really want in my rotation...


Hacking in Gentoo

I started using Linux as my primary OS some 4 years ago, but as much as I liked to brag that I had the theoretical ability to modify (almost) anything on my system, the reality was that getting a generic source package to work on whatever particular distribution I had was difficult (or at least intimidating). At best the paths would all be screwed up, and at worse I'd get library issues. Not to mention the hassle of specially handling that package from then on in my package manager.

Enter Gentoo.

In Gentoo's package manager, Portage, every package is installed by running a custom Python script, and you can store custom versions of it using their overlay system, while keeping all the dependency tracking information. The Bottom Line: I can patch anything as it's being installed onto my system, and I get all their fancy install scripts for free.

So, for the Gentoo aficionado, here's how I fixed xfdesktop to do exactly what I wanted when auto-sizing my wallpapers.

Howto install custom software versions in Gentoo:
  1. Setup a Portage overlay

    See the Gentoo Handbook or this site for more details but basically you make the /usr/local/portage folder, and add PORTDIR_OVERLAY=/usr/local/portage to your /etc/make.conf

  2. Copy over the package you want to customize from the regular tree

    ie Copy everything from /usr/portage/xfce-base/xfdesktop to /usr/local/portage/xfce-base/xfdesktop

  3. Make your patch

    Use the actual distfiles Gentoo is already using (emerge -f xfdesktop will list them) to save yourself headaches later.
    Personally I just unpack the source, setup a git repository, muck with the code, and then use git format-patch to give me the patch file I need.

  4. Modify the ebuild to use your patch

    If you have a particularly weird package, this can be tricky until you get better at writing ebuilds. But for most packages, this is cake. Just add your patch to the list of patches they're already applying. (Or checkout other ebuilds that have some patches to add and copy what they did). Here's the diff -u of my new ebuild.

    --- /usr/portage/xfce-base/xfdesktop/xfdesktop-4.6.1-r1.ebuild    2010-01-18 16:38:19.000000000 -0800
    +++ /usr/local/portage/xfce-base/xfdesktop/xfdesktop-4.6.1-r1.ebuild    2010-01-27 17:26:10.355164734 -0800
    @@ -56,7 +56,8 @@
    $(use_enable debug)"
    PATCHES=( "${FILESDIR}/${P}-automagic.patch"
    -        "${FILESDIR}/${P}-assert.patch" )
    +        "${FILESDIR}/${P}-assert.patch"
    +        "${FILESDIR}/0001-Rewrote-backdrop-AUTO-selection.patch" )
  5. Put your patch file in the files/ directory.

That's it. Emerge and enjoy!

I currently run custom versions (read 1-10 line patches) of 4 packages, and I'm getting less afraid to try to muck with things. The funniest is probably nethack, which has the username for debug mode hard-coded into the source, so you can't access it unless your username is "wizard". I guess nethack dev's make a custom user to do their debugging? I'm not really sure how that one was supposed to work.

Anyway, Happy Hacking!

First Post!

So, I'm experimenting with starting a m/(web?)?bl(o|a)g/i . I've always preferred just managing a website myself to using a hosted platform like this, and I'm not a big fan of the word "blog" either, but there's a couple things that are hard to do when your "content management system" consists of text files edited with nano. (Notably, tracking titles, categories, and using punctuation in your titles.) So I decided to give it a shot. If I hate it, I'll go back to text files.

So uh, WYSIWYG for now.