Skip to content

Commit

Permalink
Merge pull request #5 from donovanglover/fix/is-special
Browse files Browse the repository at this point in the history
fix(is_special): Ensure that active window exists
  • Loading branch information
donovanglover authored Aug 13, 2023
2 parents fc7647b + cf81b4e commit 40eec63
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,16 @@ pub fn spawn_dim_thread(
/// Gets whether the current workspace is a special workspace or not.
///
/// This function works by getting which workspace the active window is in.
///
/// The if statement is used to make sure this function works when no window
/// is the active window.
pub fn is_special() -> bool {
let Client { workspace, .. } = Client::get_active().unwrap().unwrap();
if let Some(client) = Client::get_active().unwrap() {
let Client { workspace, .. } = client;
return workspace.name.contains("special");
}

workspace.name.contains("special")
false
}

/// Returns true if there is only one visible window in the special workspace.
Expand Down

0 comments on commit 40eec63

Please sign in to comment.