Fix space reservation
- Override window management to avoid reserving space or moving other windows
This commit is contained in:
parent
b5895f068a
commit
589d97c836
@ -80,10 +80,17 @@ fn set_ui_props(
|
||||
/// Create and display the OSD popup window.
|
||||
/// 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>> {
|
||||
// Load configs.
|
||||
let cfg = PopcornConfig::load_or_default();
|
||||
|
||||
// Mark the window as a dock-type override window so WMs treat it like an OSD layer.
|
||||
let window_attrs = |attrs: WindowAttributes| attrs.with_x11_window_type(vec![WindowType::Dock]);
|
||||
// Configure X11 window attributes before Slint creates the window.
|
||||
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.
|
||||
let backend = Backend::builder()
|
||||
@ -95,6 +102,8 @@ pub fn show_popup(args: &OsdArgs) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let ui = OSDpopup::new()?;
|
||||
set_ui_props(&ui, &cfg, args)?;
|
||||
|
||||
// Run!
|
||||
ui.run()?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user