Saturday, November 19, 2005

Gnome-Terminal Background Randomizer

Here's a nice script you can use in cron or elsewhere to change your
gnome-terminal background.

#!/bin/sh
#
# Gnome-Terminal Random Background
# -----------------------------------
# Greg Harris
# 6.13.05
#
# Run this script every time you want to update
# your terminals background image.
#

# This is really all you need to setup. Point it to a directory
# with all of your background images.
BGPATH=/home/angrylogic/Documents/Backgrounds
FILTERS="*.jpg *.JPG *.png *.PNG *.tiff *.TIFF *.gif *.GIF"
PROFILE=Default

# Set counters and lists to nothing
NUM=0
TOTAL_PICS=0
PIC_LIST=

# Generate the list of pictures depending on wither or not
# we are doing extension filtering. If your directory has
# non-image files, you want to use filtering.
if [ -n FILTERS ]
then
PIC_LIST=`ls -1 $BGPATH`
else
for FITLER in FILTERS
do
PIC_LIST=$PIC_LIST `ls -1 $BGPATH/$FILTER`
done
fi

# Calculate the total amount of pictures, and then choose
# a random picture from the total amount of pictures
let TOTAL_PICS=`echo $PIC_LIST | wc -w`
let RAND_PIC=$RANDOM%$TOTAL_PICS

# FIXME:
# If anyone knows a better way of extracting a certain element
# from a list in bash please email me. I couldn't find anything in
# my poking around and I couldn't get the cut utility to take
# space as a delimiter
for PICTURE in $PIC_LIST
do
let NUM=$NUM+1
# Loop until we find our lucky picture in the list, and set
# that up as the background picture.
if [ $NUM -eq $RAND_PIC ]
then
# This updates the gconf key pointing to your profile
# and sets up your background image accordingly
gconftool-2 --type string --set
/apps/gnome-terminal/profiles/$P ROFILE/background_image $BGPATH/$PICTURE
fi
done

Monday, November 14, 2005

Change mouse cursor theme in Gnome

f you don't like the default mouse cursors, here is how to change it:

1) Download "mouse theme" you like:
- here is one place to download -> gnome-look-org
2) Copy(as root) downloaded archived file in /usr/share/icons:
cp example.tar.bz2 /usr/share/icons/

3) Go to that directory and unpack the archive:
tar xvfj example.tar.bz2
The directory with your icon name should be created here.(/usr/share/icons/Example)

Note: Some icon themes come with two or three different colors, so extracted directory will contain subfolders name like "Black" "White" "Blue" ....
You should move subfolder to /usr/share/icons/ directory like this:
mv /usr/share/icons/Example/Black /usr/share/icons/
Now the /usr/share/icons/Black foder is here where it should be.

4) Edit the file with your text editor located in /usr/share/icons/default/index.theme
gedit /usr/share/icons/default/index.theme
Change the line "Inherits=Bluecurve" to whatever your new mouse icon theme directory is named. (Inherits=Example, Inherits=Black, Inherits=Blue,...)

5) Save the file and log out of your session.
When you login, the new mouse icon theme should be in use.
:)