fix: allow activating workspaces which are already active & improve styling

This commit is contained in:
Ashley Wulber 2022-07-29 16:13:24 -04:00
parent ef6e865963
commit 580df62e46
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
2 changed files with 7 additions and 8 deletions

View file

@ -60,7 +60,7 @@ button.inactive:hover {
padding: 0px;
background-color: darker(@view_bg_color);
background-image: none;
color: @view_bg_color;
color: @view_fg_color;
border-color: transparent;
outline-color: transparent;
}

View file

@ -31,20 +31,19 @@ impl WorkspaceButton {
let is_active = obj.active() == 0;
let id = obj.id();
let new_button = ToggleButton::with_label(&id);
new_button.set_sensitive(!is_active);
if obj.active() == 0 {
new_button.add_css_class("active");
} else if obj.active() == 1 {
if obj.active() == 1 {
new_button.add_css_class("alert");
} else if obj.active() == 0 {
new_button.add_css_class("active");
} else {
new_button.add_css_class("inactive");
}
self.append(&new_button);
new_button.connect_clicked(move |_| {
let id_clone = id.clone();
if !is_active {
let _ = TX.get().unwrap().send(WorkspaceEvent::Activate(id_clone));
}
let _ = TX.get().unwrap().send(WorkspaceEvent::Activate(id_clone));
});
imp.button.replace(new_button);