#!/usr/bin/python
import os, sys, random, imghdr
# This is a little program I call via cron to change my desktop every
# few minutes. With no arguments it goes to my directory of backdrop
# images and picks a valid image at random. If I specify a path and a
# file the program will put it up as the display.
# I don't want to fill up my inbox with emails from cron telling me that
# X isn't running, so I check first.
xisrunning = os.popen("pidof /usr/bin/X11/X").read()
def changebackdrop():
# The below command works for transparent Eterm or Urxvt terminals,
# populating their backgrounds with the image they occlude. xli or
# xsetroot can be called, but they don't work as desired for
# transparent terminals.
command = "/usr/bin/Esetroot"
# If I was logging into X remotely, this would change.
commandargs = " -display :0.0 "
# This is where my backdrops live
picdir = "/home/willyyam/misc/bmps/"
if sys.argv[1:]:
doit = command + commandargs + sys.argv[1]
os.popen(doit, 'r')
else:
files = os.listdir(picdir)
os.chdir(picdir)
pics = []
for file in files:
# This is a test for valid images - it includes rgb files,
# which are not supported by my image software, but the
# error thrown is not terrible - it knows what it can and
# cannot run.
if imghdr.what(file):
pics.append(file)
randpic = random.choice(pics)
doit = command + commandargs + picdir + randpic
os.popen(doit, 'r')
if xisrunning:
changebackdrop()
else:
exit
# Copyright 2005 William Witteman
oglerc
<!-- I left the RC file almost totally alone, but I run two monitors on a Matrox G400, and so I had to do the following: -->
<geometry>
<width>400</width>
<height>300</height>
</geometry>
<geometry_src>user</geometry_src>
<resolution_src>Xinerama</resolution_src>
Unicode
I decided that I wanted to see accented characters, other character sets, and basically move out of the 70s on my terminal screens. So, I went hunting for the settings to make my system think in Unicode. I started here and it seemed to go okay, but I still couldn’t see most of the characters in this. After much tearing of hair and gnashing of teeth, it turns out that Eterm, which I understood to be Unicode compatible, isn’t. At least, mine isn’t. So, I decided to use Urxvt, which is Rxvt with Unicode support.
The funny thing is, once I decided to use urxvt I ended up spending more time configuring it than I ever did getting Unicode (specifically UTF-8) set as my default character set. I’m pretty happy with it now though – you can check out my config file over in the configs section. The only problem left is that I don’t know how to type accented characters, but I figure I’ll figure it out eventually.