beetlebug

ztk::win::backdrop

Sets the system backdrop of a toplevel on Windows 11: the material that the system renders behind the window.

Synopsis

ztk::win::backdrop WINDOW ?TYPE?

Arguments

Name Type Default Meaning
WINDOW toplevel The toplevel, such as ..
TYPE auto, none, mica, acrylic, tabbed auto The value of DWMWA_SYSTEMBACKDROP_TYPE. auto lets the system choose. The client area of ztk is opaque, so the backdrop shows in the title bar.

Return value

With no TYPE, the type that the command set last, or auto. With a TYPE, an empty string.

Errors

Error When
ztk::win::backdrop is only on Windows A backend other than Windows. The error code is ZTK WIN UNAVAILABLE.
this Windows has no system backdrop The version of Windows has no system backdrop. The error code is ZTK WIN BACKDROP.
bad backdrop "X": must be acrylic, auto, mica, none, or tabbed An unknown type.
bad window path name "W" No widget has the name.
"W" is not a toplevel The widget is not a toplevel.
"W" has no window The toplevel has no platform window yet.

Platforms

Platform Works
Windows Yes
macOS No: ZTK WIN UNAVAILABLE
Linux, Wayland No: ZTK WIN UNAVAILABLE
Linux, X11 No: ZTK WIN UNAVAILABLE
Web No: ZTK WIN UNAVAILABLE
iOS, Android No: ZTK WIN UNAVAILABLE
Headless No: ZTK WIN UNAVAILABLE

Example

if {[ztk::has win]} {
    ztk::win::backdrop . mica
    puts [ztk::win::backdrop .]
}

See also