Fix space reservation

- Override window management to avoid reserving space or moving other windows
This commit is contained in:
Candifloss 2025-12-12 11:33:07 +05:30
parent b5895f068a
commit 589d97c836

View File

@ -80,10 +80,17 @@ fn set_ui_props(
/// Create and display the OSD popup window. /// Create and display the OSD popup window.
/// Loads config, applies X11 window attributes, sets UI props, and runs the Slint event loop. /// Loads config, applies X11 window attributes, sets UI props, and runs the Slint event loop.
pub fn show_popup(args: &OsdArgs) -> Result<(), Box<dyn std::error::Error>> { pub fn show_popup(args: &OsdArgs) -> Result<(), Box<dyn std::error::Error>> {
// Load configs.
let cfg = PopcornConfig::load_or_default(); let cfg = PopcornConfig::load_or_default();
// Mark the window as a dock-type override window so WMs treat it like an OSD layer. // Configure X11 window attributes before Slint creates the window.
let window_attrs = |attrs: WindowAttributes| attrs.with_x11_window_type(vec![WindowType::Dock]); let window_attrs = |attrs: WindowAttributes| {
attrs
// Present the window as a dock so most WMs avoid decorations and normal window rules.
.with_x11_window_type(vec![WindowType::Dock])
// 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. // Build and activate backend with X11 window-attribute hook.
let backend = Backend::builder() let backend = Backend::builder()
@ -95,6 +102,8 @@ pub fn show_popup(args: &OsdArgs) -> Result<(), Box<dyn std::error::Error>> {
let ui = OSDpopup::new()?; let ui = OSDpopup::new()?;
set_ui_props(&ui, &cfg, args)?; set_ui_props(&ui, &cfg, args)?;
// Run!
ui.run()?; ui.run()?;
Ok(()) Ok(())
} }