Homepage News Screenshots Documentation Downloads Patches Links Developers

Download Current Version: tkdesk-1.2.tar.gz

Next Previous Contents

8. Using the TkDesk Server

In order to allow remote control of TkDesk, i.e. to allow programs outside of TkDesk to have TkDesk perform certain tasks, TkDesk implements a TCP/IP server that can be used to send Tcl scripts to TkDesk. Whether this server is "up" or not is determined by the option "TkDesk Server" that is to be found in the "Options" menu. Currently, only programs running on the same machine as TkDesk may connect to the server, but multiple TkDesk servers started from different users may be running at the same time.

The server is a much faster way to send command to TkDesk then to use the Tcl/Tk send command, as that requires a second Tcl/Tk shell ("wish") to be started to do the send. However, using a TCP/IP server that's basically system-wide accessible to perform arbitrary command under the accout of the user who started TkDesk and thus the server brings with quite a big security risk that TkDesk tries to reduce by keeping the port the TkDesk server uses secret. The port to be used is calculated randomly at server start-up, and is saved into a file that can only be read by the user who started TkDesk. To prevent "guessing" of the port number a generated key is also stored in this file that get passed to the server.

The client performing the communication with the TkDesk server gets installed with TkDesk; its name is tkdeskclient. This command expects exactly one argument which will be directly sent to the server and evaluated there as a Tcl script. E.g. you could do a

        tkdeskclient "dsk_view id"
to find out who you are :-).

Along with TkDesk a number of front-end shell scripts for tkdeskclient are installed, which comprise of the following:

cd-tkdesk ?path?

Let's the currently active TkDesk file list or browser window (i.e. the one the mouse pointer was over last) change its directory to path if path is given, or returns the current directory of the active window.

ed-tkdesk ?+linenum? ?file? ...

Without argument opens a new editor window, or loads all files given as arguments into the editor (and into the same window if you're using a multi-buffer capable editor, such as the built-in one). If a file is preceded by +linenum, i.e. something like +20, the built-in editor will position the cursor on the line when displaying the file that's given in the following argument.

od-tkdesk ?dir?

If no arguments are given opens a file list window for the current directory of the shell/program where the command was issued, or opens a window for the directory specied in dir.

op-tkdesk ?file ...?

For each file performs its default action (the one defined first in its corresponding popup menu as defined in "Popups"), or asks for a command to execute if no files are given.

pop-tkdesk file

Displays the popup menu for file, as defined in the "Popups" config file. The popup menu may also be controlled by the keyboard: Up, Down, Return, and Esc keys do what you would expect.

Note that all of these scripts are merely examples of possible usages of tkdeskclient. Use your fantasy to find new and even more exciting applications! :-)

Next Previous Contents

Maintainer: J. Chris Coppick