Version 2 of KDE window icons

Updated 2003-09-07 00:21:40

MGS [2003/09/06] - It seems that KDE can use color pixmap images for Tcl/Tk windows. This is not controlled by Tcl/Tk, but by the window manager, which automatically searches for a matching pixmap icon in the directory /usr/share/icons/mini.

To use a color icon for your app:

1. Create a 16x16 ppm image. I used the Gimp to save a 16x16 ascii ppm image (gimp won't save xpm)

2. Convert ppm to xpm using:

   ppmtoxpm myapp.ppm > myapp.xpm

3. Copy myapp.xpm to /usr/share/icons/mini

4. Start wish with the right appname:

   wish -name myapp

5. Create new toplevels with the right class

   % toplevel .t -class myapp

For reference, I'm using KDE 3.1 on Mandrake 9.1, with a self-compiled Tcl/Tk 8.4.4 (but the default Mandrake-compiled 8.3.3 is also installed in /usr/bin).

Note this has nothing to do with the wm iconbitmap or wm iconwindow commands.


And here's a small pixmap browser. It re-creates a toplevel window with the selected class.

 proc new {} {

   set sel [.l curselection]
   if { ![llength $sel] } { return }
   set index [lindex $sel 0]
   set class [.l get $index]

   destroy .t
   toplevel .t -class $class
   wm title .t $class
 }

   listbox .l -exportselection 0 -yscrollcommand [list .y set]

   scrollbar .y -orient vertical -command [list .l yview]

   grid columnconfigure . 1 -weight 1
   grid    rowconfigure . 1 -weight 1

   grid .l -column 1 -row 1 -sticky nsew
   grid .y -column 2 -row 1 -sticky ns

   set dir /usr/share/icons/mini

   foreach xpm [glob -nocomplain -directory $dir *.xpm] {
     .l insert end [file root [file tail $xpm]]
   }

   bind .l <<ListboxSelect>> [list new]