#!/bin/sh # # show disk usage as 2D tree # show ps-tree (memory usage) as 2D tree # Bugs: # - nonaccessable files does not work # ToDo: # - history for back-button default={ / /home /home/user ... } # # tcl ignores the next line, but sh not \ /usr/X11R6/bin/wish $0 $@; exit # old for every object asyncron bounce (error to large!) # better one bounce-routine for all objects (syncron) set depth 1 set rpath . set lx 640 set ly 480 set showing $rpath set debug 0 set mode 0 set count 0 label .info -text $showing canvas .c -height $ly -width $lx pack .info .c # call this recursiv proc addArray { w path depth x0 y0 x1 y1 } { global debug count rpath mode if { $depth == 0 } { if { $debug > 0 } { puts "$path $depth $x0 $y0 $x1 $y1" } set type [scan [exec ls -dl $path] "%c"] incr count # beautiful images instead of boxes? set nr [.c create line $x0 $y0 $x0 $y1 $x1 $y1] .c itemconfigure $nr -fill black if { ([expr $x0+$y0] & 1) == 1 } { .c itemconfigure $nr -fill brown } incr x0; incr y0; incr x1 -1; incr y1 -1 if { ($x0<$x1) && ($y0<$y1) } { set nr [.c create rectangle $x0 $y0 $x1 $y1 -tag o$path] .c itemconfigure $nr -fill red if { $type == 45 } { .c itemconfigure $nr -fill green } .c bind $nr [list .info configure -text "$nr: $path"] .c bind $nr