fix(workspaces): clicking currently focused workspace attempts to focus it

Resolves #731
This commit is contained in:
Jake Stanger 2024-11-19 22:23:57 +00:00
parent ce48fc9d0d
commit 230dd8b13b
No known key found for this signature in database
GPG Key ID: C51FC8F9CB0BEA61

View File

@ -133,26 +133,27 @@ fn create_button(
let button = new_icon_button(label, icon_theme, icon_size); let button = new_icon_button(label, icon_theme, icon_size);
button.set_widget_name(name); button.set_widget_name(name);
let style_context = button.style_context(); button.add_class("item");
style_context.add_class("item");
if visibility.is_visible() { if visibility.is_visible() {
style_context.add_class("visible"); button.add_class("visible");
} }
if visibility.is_focused() { if visibility.is_focused() {
style_context.add_class("focused"); button.add_class("focused");
} }
if !visibility.is_visible() { if !visibility.is_visible() {
style_context.add_class("inactive"); button.add_class("inactive");
} }
{ {
let tx = tx.clone(); let tx = tx.clone();
let name = name.to_string(); let name = name.to_string();
button.connect_clicked(move |_item| { button.connect_clicked(move |button| {
try_send!(tx, name.clone()); if !button.style_context().has_class("focused") {
try_send!(tx, name.clone());
}
}); });
} }