30/01/2012

Simple gnome 3 wallpaper switcher

Gnome 3 uses dconf rather than gconf, so gconf-based wallpaper switchers won't work. Luckily, the actual change is only that one line if you do it right.

I created a script that uses a cache of wallpapers. First, here's the script that searches your wallpapers directory for actual images (to filter out stupid Thumbs.db and things like that) and adds them to a file.

#!/bin/bash
find "$HOME/wallpapers" -type f \
  -exec sh -c 'file "$1" | grep -q "image"' '{}' '{}' \; \
  -a -fprint wallpapers-cache-new \
\
&& mv wallpapers-cache-new wallpapers-cache


That outputs a file called wallpapers-cache, and the wallpaper switcher itself uses that:

#!/bin/bash

WALLPAPERS="$HOME/wallpapers-cache"
export DISPLAY=:0

r=`rl -c1 $WALLPAPERS`

gsettings set org.gnome.desktop.background picture-uri "file://$r"

rl comes from the randomize-lines package in Debian-based OSes.

Add the latter to crontab to change your desktop as often as you'd like. Voilà!

2 comments:

  1. It's really great to spend holiday vacation with this such kind of accommodation.

    Pousada Do Rio Quente

    ReplyDelete
  2. estimated 9 million out LGBT people in the US alone. That estimate reflects only a slightly less thคาสิโนออนไลน์an 4% of the entire population, yet we hear that more than 9% of the population is actually gay. Our community is still struggling for equal rights, to marry legally, to be out without discrimination and all the other legal rights afforded to straight people.

    ReplyDelete