diff --git a/src/main.rs b/src/main.rs index 2e908fd..304574b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,8 @@ use winit::event::{ WindowEvent::{CloseRequested, ReceivedCharacter}, }; use winit::event_loop::{ControlFlow, EventLoop}; +use winit::platform::unix::x11::util::WindowType; +use winit::platform::unix::{WindowBuilderExtUnix, WindowExtUnix, XWindowType}; use winit::window::{Window, WindowBuilder}; use self::core::roftl::Roftl; @@ -40,9 +42,40 @@ fn main() -> Result<(), Box> { let window = WindowBuilder::new() .with_decorations(false) .with_transparent(true) + .with_title("roftl") + .with_visible(true) + .with_always_on_top(true) .build(&event_loop) .expect("Could not create window"); + debug! {"Hide window from taskbar"} + let screen = window + .xlib_screen_id() + .expect("Could not get screen id of window"); + + let xcb_conn = unsafe { + xcb::Connection::from_raw_conn( + window.xcb_connection().unwrap() as *mut xcb::ffi::xcb_connection_t + ) + }; + + let ewmh_conn = xcb_util::ewmh::Connection::connect(xcb_conn) + .map_err(|(e, _)| e) + .unwrap(); + + let xcb_window: xcb::xproto::Window = + window.xlib_window().expect("Cannot get xlib window") as u32; + + xcb_util::ewmh::request_change_wm_state( + &ewmh_conn, + screen, + xcb_window, + xcb_util::ewmh::STATE_ADD, + ewmh_conn.WM_STATE(), + ewmh_conn.WM_STATE_SKIP_TASKBAR(), + xcb_util::ewmh::CLIENT_SOURCE_TYPE_NORMAL, + ); + debug! {"Window id: {:?}", window.id()} debug! {"Draw primary state to window"}