Friday, January 07, 2011

Changing the GNOME Desktop background with gnocl::gconf

Apart from the appletbar and status box, the desktop background could be used to display some interesting things. The management of the this lowest graphic plane comes under the control of the Xlibs but its a relatively simple task to change graphics using the gnocl::gconf command. This simple test script explains all:

#---------------
# test-gconf-background.tcl
#---------------
#!/bin/sh
# the next line restarts using tclsh \
exec tclsh "$0" "$@"
#---------------

package require Gnocl
package require GnoclGconf

set tb [gnocl::toolBar -orientation vertical]
$tb add item \
    -text TCL \
    -onClicked {
        gnocl::gconf set /desktop/gnome/background/picture_options centered -type string
        gnocl::gconf set /desktop/gnome/background/picture_filename [pwd]/Tcl.svg -type string
        }

$tb add item \
    -text GTK \
    -onClicked {
        gnocl::gconf set /desktop/gnome/background/picture_options wallpaper -type string
        gnocl::gconf set /desktop/gnome/background/picture_filename [pwd]/gtk.svg -type string
        }

gnocl::window -child $tb -widthRequest 125
gnocl::mainLoop


No comments: