Updated 2012-08-18 20:57:37 by RLE
wm overrideredirect window ?boolean?

If boolean is specified, it must have a proper boolean form and the override-redirect flag for window is set to that value. If boolean is not specified then 1 or 0 is returned to indicate whether or not the override-redirect flag is currently set for window. Setting the override-redirect flag for a window causes it to be ignored by the window manager; among other things, this means that the window will not be reparented from the root window into a decorative frame and the user will not be able to manipulate the window using the normal window manager mechanisms; you, the Tk programmer, have total control over the window.

DKF: The name comes from the way that the X protocol manages window creation. When a (toplevel) window is normally created, the Xserver generates an event (CreateNotify) on the root window, and the window manager (which receives the event because it selects the SubstructureNotifyMask on the root) gets that event and reparents the window into its decorative border. However, the client software that creates the window (not the WM) can specify a flag when the window is created (the overrideRedirect flag) which tells the WM to not do this stuff; i.e. it overrides the redirection of the window into a decorated frame. (I don't remember if it inhibits the passing of the event to the WM, or if the WM is just supposed to notice the flag early and give up on decoration.) There's more to writing a WM than that, of course (especially in relation to fake event handling) but this explains the genesis of the command name.

LES 2009-09-07: I've been trying to make a digital clock on my desktop area (Linux). It looks a lot better with [wm overrideredirect $::topwindow 1], i.e. no title bar. Especially since it has the same background color as the desktop area, so it blends in perfectly. But then it stays on top of all other windows. It looks very ugly with the title bar. :-(

hae 2009-09-08: Maybe this is helpful to you:

LES Very interesting as a concept, should keep me awake at night, but that clock also stays on top of all other windows. I don't want that. And it is quite ugly...

HoMi-(2009-09-09) - I think I know what you want. You want a so-called panel which shows the current time without any decoration made by a window manager (like title bar, minimize/maximize/close button). Right? The usage of
  wm overrideredirect window 1

is the right way. Normally a so created window is the topmost window during creation time but not during the run time. Any other window (application) should be able to overlay this panel.

Note:

  • this panel will not be managed by the window manager (see description above) and the panel is not visible in the task bar

LES Thank you for your attention to my problem, but your assertion does not match the behavior I observe here. The window decoration is indeed not applied, but then the application stays on top of ALL other windows. Here is some code:
 #!/usr/bin/env tclsh
 
 package require Tk
 
 catch { destroy .clock errorswindow }
 set w [ toplevel .clock ]
 wm  withdraw  .
 wm  title  $::w  "clock"
 tk  appname  "clock"
 wm  overrideredirect  $::w  1
 wm  geometry  $::w  "+690+0"
 
 set ::time 12:00
 label $::w.digital -textvar ::time -font "Arial 28" -fg white -bg #000000
 
 pack $::w.digital

HoMi-(2009-09-11) - I've tried your code with Tcl/Tk 8.4 and with Tcl/Tk 8.5 both on Windows and in both cases the "clock" opens on top of the windows stack but it was possible to overlay the "clock" with other application windows. This means the "clock" goes allways to the bottom of the windows stack and was visible only if all application windows are minimized or closed.

Since this is not your observation on Linux it seems to me to be a different behaviour of the windows management between Windows and Linux.

The only solution that comes in mind is

  • create the clock panel
  • and after this use the command
     lower $::w

The lower command pushes the window to the bottom of the windows stack.

LES The lower command renders the entire application invisible. I can tell it's running since it does other things in background (and plays sounds), but it's completely invisible. I already had that command there, but commented out. Now I know why. Wiki elders: should I delete this discussion and summarize the occurrence of this issue in the Linux platform?

[Explain idea.]

[Explain uses--balloon help, screensaver, various wm manipulations, much else.]

[Compare window zooming.] [Is that name as bad as CL thinks?]

One use of wm overrideredirect is to create a splash screen.

(2012-08-18): in the function TkpChangeFocus in tk/unix/tkUnixFocus.c, there is the following hack:
     * Don't set the X focus to a window that's marked override-redirect.
     * This is a hack to avoid problems with menus under olvwm: if we move
     * the focus then the focus can get lost during keyboard traversal.
     (...)
    serial = 0;
    if (winPtr->atts.override_redirect) {
        return serial;
    }

Under Windows, setting the focus on a window with override-redirect works fine. Under Linux (and Solaris), it doesn't. Is there any reason to keep this hack anymore?


See also edit