con_props -> extra_props

timeout_old
Tassilo Horn 4 years ago
parent e3c5108bd8
commit 4ff03e7038
  1. 14
      src/con.rs
  2. 8
      src/demon.rs

@ -12,7 +12,7 @@ use swayipc::reply as r;
pub struct Window<'a> { pub struct Window<'a> {
node: &'a r::Node, node: &'a r::Node,
workspace: &'a r::Node, workspace: &'a r::Node,
con_props: Option<ipc::ExtraProps>, extra_props: Option<ipc::ExtraProps>,
} }
impl Window<'_> { impl Window<'_> {
@ -70,9 +70,11 @@ impl Ord for Window<'_> {
std::cmp::Ordering::Greater std::cmp::Ordering::Greater
} else { } else {
let lru_a = let lru_a =
self.con_props.as_ref().map_or(0, |wp| wp.last_focus_time); self.extra_props.as_ref().map_or(0, |wp| wp.last_focus_time);
let lru_b = let lru_b = other
other.con_props.as_ref().map_or(0, |wp| wp.last_focus_time); .extra_props
.as_ref()
.map_or(0, |wp| wp.last_focus_time);
lru_a.cmp(&lru_b).reverse() lru_a.cmp(&lru_b).reverse()
} }
} }
@ -114,7 +116,7 @@ fn build_windows<'a>(
for n in workspace.windows() { for n in workspace.windows() {
v.push(Window { v.push(Window {
node: &n, node: &n,
con_props: extra_props.and_then(|m| m.get(&n.id).cloned()), extra_props: extra_props.and_then(|m| m.get(&n.id).cloned()),
workspace: &workspace, workspace: &workspace,
}) })
} }
@ -133,7 +135,7 @@ fn build_workspaces<'a>(
.iter() .iter()
.map(|w| Window { .map(|w| Window {
node: &w, node: &w,
con_props: extra_props.and_then(|m| m.get(&w.id).cloned()), extra_props: extra_props.and_then(|m| m.get(&w.id).cloned()),
workspace: &workspace, workspace: &workspace,
}) })
.collect(); .collect();

@ -16,15 +16,15 @@ use swayipc as s;
use swayipc::reply as r; use swayipc::reply as r;
pub fn run_demon() { pub fn run_demon() {
let con_props: Arc<RwLock<HashMap<i64, ipc::ExtraProps>>> = let extra_props: Arc<RwLock<HashMap<i64, ipc::ExtraProps>>> =
Arc::new(RwLock::new(HashMap::new())); Arc::new(RwLock::new(HashMap::new()));
let con_props_for_ev_handler = con_props.clone(); let extra_props_for_ev_handler = extra_props.clone();
thread::spawn(move || { thread::spawn(move || {
monitor_sway_events(con_props_for_ev_handler); monitor_sway_events(extra_props_for_ev_handler);
}); });
serve_client_requests(con_props); serve_client_requests(extra_props);
} }
fn connect_and_subscribe() -> s::Fallible<s::EventIterator> { fn connect_and_subscribe() -> s::Fallible<s::EventIterator> {

Loading…
Cancel
Save