Version 0 of wm

Updated 2001-05-22 21:22:34

wm - Communicate with window manager

Please add notes on how you make use of the commands below in useful, and perhaps unique, ways.


  • wm aspect
  • wm client
  • wm colormapwindows
  • wm command
  • wm deiconify
  • wm focusmodel
  • wm frame
  • wm geometry
  • wm grid
  • wm group
  • wm iconbitmap
  • wm iconify
  • wm iconmask
  • wm iconname
  • wm iconposition
  • wm iconwindow
  • wm maxsize
  • wm minsize
  • wm overrideredirect
  • wm positionfrom
  • wm protocol
  • wm resizable
  • wm sizefrom
  • wm state
  • wm title
  • wm transient
  • wm withdraw

wm aspect

This allows you to enforce aspect ratios when resizing a window.

Usage:

 wm aspect . <minAspect> <minDenominator> <maxAspect> <maxDenominator>

The window name must always be specified. The aspect ratios must either be all specifed or all omitted. <minAspect>/<minDenominator> forms the minimum allowed aspect ratio, and <maxAspect>/maxDenominator> forms the maximum allowed aspect ratio.

Examples:

 wm aspect . 4 3 4 3
 wm aspect . 3 2 5 2
 wm aspect .
 wm aspect . "" "" "" ""

wm aspect . 4 3 4 3 will fix the aspect ratio of the window at 4/3. Because the command requires specification of both min and max aspects, it is necessary to specify the aspect twice.

wm aspect . 3 2 5 2 will set the minimum aspect ratio at 3/2, and the maximum at 5/2. When resizing the window, it will be possible to shape it to any aspect ratio that falls between these two ratios.

wm aspect . will return a list of the current aspect settings, or an empty list if there is no aspect ratio currently set.

wm aspect . "" "" "" "" will clear the aspect ratio constraints. Note that since all four numbers must be specified, you actually have to pass the command four empty strings.

Note: This command apparently does not validate its arguments, and it is possible to confuse the window manager somewhat (or severely) if you specify contradictory ratios, or if you specify a smaller max aspect than min aspect.

(Can anyone suggest any practical use for this capability?)

(If anyone in charge of this is paying attention here, how about making it possible to clear the aspect ratio constraints by setting them to zero?)

-EE


Here's a note on wm withdraw from George Petasis in the comp.lang.tcl newsgroup:

I wouldn't advise you to use "wm withdraw ." on the "." window. Under some window managers (especially under unix...) this will prevent dialogs that have as parent the "." (like error messages) to not show up and block your app. Better to use something like:

 wm geometry . 1x1+0+0
 wm overrideredirect . 1
 wm transient .

You can even send it out of the visible part of the screen, like

 wm geometry . 1x1+3000+3000

But in any way do not withdraw it :-)


wm protocol: Use

        wm protocol <window> WM_DELETE_WINDOW {#}

to prevent your window from closing when the [X] button is clicked.

Donal Fellows explains: An empty string is taken as asking for the default behaviour (to destroy the appropriate toplevel.) Workaround is to set the protocol handler to a non-empty do-nothing script (comments are a favourite...)


Could someone address monochrome vs multicolor icons and how to use the appropriate wm command to achieve the difference?


Could someone list the protocols available for wm protocol above, what they mean, and possibly provide examples?


Tk syntax help - Arts and crafts of Tcl-Tk programming