|  | @@ -1,13 +1,26 @@
 | 
	
		
			
				|  |  |  use comm;
 | 
	
		
			
				|  |  |  use comm::Channel;
 | 
	
		
			
				|  |  |  use config::Config;
 | 
	
		
			
				|  |  | -use std::io;
 | 
	
		
			
				|  |  | +use std::io::prelude::*;
 | 
	
		
			
				|  |  | +use std::io::BufReader;
 | 
	
		
			
				|  |  | +use std::process::{Command, Stdio};
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +pub fn bspwm(tx: &Channel, _cfg: &Config) {
 | 
	
		
			
				|  |  | +    let bspc = Command::new("bspc")
 | 
	
		
			
				|  |  | +        .arg("subscribe")
 | 
	
		
			
				|  |  | +        .arg("report")
 | 
	
		
			
				|  |  | +        .stdout(Stdio::piped())
 | 
	
		
			
				|  |  | +        .spawn()
 | 
	
		
			
				|  |  | +        .ok()
 | 
	
		
			
				|  |  | +        .expect("Failed to start bspc subscribe");
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    let stdout = bspc.stdout.unwrap();
 | 
	
		
			
				|  |  | +    let mut reader = BufReader::new(stdout);
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -pub fn external(tx: &Channel, _cfg: &Config) {
 | 
	
		
			
				|  |  |      let mut line = String::new();
 | 
	
		
			
				|  |  |      loop {
 | 
	
		
			
				|  |  |          line.clear();
 | 
	
		
			
				|  |  | -        io::stdin().read_line(&mut line).ok().expect("Failed to read line");
 | 
	
		
			
				|  |  | +        reader.read_line(&mut line).ok().expect("Failed to read line");
 | 
	
		
			
				|  |  |          let kind = line.remove(0);
 | 
	
		
			
				|  |  |          let line = line.trim();
 | 
	
		
			
				|  |  |  
 |