Overlay windows
Build watermarks, desktop widgets, and heads-up overlays with transparent, click-through, always-on-bottom, and all-workspaces windows.
An overlay sits outside the normal window stack: a watermark that ignores clicks, a widget pinned
below other windows, a badge that follows you across workspaces. You build one with
DecoratedWindow flags from nucleus-application.
Build a click-through watermark
fun main(args: Array<String>) = nucleusApplication(args) {
DecoratedWindow(
onCloseRequest = { },
state = rememberWindowState(
position = WindowPosition.Aligned(Alignment.BottomEnd),
size = DpSize(360.dp, 160.dp),
),
title = "Watermark",
resizable = false,
undecorated = true,
transparent = true,
alwaysOnTop = true,
focusable = false,
clickThrough = true,
hiddenFromDock = true,
visibleOnAllWorkspaces = true,
forceX11 = true,
) {
Watermark()
}
}Pair clickThrough = true with focusable = false: a window you cannot click has no use for
keyboard focus.
Pin a widget below other windows
A desktop widget swaps alwaysOnTop for alwaysOnBottom and keeps clicks:
DecoratedWindow(
onCloseRequest = ::exitApplication,
title = "Nucleus widget",
undecorated = true,
transparent = true,
hiddenFromDock = true,
nativeContextMenu = true,
visibleOnAllWorkspaces = true,
forceX11 = true,
alwaysOnBottom = true,
) {
WidgetSurface()
}alwaysOnTop and alwaysOnBottom exclude each other: the last one you set wins.
The window still shows in the taskbar and Alt+Tab unless you set hiddenFromDock. Native Wayland
cannot glue a surface to the wallpaper.
Toggle flags at run time
clickThrough, alwaysOnBottom, and visibleOnAllWorkspaces are reactive. For imperative
control, call the setters on nucleusWindow.unsafe.taoWindow:
fun applyOverlayMode(window: TaoWindow, passive: Boolean) {
window.setIgnoreCursorEvents(passive)
window.setAlwaysOnBottom(passive)
window.setVisibleOnAllWorkspaces(passive)
}transparent and forceX11 apply at creation only.
Take an X11 surface on Wayland
Stacking, position, and workspace flags do nothing on a native Wayland surface. forceX11 = true
gives one window an XWayland surface and leaves the rest of the app on Wayland. To move the whole
process, set NUCLEUS_TAO_LINUX_RENDERER=x11 (or GDK_BACKEND=x11) before launch.
TaoWindow.isNativeWaylandSurface tells you which surface a window received, after it is ready.
To decide whether you can position a window, branch on canPlaceOnScreen instead. See
Linux and Wayland.
If forceX11 finds no X server, the window stays on Wayland. Nucleus logs a warning for each flag
that a native Wayland surface ignores.
Platform behavior
A transparent window keeps a shadow shaped to the drawn content. Floating above another app's full-screen Space is not supported.
visibleOnAllWorkspaces is a no-op. A window with hiddenFromDock = true already shows on every
virtual desktop. A fully transparent window drops the system shadow and border.
Transparency works on X11 and Wayland. alwaysOnBottom, visibleOnAllWorkspaces, and positioning
need X11: use forceX11 per window or NUCLEUS_TAO_LINUX_RENDERER=x11 for the process.
A mostly transparent window reads better with undecorated = true and custom chrome than with the
stock TitleBar.
API reference
| Parameter | Default | Reactive | Description |
|---|---|---|---|
transparent | false | No | Native surface with an alpha channel. |
clickThrough | false | Yes | Pointer events pass to whatever sits behind. |
alwaysOnBottom | false | Yes | Keeps the window below normal windows. Clears alwaysOnTop. |
visibleOnAllWorkspaces | false | Yes | Shows the window on every workspace or Space. |
forceX11 | false | No | Linux only: XWayland surface for this window. |
HostedWindow takes alwaysOnBottom. The Material and Jewel wrappers take transparent,
clickThrough, visibleOnAllWorkspaces, and forceX11.
TaoWindow member | Description |
|---|---|
setIgnoreCursorEvents(ignore) | Imperative clickThrough. |
setAlwaysOnBottom(alwaysOnBottom) | Imperative alwaysOnBottom. |
setVisibleOnAllWorkspaces(visible) | Imperative visibleOnAllWorkspaces. |
isNativeWaylandSurface | Window runs on a native Wayland surface. |
canPlaceOnScreen | App can read and set the window's screen position. |
What's next
- Windows: the other
DecoratedWindowparameters. - Linux and Wayland: session detection, screen placement, and the X11 fallback.
- Context menus: the menu an interactive widget needs.
Last updated on
Dialogs and popups
Open modal dialogs with DecoratedDialog, DialogWindow, HostedDialog, or a toolkit dialog, and render Compose popups as native surfaces placed against the screen.
Linux and Wayland
How Nucleus windows run on native Wayland and X11, what the compositor controls, and how to branch on screen placement.