WJG (24/03/2011) A popular feature of many desktops is the inclusion of "desklets" -simple, ever present applications that either serve to 'brighten-up' the desktop or provide a stream of feedback.The Linux desktop has a the applet toolbar to give some feedback but what if we want something more? Ideally a desklet should be visible on all desktops, always lower in the window rendering stack than interactive application, should not produce icons in the taskbar or have any rendered frame. It might even be the case that non rectangular windows are wanted too. The various settings for the gnocl::window allow all these possibilities. To show this, here's the script that I use to show a slideshow of pictures taken from my mobile phone.
#--------------- # photoAlbumGadget.tcl #--------------- # Produce a desktop slideshow. #--------------- # William J Giddings # 05/09/2010 #--------------- #!/bin/sh # the next line restarts using tclsh \ exec tclsh "$0" "$@" package require Gnocl #--------------- # initialize the album #--------------- proc init {} { set ::dt 3000 set ::size {200 150} set ::i 0 set ::first 1 # create a list of images set ::album [glob ./album/*] } #--------------- # blend one slide into another #--------------- proc slideChange {} { incr ::i if {$::i == [llength $::album] } {set ::i 0} $::pb delete # transition or straight cut if {$::first} { set ::pb [gnocl::pixBuf load -file [lindex $::album $::i]] $::img configure -image %?$::pb -size $::size set ::first 0 puts [lindex $::album $::i] } else { puts [lindex $::album $::i] set src [gnocl::pixBuf load -file [lindex $::album $::i]] for {set i 5} {$i <= 255 } {incr i } { # adjuest and resize photos to fit $::pb composite $src -alpha $i $::img configure -image %?$::pb -size $::size gnocl::update after 10 } $src delete } after $::dt slideChange } #--------------- # run the desklet #--------------- proc main {} { set ::pb [gnocl::pixBuf new] set ::img [gnocl::image] set ::eb [gnocl::eventBox ] $::eb configure \ -child $::img \ -dropTargets {STRING text/plain text/uri-list application/x-color} \ -onDropData { set pic [string range %d 7 %l] puts $pic eval file copy $pic \"[pwd]/album\" ;# will allow spaces in pathnames init } gnocl::window \ -skipPagerHint 1 \ -skipTaskBarHint 1 \ -child $::eb \ -defaultHeight 150 \ -defaultWidth 150 \ -decorated 0 \ -x 1400 \ -y 250 \ -keepBelow 1 \ -stick 1 slideChange gnocl::mainLoop } init main