Skip to main content

controls

Function controls 

Source
pub fn controls(side: CaptionSide, window: &Window, cx: &App) -> Div
Expand description

The caption buttons, for a window whose system caption is gone — appears_transparent on Windows, Decorations::Client on Linux.

Call it at both ends of the bar and let the desktop decide which end fills: App::button_layout reads GNOME’s gtk-decoration-layout, and a platform that reports no layout at all puts the three on the right.

Empty in full screen, and short whatever Window::window_controls says the compositor will refuse. Close is never refused.

The cluster takes its own width in the bar, so nothing is reserved for it the way Theme::TRAFFIC_LIGHT_INSET is reserved for AppKit’s lights — those are painted over the client area by someone else, and these are not.

titlebar::titlebar("titlebar", &self.drag, true, window)
    .child(titlebar::controls(CaptionSide::Left, window, cx))
    .child(div().flex_1().child(/* … */))
    .child(titlebar::controls(CaptionSide::Right, window, cx))