Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I like quotes very much and would like to display it on my desktop as wallpaper.

Printed quote on the middle of the plain image as desktop wallpaper.

Is there any software to do this job? I know there are plenty of software's to display random images as wallpaper, but this one should generate images with text and display it as wallpaper.

share|improve this question

1 Answer 1

You could write a bash script to do this for you. Based on the xplanet tutorial (for setting the wallpaper, it's some gconf-magic ;) ) and this thread for writing the text using imagemagick.

Something like this:

#!/bin/bash

convert -font "./verdana.ttf" -fill "#101411" -pointsize 33 -gravity "West" -draw "text 1,0 'foobar'" bg.png text.png
gconftool -t str -s /desktop/gnome/background/picture_filename text.png

Here we go, a full featured 'create a wallpaper to with a random quote on it', which could even be modified to 'to pick a random wallpaper to print a random quote on it'. ;)

Usage: Just look at the conf-section. Have fun!

#!/bin/bash

# This is a script which prints random quotes (gathered from files) on to
# a defined wallpaper.
# Some ideas are coming from the xplanet-script located at: http://rbrusu.com/xplanet-desktop-wallpape.html

# Written by Robert 'Bobby' Zenz (Robert.Zenz@gmx.at)
# Written for UK at Superuser.com


# Config-Section
# --------------
quote=~/quotes.txt              # Set this to a folder, for picking random files, or set
                                # set it to a file, to pick random lines
wallpaper=~/wallpapers/         # Set it to a fixed wallpaper, or to a folder to pick
                                # a random one inside that
tempPic=tempWall.png            # The name of the temporary file

textSize=33                     # The size of the text
textColor="#555555"             # The color of the text (watch the quotation marks!)

sleep=3m                        # Set how long the script will pause before
                                # picking a new wallpaper/quote
#---------------


# Global variable, please ignore this...
pickedFile=GlobalyDefined
pickedQuote=GlobalyDefined
pickedWallpaper=GlobalyDefined

function getRandomLine {
    pickedQuote=$(shuf -n 1 $1)
}

function getRandomFile {
    cd $1

    set -- *
    length=$#
    random_num=$(( $RANDOM % ($length + 1) ))

    pickedFile=${!random_num}

    while [ ! -e $pickedFile ]; do
        pickedFile=${!random_num}
    done

    pickedFile=$(pwd)/$pickedFile

    cd -
}

function main {
    if [ -d $quote ]; then
        getRandomFile $quote
        pickedQuote=$(cat $pickedFile)
    fi
    if [ -f $quote ]; then
        getRandomLine $quote
    fi

    if [ -d $wallpaper ]; then
        getRandomFile $wallpaper
        pickedWallpaper=$pickedFile
    fi
    if [ -f $wallpaper ]; then
        pickedWallpaper=$wallpaper
    fi

    convert -fill "$textColor" -pointsize $textSize -gravity "Center" -draw "text 1,0 '$pickedQuote'" $pickedWallpaper $tempPic
    gconftool -t str -s /desktop/gnome/background/picture_filename $tempPic

    sleep $sleep
    exec $0
}

main

That script now has a home at GitHub.

share|improve this answer
    
this is cool ;) i'll check it . now windows turn :) –  ukanth Jan 19 '10 at 11:24
    
excellent, i am writing one for windows ;) some improvement * instead of reading a each file from folder,just a single file with each quote in a line will be good * Some timer functionality to change it automatically. –  ukanth Jan 20 '10 at 6:26
    
@UK: Good ideas, I changed that. ;) –  Bobby Jan 20 '10 at 23:12
    
Great! Thank you very much ;) –  ukanth Jan 21 '10 at 6:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.