From 5c9aa42c841a4cfcbb5c0f625ee70209be63a888 Mon Sep 17 00:00:00 2001 From: Candifloss Date: Thu, 1 Jan 2026 23:10:08 +0530 Subject: [PATCH] Basic full screen window --- src/main.rs | 25 ++++++++++++++++++++++++- ui/power-menu.slint | 3 +++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 67b0ad6..05a36ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,11 +5,34 @@ use i_slint_backend_winit::{ window::WindowAttributes, }, }; +use slint::{LogicalPosition, LogicalSize}; slint::include_modules!(); fn main() -> Result<(), Box> { + // Configure X11 window attributes before Slint creates the window. + let window_attrs = |attrs: WindowAttributes| { + attrs + // Set the window type to Desktop so WMs avoid normal window rules, treat it as a full screen window. + .with_x11_window_type(vec![WindowType::Desktop]) + // Make the window unmanaged. This prevents tiling WMs from reserving space or moving it. + .with_override_redirect(true) + }; + + // Build and activate backend with X11 window-attribute hook. + let backend = Backend::builder() + .with_window_attributes_hook(window_attrs) + .build()?; + slint::platform::set_platform(Box::new(backend))?; + let ui = PowerMenu::new()?; + + let screen_width = 1366; + let screen_height = 768; + + ui.window().set_size(LogicalSize::new(screen_width as f32, screen_height as f32)); + ui.window().set_position(LogicalPosition::new(0.0, 0.0)); + ui.run(); - + Ok(()) } diff --git a/ui/power-menu.slint b/ui/power-menu.slint index 39c6bda..366ca7d 100644 --- a/ui/power-menu.slint +++ b/ui/power-menu.slint @@ -1,4 +1,7 @@ export component PowerMenu inherits Window { + in property screen-width: 1366; + in property screen-height: 768; + background: #adadad57; no-frame: true; } \ No newline at end of file