if 0 { [Larry Smith] Weedesk - a wee little desktop environment in tcl/tk. Weedesk is an idea I've been noodling over for several days, and the sudden appearance of [Desktop Environment] shows me I'm not the only one wishing for a simple, extensible, portable desktop environment. The [Desktop Environment] page lists a number of applications, but all of these are designed to stand alone. Ideally apps for the wee desktop would be new and designed just for it. In my prototype code I've decided to go for a Macintosh-like system - the menubar goes across the top of the screen and changes as you select various windows. However, I've not integrated tkMenuMgr from [Menus Even Easier] yet, so all there is is a place-holding button that exits the desktop. I picture a desktop with a number of lightweight, scriptable, applications ([weeApps]): weeEdit is used for all text editing, weeCalc is the spreadsheet, weePage is a page layout app - takes text from weeEdit files and allows you to insert them into a web page - there would be no "weeWord", just weeEdit and weePage, which together serve the same purpose using html as an internal file format. Some other apps would be weeBrowse, weeMail, weeProg (an IDE/debugger for developing scripts) weeData (the database), weeChat, and so on. Also, the environment would support services - weeweb httpd, etc. I visualize it running in a starkit. Installation = copy. Here's some code to play with. Right now it's sort of an [mdi] on steroids. To the [Internal Movable Windows] code I've added various window buttons and functions (iconize not yet implemented), resizing and so on. } proc winMove { win { state "" } } { upvar _win$win offset switch -exact $state { start { winSelect $win set offset(x) [winfo pointerx .] set offset(y) [winfo pointery .] raise $win } default { set wmX [winfo pointerx .] set wmY [winfo pointery .] set xDiff [expr {$wmX - $offset(x)}] set yDiff [expr {$wmY - $offset(y)}] array set placeInfo [place info $win] set placeX [expr {$placeInfo(-x) + $xDiff}] set placeY [expr {$placeInfo(-y) + $yDiff}] place $win -x $placeX -y $placeY set offset(x) $wmX set offset(y) $wmY } } } frame .rubberband -bd 3 -relief ridge set rbx "" set rby "" proc winResize { win { state "" } } { global rbx rby switch -exact $state { start { winSelect $win set w [ winfo width $win ] set h [ winfo height $win ] set rbx [ winfo x $win ] set rby [ winfo y $win ] set r [ expr $rbx + $w ] set b [ expr $rby + $h ] event generate . -warp 1 -x $r -y $b .rubberband configure -width $w -height $h place .rubberband -x $rbx -y $rby raise .rubberband } done { place forget .rubberband set basex [ winfo x . ] set basey [ winfo y . ] set w [ expr [ winfo pointerx $win ] - $basex - $rbx ] set h [ expr [ winfo pointery $win ] - $basey - $rby ] place $win -width $w -height $h } default { set basex [ winfo x . ] set basey [ winfo y . ] set w [ expr [ winfo pointerx $win ] - $basex - $rbx ] set h [ expr [ winfo pointery $win ] - $basey - $rby ] .rubberband configure -width $w -height $h } } } proc iconize { w } { puts "iconize" } proc grow_shrink { win } { global wingeo if [ string equal "normal" $wingeo($win,state) ] { set wingeo($win,w) [winfo width $win] set wingeo($win,h) [winfo height $win] set wingeo($win,x) [winfo x $win] set wingeo($win,y) [winfo y $win] set x 0 set y 30 set w [ winfo width . ] set h [ expr [ winfo height . ] - $y ] place $win -x $x -y $y -width $w -height $h set wingeo($win,state) maxed } else { set w $wingeo($win,w) set h $wingeo($win,h) set x $wingeo($win,x) set y $wingeo($win,y) place $win -x $x -y $y -width $w -height $h set wingeo($win,state) normal } } proc winClose { win } { global prevwin if [ string equal $prevwin $win ] { set prevwin "" } destroy $win place forget .help } label .help -bd 1 -fg black -bg lightyellow -font fixed -text "default help" set btn3 0 proc popballoon {} { global btn3 if { !$btn3 } { place forget .help } } proc help {w help} { bind $w "after 1000 balloon %W $help; after 3000 popballoon" bind $w "popballoon" bind $w "set btn3 1; balloon %W $help" bind $w "set btn3 0; popballoon" } proc balloon { w args } { .help configure -text $args regexp {^\.[A-Za-z0-9]*} $w parent if { [ catch { set x [ expr [ winfo x $w ] + [ winfo x $parent ] + 10 ] } ] == 0 } { set y [ expr [ winfo y $w ] + [ winfo y $parent ] - 10 ] place .help -x $x -y $y raise .help } } proc btn { name text cmd args } { set btn [button $name -text $text -padx 1 -pady 0 -bd 1 \ -command $cmd -cursor top_left_arrow ] pack $btn -side right help $btn $args } proc winNew {win title txt} { global wingeo frame $win -bd 1 -relief raised set wingeo($win,state) normal pack [frame $win.titlebar -bd 1 -relief raised -cursor fleur] -side top -fill x pack [label $win.titlebar.title -text $title ] -side left help $win.titlebar "Click/Drag to Move" help $win.titlebar.title "Click/Drag to Move" btn $win.titlebar.done x "winClose $win" Exit btn $win.titlebar.resize \u2198 "" "Click/Drag to Resize" btn $win.titlebar.iconize . "iconize $win" Iconize btn $win.titlebar.grow \u2195 "grow_shrink $win" Grow/Shrink # btn $win.titlebar.lower \u2193 "lower $win" Lower btn $win.titlebar.lower \u2193 "lower $win" Lower pack [text $win.t -width 20 -height 3] -side top -fill both -expand 1 $win.t insert end $txt bind $win.titlebar "winMove $win start" bind $win.titlebar "winMove $win" bind $win.titlebar.title "winMove $win start" bind $win.titlebar.title "winMove $win" bind $win.t "winSelect $win" bind $win.titlebar.resize "winResize $win start" bind $win.titlebar.resize "winResize $win done" bind $win.titlebar.resize "winResize $win" return $win } set prevwin "" proc winSelect { win } { global prevwin if ![ string equal $prevwin "" ] { $prevwin.titlebar configure -bg gray $prevwin.titlebar.title configure -bg gray bind $win.t "winSelect $win" } $win.titlebar configure -bg red $win.titlebar.title configure -bg red bind $win.t focus $win raise $win set prevwin $win } pack propagate . 0 wm focusmodel . active # set width [ winfo screenwidth . ] # set height [ winfo screenheight . ] set width 500 set height 500 . config -width $width -height $height -bg blue focus -force . # wm overrideredirect . 1 update # grab -global . pack [button .l -text Desktop -command exit ] -side top place [winNew .win1 "1st Window" "Hello World"] -x 10 -y 40 place [winNew .win2 "2nd Window" "Hello Person"] -x 300 -y 50 ---- ''Wee - indeed! How would you want to see the task model: as procs, interps, threads, processes (connected via pipes or sockets), or some mix? -[jcw]'' 2004-1-16 [SRIV]: I run a minimal window manager in Linux, where most of my everyday apps are coded in tcl/tk, a menu for apps/bookmarks, network throughput, mail waiting indicator, time/date. My main editor IdenTcl is pure tcl, tkabber for chat, tkCVS, calculator, CDR-B-Q, filemanager (modified X-Files), pgAccess, SnackAmp, & a Mixer app. I'd prefer a window manager written & extensible in tcl. I was hoping one of the wm gurus would donate a modern sample for us to build upon, which would give us the ability to embed any X app into the toplevel. But, I think this would be difficult to do on other OS's. I think If I had a primitive tcl web browser Id be ready to use weedesk in daily use, and it would be awesome on my Linux iPaq. Im up for further discussions... Steve [Larry Smith]: Wow. Big response. =) To tell the truth, I haven't yet given much thought to the task model. Initially I was thinking in terms of procs to make implementing the mac-like menu system easier. Then I began leaning to the idea of different processes so most any program could be run under the system - though that would destroy the consistancy, which is important, I think. wm2 is a very small window manager with a rather attractive look and feel. It is not configurable, it has no extensions capability - but it wouldn't be hard to bolt a tcl interpreter into it and use it for the chassis. The above code would be superceded, but the system would be much more flexible. 1-25-2004 [MDD]: I would argue strongly against that. The whole point here is that we build a Tcl-based operating environment that runs on all platform Tcl runs on. Building a windowing manager and virtual operating environment out of Tcl is vastly more interesting than just bolting a Tcl interpreter on some existing WM. 1-25-2004 [SRIV]: Exactly. Id like a cross platform wm written in tcl. Why? Because I hate using Windows. I want my wm to work the same on Linux and Windows. Id like it easy to tweak and extend. The whole premise of weedesk being written in tcl is whats got me interested. [FW]: How about [BrowseX] for a Tcl browser? [SRIV]: I could live with that. I figured we'd use that. To get a consistant look and feel across all apps, however, would require some interface changes, including using tkMenuMgr. ---- ''1-16-2004 [MDD]: Very promising start! To add my own $0.02, I'd propose that, as a rule, all [weeApps], as well as the environment itself, should have to be strictly cross-platform compatible, so that if any extensions are used, they would have to be Star-packaged for seamless access on WIn, Mac and Linux. Also, any pure-tcl app should be able to run under wee with no changes required. With a soup-to-nuts kit of extensions, such as an expanded Kitten, in fact, just about any existing Tcl app should be able to be made to run under the environment. If it could be made to have a Windows look and feel, such a thing could eventually scare the pants off a certain company in Redmond, WA, btw. Also, wouldn't a wee little shamrock make a fine logo for such a wee little desktop? ;-)'' 2004-1-17 [SRIV]: I agree with [MDD] on all points. I envision starkits that I can keep on my USB watch that contain the cross platform desktop and apps. I use Linux, but would want to pop my watch into a customer/friends Windows box and run everything my way. 2004-1-19: [Larry Smith]: Yes - unquestionably it should be 100% cross-platform. I propose to follow the 80/20% rule - the apps would be simple ones, providing only the minimal functionality a casual user would need, plus a little. Power users will prefer their specialized apps, so leave them to their choices, there are plenty out there. The weedesk objective would be to provide an identical user experience on any system a casual user might need, eliminating retraining time and making their skills 100% portable. ---- ''[jcw] - To hijack this initiative slightly: is the time ripe for a (possibly distributed/collaborative) Tcl compile farm?'' I've been focusing my build efforts on Win+Mac+Lin, though FreeBSD may creep in soon, and the above shows that ARM/iPaq Linux and/or WinCE might also need to follow. Might [http://www.equi4.com/pub/xc/] or [http://www.equi4.com/wobble/] (old) be relevant? To get back on track for this page, how about: adopt above Tcl policy, and accept binary extensions only if they are provided for ''all'' platforms which have been picked out (W+M+L, maybe one or two more?). A "wee-${arch}.kit" would only contain extensions which are available for all platforms, w/o compromise, and with the same release number. Architectures can only be added after all current extensions have been built for it. Packages can only be added after all builds are done. I.e. a full matrix as ''requirement''? ''[MDD] - That sure would go a long way toward insuring platform integrity and stability. We should probably start another page to discuss the range of necessary packages: [weePackages].'' [Larry Smith]: good idea. ---- [Category Application] | [Category GUI]