parent
							
								
									94cb31baa5
								
							
						
					
					
						commit
						07e64338b3
					
				
				 6 changed files with 36 additions and 20 deletions
			
			
		@ -1,11 +1,20 @@ | 
				
			|||||||
use swayr::con; | 
					use std::collections::HashMap; | 
				
			||||||
 | 
					use std::os::unix::net::UnixStream; | 
				
			||||||
use swayr::ipc; | 
					use swayr::ipc; | 
				
			||||||
 | 
					use swayr::window; | 
				
			||||||
 | 
					
 | 
				
			||||||
fn main() { | 
					fn main() { | 
				
			||||||
    println!("sway here!"); | 
					    println!("sway here!"); | 
				
			||||||
    let root_node = ipc::get_tree(); | 
					    let root_node = ipc::get_tree(); | 
				
			||||||
    for con in con::get_cons(&root_node) { | 
					    for win in window::get_windows(&root_node) { | 
				
			||||||
        println!("  {}", con); | 
					        println!("  {}", win); | 
				
			||||||
 | 
					    } | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if let Ok(sock) = UnixStream::connect(ipc::SWAYR_SOCKET_PATH) { | 
				
			||||||
 | 
					        let win_props: Result<HashMap<ipc::Id, ipc::WindowProps>, serde_json::Error> = | 
				
			||||||
 | 
					            serde_json::from_reader(sock); | 
				
			||||||
 | 
					        println!("Here are the window properties:\n{:#?}", win_props) | 
				
			||||||
 | 
					    } else { | 
				
			||||||
 | 
					        panic!("Could not connect to socket!") | 
				
			||||||
    } | 
					    } | 
				
			||||||
    println!("Yes!") | 
					 | 
				
			||||||
} | 
					} | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@ | 
				
			|||||||
pub mod con; | 
					 | 
				
			||||||
pub mod demon; | 
					pub mod demon; | 
				
			||||||
pub mod ipc; | 
					pub mod ipc; | 
				
			||||||
 | 
					pub mod window; | 
				
			||||||
 | 
				
			|||||||
					Loading…
					
					
				
		Reference in new issue