Comment 1 for bug 469114

Revision history for this message
Toon Verwaest (tverwaes) wrote : Re: Gnome wallpaper

Btw, this is what I do on my machine to fix my display. I set the gnome-bar on the largest display of the two and build a wallpaper which assumes the positions that disper -e gives them to be left/right with the external one on the right; and that there are only two monitors.

I guess for disper you will have to do a bit more magic but well... at least this works for me and my dualscreen doesn't look so gHorrible. Requires ruby and librmagick-ruby.

cheers,

require "RMagick"

# activate monitor
`disper -e`

DIR="#{ENV['HOME']}/.wallpaper"
WALLS=Dir.open(DIR).to_a.reject {|f| /^\./.match(f)}
OUTFILE = "#{DIR}/.wallpaper.jpg"
INFO = `disper -l`
LINES = INFO.to_a
SCREENS = LINES.count / 2

def getimage
    return "#{DIR}/#{WALLS[rand(WALLS.size)]}"
end

def resolution(id)
    line = LINES[id * 2 + 1]
    line =~ /.* ([0-9]+)x([0-9]+)/
    return $1.to_i, $2.to_i
end

def toolbarscreen(id)
    `gconftool-2 -t int --set /apps/panel/toplevels/top_panel_screen0/monitor #{id}`
end

if (SCREENS > 1)
    r1 = resolution(0)
    r2 = resolution(1)
    toolbarscreen(r1[0] < r2[0] ? 1:0)
    images = Magick::ImageList.new(getimage, getimage)
    images[0].crop_resized!(*r1)
    images[1].crop_resized!(*r2)
    images.append(false).write(OUTFILE)
else
    `cp #{getimage} #{OUTFILE}`
end

`gconftool-2 -t str --set /desktop/gnome/background/picture_filename #{OUTFILE}`