Upstream: crates/rune/README.md § Compact tray-controlled windows at
65f8eb43f710, MIT © Anomaly. Bundled by build-rune-apps; links point at this snapshot or at GitHub at that rev.
Compact tray-controlled windows
Use WindowOptions on a WindowSpec. Existing single-window defaults
remain resizable, decorated, with a 420×400 minimum unless AppSpec::min_size is set.
spec.size = (320.0, 160.0);
let app = rune::App::new(spec).windowless().keep_running();
let tray = app.handle();
// Any thread, including a tray callback:
tray.set_position((-320, 80)); // physical desktop pixels
tray.show(); // no focus request; recreates a destroyed window
tray.focus(); // a separate, explicit activation request
// tray.hide() keeps state without invoking on_close; tray.open() shows and activates.
rune::run_windows_with_args(rune::RunOptions { accessory: true }, [], move |_| {
vec![rune::WindowSpec::from_app("call", app).options(rune::WindowOptions {
min_size: Some((320.0, 160.0)),
max_size: Some((320.0, 160.0)),
resizable: false,
borderless: true,
always_on_top: true,
..Default::default()
})]
});
Size constraints use logical points. Placement and topmost work through the native
window manager on macOS and X11; they are no-ops on Wayland. Runtime changes survive
close/recreation. On Wayland, use activate(token) for authorized focus; tokenless
focus() requests attention. show() leaves minimized windows minimized; open()
also restores them. On macOS, no-focus show uses orderFrontRegardless, rather than winit's
makeKeyAndOrderFront. Window-manager focus policy still applies. WindowHandle
also provides show/hide/focus, placement and topmost control on the event thread.
The app owns its tray; Rune supplies the window lifetime and handles.
RunOptions::accessory applies the macOS process policy before the event loop is
created: no Dock icon/default menu and no activation at launch. Other platforms
ignore it; run_windows keeps its regular-launch default.