From a767e2d0ba553710f4fcfe6015923abaac463043 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Wed, 13 Jan 2021 21:09:57 +0100 Subject: [PATCH] ... --- src/{main.rs => bin/swayr.rs} | 3 ++- src/bin/swayrd.rs | 6 ++++++ src/con.rs | 1 + src/ipc.rs | 11 +++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) rename src/{main.rs => bin/swayr.rs} (72%) create mode 100644 src/bin/swayrd.rs diff --git a/src/main.rs b/src/bin/swayr.rs similarity index 72% rename from src/main.rs rename to src/bin/swayr.rs index 1ba096b..eadf98e 100644 --- a/src/main.rs +++ b/src/bin/swayr.rs @@ -2,9 +2,10 @@ use swayr::con; use swayr::ipc; fn main() { + println!("sway here!"); let root_node = ipc::get_tree(); for con in con::get_cons(&root_node) { - println!("{}", con); + println!(" {}", con); } println!("Yes!") } diff --git a/src/bin/swayrd.rs b/src/bin/swayrd.rs new file mode 100644 index 0000000..96341c9 --- /dev/null +++ b/src/bin/swayrd.rs @@ -0,0 +1,6 @@ +use swayr::con; +use swayr::ipc; + +fn main() { + println!("swayd here!"); +} diff --git a/src/con.rs b/src/con.rs index b3255d0..5818d24 100644 --- a/src/con.rs +++ b/src/con.rs @@ -26,6 +26,7 @@ pub fn get_cons<'a>(tree: &'a ipc::Node) -> Vec> { id: n.id, app_id: match &n.app_id { Some(s) => Some(s.as_ref()), + // TODO: Use n.window_properties.class instead! None => None, }, }) diff --git a/src/ipc.rs b/src/ipc.rs index 3910035..e496492 100644 --- a/src/ipc.rs +++ b/src/ipc.rs @@ -78,6 +78,16 @@ pub enum ShellType { XWayland, } +#[derive(Deserialize)] +#[allow(dead_code)] +pub struct WindowProperties { + pub class: Option, + pub instance: Option, + pub title: Option, + //pub window_type: Option + //pub transient_for: DONTKNOW, +} + #[derive(Deserialize)] #[allow(dead_code)] pub struct Node { @@ -107,6 +117,7 @@ pub struct Node { pub max_render_time: Option, pub pid: Option, pub shell: Option, + pub window_properties: Option, } impl Node {