Set window type to dock
- `_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_DOCK` - This lets an X11 WM treat it as a panel/dock
This commit is contained in:
parent
d587a9866b
commit
04f2050af0
@ -7,10 +7,9 @@ authors = ["candifloss <candifloss.cc>"]
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
raw-window-handle = "0.6.2"
|
i-slint-backend-winit = { version = "1.14.1", features = ["x11"] }
|
||||||
slint = { version = "1.14.1", features = ["raw-window-handle-06", "renderer-software"] }
|
slint = { version = "1.14.1", features = ["backend-winit"] }
|
||||||
winit = { version = "0.30.12", features = ["x11rb"] }
|
winit = { version = "0.30.12", features = ["x11rb"] }
|
||||||
x11rb = "0.13.2"
|
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
slint-build = "1.14.1"
|
slint-build = "1.14.1"
|
||||||
|
|||||||
24
src/main.rs
24
src/main.rs
@ -1,18 +1,34 @@
|
|||||||
use slint::{LogicalPosition, LogicalSize};
|
use slint::{LogicalPosition, LogicalSize};
|
||||||
|
use i_slint_backend_winit::{Backend, winit};
|
||||||
|
|
||||||
slint::include_modules!();
|
slint::include_modules!();
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
use winit::platform::x11::{WindowAttributesExtX11, WindowType};
|
||||||
|
|
||||||
|
// Configure winit attributes before any Slint window is created.
|
||||||
|
let backend = Backend::builder()
|
||||||
|
.with_window_attributes_hook(|attrs| {
|
||||||
|
// Mark the X11 window as a dock so WMs treat it as a panel/topbar.
|
||||||
|
attrs
|
||||||
|
.with_x11_window_type(vec![WindowType::Dock])
|
||||||
|
// hide from taskbar / pagers (useful for panels)
|
||||||
|
//.with_skip_taskbar(true)
|
||||||
|
})
|
||||||
|
.build()?;
|
||||||
|
|
||||||
|
slint::platform::set_platform(Box::new(backend))?;
|
||||||
|
|
||||||
let bar_height = 25;
|
let bar_height = 25;
|
||||||
let bar_width = 1366;
|
let bar_width = 1366;
|
||||||
|
|
||||||
let ui = TopBar::new()?;
|
let ui = TopBar::new()?;
|
||||||
ui.set_bar_width(bar_width);
|
ui.set_bar_width(bar_width);
|
||||||
ui.set_bar_height(bar_height);
|
ui.set_bar_height(bar_height);
|
||||||
ui.window()
|
|
||||||
.set_size(LogicalSize::new(bar_width as f32, bar_height as f32));
|
|
||||||
ui.window().set_position(LogicalPosition::new(0.0, 0.0));
|
|
||||||
ui.run()?;
|
|
||||||
|
|
||||||
|
ui.window().set_size(LogicalSize::new(bar_width as f32, bar_height as f32));
|
||||||
|
ui.window().set_position(LogicalPosition::new(0.0, 0.0));
|
||||||
|
|
||||||
|
ui.run()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user