handling grouping edge case for komorebi focus window

This commit is contained in:
Csaba
2024-11-09 01:02:44 +01:00
parent cba0fcd882
commit ec5f7dc82d
+15 -9
View File
@@ -129,6 +129,7 @@ impl BarWidget for Komorebi {
if self.workspaces.enable { if self.workspaces.enable {
let mut update = None; let mut update = None;
// NOTE: There should always be at least one workspace.
config.grouping.apply_on_widget(ui, |ui| { config.grouping.apply_on_widget(ui, |ui| {
for (i, (ws, should_show)) in for (i, (ws, should_show)) in
komorebi_notification_state.workspaces.iter().enumerate() komorebi_notification_state.workspaces.iter().enumerate()
@@ -308,8 +309,10 @@ impl BarWidget for Komorebi {
if let Some(focused_window) = self.focused_window { if let Some(focused_window) = self.focused_window {
if focused_window.enable { if focused_window.enable {
config.grouping.apply_on_widget(ui, |ui| {
let titles = &komorebi_notification_state.focused_container_information.0; let titles = &komorebi_notification_state.focused_container_information.0;
if !titles.is_empty() {
config.grouping.apply_on_widget(ui, |ui| {
let icons = &komorebi_notification_state.focused_container_information.1; let icons = &komorebi_notification_state.focused_container_information.1;
let focused_window_idx = let focused_window_idx =
komorebi_notification_state.focused_container_information.2; komorebi_notification_state.focused_container_information.2;
@@ -382,9 +385,9 @@ impl BarWidget for Komorebi {
) )
.clicked() .clicked()
{ {
if komorebi_client::send_message(&SocketMessage::MouseFollowsFocus( if komorebi_client::send_message(
false, &SocketMessage::MouseFollowsFocus(false),
)) )
.is_err() .is_err()
{ {
tracing::error!( tracing::error!(
@@ -392,9 +395,9 @@ impl BarWidget for Komorebi {
); );
} }
if komorebi_client::send_message(&SocketMessage::FocusStackWindow( if komorebi_client::send_message(
i, &SocketMessage::FocusStackWindow(i),
)) )
.is_err() .is_err()
{ {
tracing::error!( tracing::error!(
@@ -402,9 +405,11 @@ impl BarWidget for Komorebi {
); );
} }
if komorebi_client::send_message(&SocketMessage::MouseFollowsFocus( if komorebi_client::send_message(
&SocketMessage::MouseFollowsFocus(
komorebi_notification_state.mouse_follows_focus, komorebi_notification_state.mouse_follows_focus,
)) ),
)
.is_err() .is_err()
{ {
tracing::error!( tracing::error!(
@@ -418,6 +423,7 @@ impl BarWidget for Komorebi {
} }
}); });
} }
}
ui.add_space(WIDGET_SPACING); ui.add_space(WIDGET_SPACING);
} }