Skip to content

Commit

Permalink
correctly handle workspaces with no clients in advanced mode, fixes #13
Browse files Browse the repository at this point in the history
  • Loading branch information
FieldofClay committed Apr 27, 2024
1 parent d4a7318 commit 449eaa6
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ fn print_all() -> Result<()> {
HyprError::NotOkDispatch("No active workspace found".to_string())
})?;

let client = Clients::get()?
.find(|c| c.address == workspace.last_window)
.ok_or_else(|| {
log::warn!("Unable to get last window");
HyprError::NotOkDispatch("Unable to get last window".to_string())
})?;
let client = Clients::get()?.find(|c| c.address == workspace.last_window);

let (title, initial_title) = match client {
Some(c) => (c.title, c.initial_title),
None => (String::new(), String::new()),
};

let mc: MonitorCustom = MonitorCustom {
name: monitor.name,
title: client.title,
initial_title: client.initial_title,
title: title,
initial_title: initial_title,
};
out_monitors.push(mc);
}
Expand Down

0 comments on commit 449eaa6

Please sign in to comment.