tdesk

Rildo Pragana Here are the results of some experiments toward a full tcl/tk desktop, packaged as a (writable) starkit. You can have the details and downloads from http://pragana.net .

Here is the latest version: http://pragana.net/tdesk-20050420.kit


29Apr2005 Now our gui builder, SpecTcl (enclosed in tdesk.kit), supports better the new tk widgets: labelframe, spinbox and panedwindow. This last (panedwindow) does not make much sense, until I add commands to control the creation/destruction of panes. You may use interchangeably frames and labelframes with the same commands (with sub-grids inside them). I found an annoying bug in specTcl that prevented me from using BWidget widgets (like ComboBox) in the embedded gui builder (based on specTcl). It generates the right tcl gui code but it could not run from inside specTcl. What specTcl do is to create a slave interpreter and load Tk in this interpreter. The problem happens when we try to bind something at the startup code, so I commented out the bind . <Destroy> exit line, at proc run_app source file SpecTcl/save.tk and it works now, allowing us to use ComboBox (renamed as comboBox) from BWidgets.

Other additions include: you may drag an icon from both the file manager or the desktop and drop it in the taskbar (at the bottom of the screen). The added icon will behave the same as the original, but with a boring icon (gears), because we do not manage icons yet. Left-click on the added icon to see the original default action being invoked. Right-click to remove an icon, and the taskbar will be redrawn, rolling the other icons to the left, if needed.


01Apr2005 Tdesk window manager is usable now, with full "click-to"focus" policy implemented. There is no exwm (ICCCM extensions) implemented, but I plan to do it in the near future. You can also find the "dialogs" directory (inside the starkit). Just run tdesk and open the embedded (now much modified) specTcl to open a dialog or create a new. All dialogs in this directory are loaded/reloaded by calling tdesk::load_dialogs. When the menu editor is available, you will have a way to extend tdesk on-the-fly. There is also some file type (mime) detection in the file manager. Use the "View->folder options" menu to see the pre-defined types. (my greatest problem is that I don't have a handy MS-Windows machine to check my implementation against)

escargo 1 Apr 2005 - I downloaded the tdesk-20050331.kit. I got the same error whether I double-clicked on it or opened a wish console and sourced it (on Windows XP Pro):

 couldn't load library "C:DOCUME~1\100607\LOCALS~1\Temp\TCL4D.tmp": invalid argument while executing
 "load C:/Tcl'bin/tdesk-20050331.kit/lib/wmx/wmx.so"
    ("package ifneeded" script)
    invoked from within
 "package require wmx"
 ...

RP -- Oh, sorry to say, but this is a Linux-only package. You may extract parts of it to use under Windows, like the file manager, but I see no point for this. Anyway, I have only included the libraries (such as tktreectrl) only for Linux.

escargo 20 Apr 2005 - I run Cygwin/X on my Windows machines. Currently I use Openbox or Blackbox as my window manager for X. (If Whim window manager were running on Cygwin/X I might use that.) Just because I'm on Windows, doesn't mean there's no point to X Windows applications.

RP 20Apr2005 - Hi escargo, maybe you are able to run tdesk under cygwin or mingw (with a suitable X server), but the libraries included in tdesk's starkit are only linux (ELF, .so) binaries. If you really want to try with Windows, you may repackage it with the libraries compiled for Windows. My idea with tdesk is to have something very light (unlike kde or gnome) that may be included in pocket linux distributions, and of course scriptable. If you want to port it to Windows, maybe you should wait until I have something more implemented (and cleaned up). This is too experimental yet. Anyway, you are very welcome!


18Mar2005 Now I'm happy with the window manager. It is very fast, running as a single process (no more pipelines to send commands back and forth, which made it terribly slow for mapping local toplevels). The taskbar was changed to reflect the windows available, mapped or iconifyed. All news items and other stuff related to tdesk was moved to its own page at http://pragana.net/tdesk.html .


15Mar2005 I needed a window manager to integrated in tdesk. Most window managers in tcl are not suitable, or have problems. With some ideas of Panache, tkwm, and minimalistic window managers such as 9wm and aewm, I made it. Really, it is aewm modified to be interfaced to tcl, run as a separate process (but all inside the same starkit), which communicate back and forth with another (slave) interpreter of the main application. You may try it now, (see tdesk-20050315.kit at the top of this page), with full source code (C and tcl) included: please use the embedded browser (click in the globe at the taskbar), directory "source" to see. Try running your favorite applications and report to me any things you don't like, or better yet, help me to fix it!

Some details: open the console (tkcon, not xterm) from the taskbar, attach it to interpreter "wman" and look for the windows, all named .cliW<window_id>. You may change or add more decorations in this window (toplevel), but be careful... Use the source Luke!

Bugs (and features) it still have:

  • some times, the client window don't gets refreshed. You may click with mouse left <1> pointer in the titlebar, to make it appear. I suspect this is related to a bug reported in tkwm, with the tk frame widget...
  • external applications like xterm, gimp, xv, sodipodi, firefox, blender (I've tried all them and some others) comes very fast indeed! But applications from the same process (tkcon, ml, the file manager, ...) are much more slower to come out. I think this is because there is some contention between serving the wman requests and the application events. Anyway, I don't plan to break this into several processes, I must keep it simple!

12Mar2005 Many improvements on the tcl desktop (or as I call it tdesk, unless you suggest me a better name for it!). Now the window manager is integrated, there are tweaked versions of specTcl (gui builder), a small editor (ml), and the html viewer (tkhtml). Besides that, some other libs are added, at least during the experimentation phase. It looks great now! The starkit is "writable", so you may use the tools above to create a custom version of it. That's my central idea: to have something very flexible and simple, with the most needed tools already self-contained.

The window manager is simply aewm 1.2.5 with minor changes and a tcl interface to it. The way tk handle X events makes near to impossible to write a window manager as a regular extension (many events are filtered out). (Okay, perhaps this is not true, but I'm tired of looking at xmon traces to figure mysterious things happening with my windows. I don't wnat nothing very fancy, at least for now.) So the idea is to let the window manager run as a separate process with its own X connection, and communicate with the other desktop components which needs Tk (for instance, when we are going to map a new window, the wm process ask the tk process to create a toplevel which will be the outer frame for the mapped window...).


03Mar2005 To start the (very experimental) desktop environment, please use a script like that:

 #!/bin/sh
 X :1 &
 export DISPLAY=:1
 xfwm4 &
 exec ./tdesk-20050303.kit

As of March 12, there is already an embedded window manager, so take out the line with xfwm4

If you don't have xfwm4 (the window manager from xfce), you may try others, but in some of them you will have weird things like title bars in the desktop window, no buttons in the taskbar (running applications). If you have "metacity" (the gnome window manager), it works fine too. In the future, I plan to make "tdesk" include its window manager too.

As about the license for all this, it is free as Tcl's license. If you make improvements, I'd be happy to include here, please send me.


02Mar2005 I'm doing some experiments with a tcl-centered desktop environment. It is very crude yet, but I plan to give it the (best) features of the most common desktops, but without the bloat, of course. The best of all, it will be scriptable in tcl, simple and very small. Here is a preview screenshot of what it looks like.

tdesk screenshot small

If you are adventurous, here is a starkit (new version, corrected) with the latest development (not released, I warned you!). Don't expect too much, but there are some things that already work, at least partially: the file manager can navigate directories and will show images if "xv" is present; you may drag any items from the right panel of the file manager and drop into the desktop, and also the other way (just to get a dialog to choose the action); the taskbar may activate and raise the selected window. You may get the tcl console by Control-clicking with the right mouse button anywhere, then you may start a regular xterm with the command "xterm &".

You may navigate inside the virtual starkit directory and read the source code for the extension "wmx", with some commands needed to make this beast operate! There is no window manager yet, so you must choose a suitable. I had success with xfwm4, metacity, lwm, icewm (with some bugs), and several others. Most really minimal don't work fully. I will have to tweak some code for a tcl-only window manager to integrate in this desktop yet, and to stay light and simple. By the way, many things are in portuguese, but don't be frightened, because it mimmicks *Win* stuff (to show my friends!).

Okay, many things yet to be done, but what you think? Would you like to help me? If so, please e-mail me at [email protected].


rdt I applaud your efforts. Keep up the good work. I shall follow the progress of tdesk to see how it goes.


George Peter Staplin: Mar 15, 2005 - I noticed on your "Adventures in Linux Programming" that you state: "The way tk handle X events makes near to impossible to write a window manager as a regular extensions (many events are filtered out)." This is not true. Tk provides generic handlers that pass XEvents unfiltered to a callback. The return value from a callback causes Tk to do further processing on the event, or move on to the next. I've used this ability for Whim and Panache, and they both use the pwm extension that I wrote.

RP - Sorry, George. I must have missed something. Anyway, I found easier to start with an already working window manager and interface it to tcl, so I'm able just to control the decorations, and window manipulations (repositioning, resizing...). Maybe I sould study a little more tk's code. Thanks for your comments! Of course, as I want lots of pieces in this desktop, and window management is just one piece of the cake (though a very sensitive one), I'll try to proceed with the other parts to have something useful in less time.

MGS [2005/03/18] - George, could you give a little more info about how Tk provides generic handlers that pass XEvent's unfiltered to a callback, and is there any more info about Whim and your pwm extension? Thanks.

George Peter Staplin: April 4, 2005 - I'm going to document this on Tk_CreateGenericHandler if it isn't already. My megapkg has Whim and pwm. pwm.create.generic.handler is the Tcl command to create a Tcl callback. It acts as a frontend to Tk_CreateGenericHandler and a C function that is used for evaluating the Tcl callback.

SEH 20060526 -- In case you're curious, after a few tweaks I was able to source the tdt.tcl file on Windows and get the file manager and taskbar running, they seem to be functional. The filemanager looks really nice, but is unfinished, with several buttons and menu options not hooked up to any commands, and drag and drop only partially implemented. I encourage you to push on and finish up this program, the Tcl world could really use a good quality cross-platform file manager.