mirror of
https://github.com/JakeStanger/ironbar.git
synced 2024-11-22 05:34:35 +03:00
fix(workspaces): clicking currently focused workspace attempts to focus it
Resolves #731
This commit is contained in:
parent
ce48fc9d0d
commit
230dd8b13b
@ -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());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user