Skip to content

Commit

Permalink
fix(workspaces): clicking currently focused workspace attempts to foc…
Browse files Browse the repository at this point in the history
…us it

Resolves #731
  • Loading branch information
JakeStanger committed Nov 19, 2024
1 parent ce48fc9 commit 230dd8b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/modules/workspaces.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,26 +133,27 @@ fn create_button(
let button = new_icon_button(label, icon_theme, icon_size);
button.set_widget_name(name);

let style_context = button.style_context();
style_context.add_class("item");
button.add_class("item");

if visibility.is_visible() {
style_context.add_class("visible");
button.add_class("visible");
}

if visibility.is_focused() {
style_context.add_class("focused");
button.add_class("focused");
}

if !visibility.is_visible() {
style_context.add_class("inactive");
button.add_class("inactive");
}

{
let tx = tx.clone();
let name = name.to_string();
button.connect_clicked(move |_item| {
try_send!(tx, name.clone());
button.connect_clicked(move |button| {
if !button.style_context().has_class("focused") {
try_send!(tx, name.clone());
}
});
}

Expand Down

0 comments on commit 230dd8b

Please sign in to comment.