|  | @@ -14,8 +14,32 @@ pub fn external(tx: &Channel, _cfg: &Config) {
 | 
	
		
			
				|  |  |          match kind {
 | 
	
		
			
				|  |  |              'T' => comm::send(tx, "title", line),
 | 
	
		
			
				|  |  |              'M' => comm::send(tx, "cmus", line),
 | 
	
		
			
				|  |  | +            'W' => comm::send(tx, "desktops", &parse_bspwm(line)),
 | 
	
		
			
				|  |  |              _ => ()
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +fn parse_bspwm(line: &str) -> String {
 | 
	
		
			
				|  |  | +    let mut out = String::new();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    let elems = line.split(':');
 | 
	
		
			
				|  |  | +    for elem in elems {
 | 
	
		
			
				|  |  | +        let mut chars = elem.chars();
 | 
	
		
			
				|  |  | +        let kind = chars.next().unwrap();
 | 
	
		
			
				|  |  | +        let name = chars.collect::<String>();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if kind != 'M' && kind != 'm' && kind != 'L' {
 | 
	
		
			
				|  |  | +            if kind.is_uppercase() {
 | 
	
		
			
				|  |  | +                out = format!("{}%{{Bgray}} {} %{{B-}}", out, name);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if kind == 'U' || kind == 'u' {
 | 
	
		
			
				|  |  | +                out = format!("{}%{{Bred}} {} %{{B-}}", out, name);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            else if kind == 'O' || kind == 'o' {
 | 
	
		
			
				|  |  | +                out = format!("{} {} ", out, name);
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +    out
 | 
	
		
			
				|  |  | +}
 |