fix(bar): re-introduce retain exact workspace indices

This commit re-introduces a commit that was lost

original: https://github.com/LGUG2Z/komorebi/commit/36e3eaad36336101321ecafbffdf089795028c1e

blame: https://github.com/LGUG2Z/komorebi/commit/bb31e7155d9eed68b03b54c83e6c4e8fb1e6d84c

fixes: https://github.com/LGUG2Z/komorebi/issues/1388
This commit is contained in:
Csaba
2025-04-01 15:40:29 +02:00
committed by Jeezy
parent 58730b81b4
commit 052eb1c763
+6 -4
View File
@@ -178,9 +178,10 @@ impl BarWidget for Komorebi {
let format = workspaces.display.unwrap_or(DisplayFormat::Text.into()); let format = workspaces.display.unwrap_or(DisplayFormat::Text.into());
config.apply_on_widget(false, ui, |ui| { config.apply_on_widget(false, ui, |ui| {
for (i, (ws, containers, _)) in for (i, (ws, containers, _, should_show)) in
komorebi_notification_state.workspaces.iter().enumerate() komorebi_notification_state.workspaces.iter().enumerate()
{ {
if *should_show {
let is_selected = komorebi_notification_state.selected_workspace.eq(ws); let is_selected = komorebi_notification_state.selected_workspace.eq(ws);
if SelectableFrame::new( if SelectableFrame::new(
@@ -303,6 +304,7 @@ impl BarWidget for Komorebi {
} }
} }
} }
}
}); });
} }
@@ -318,7 +320,7 @@ impl BarWidget for Komorebi {
.workspaces .workspaces
.iter() .iter()
.find(|o| komorebi_notification_state.selected_workspace.eq(&o.0)) .find(|o| komorebi_notification_state.selected_workspace.eq(&o.0))
.map(|(_, _, layer)| layer); .map(|(_, _, layer, _)| layer);
if let Some(layer) = layer { if let Some(layer) = layer {
if (layer_config.show_when_tiling.unwrap_or_default() if (layer_config.show_when_tiling.unwrap_or_default()
@@ -627,6 +629,7 @@ pub struct KomorebiNotificationState {
String, String,
Vec<(bool, KomorebiNotificationStateContainerInformation)>, Vec<(bool, KomorebiNotificationStateContainerInformation)>,
WorkspaceLayer, WorkspaceLayer,
bool,
)>, )>,
pub selected_workspace: String, pub selected_workspace: String,
pub focused_container_information: KomorebiNotificationStateContainerInformation, pub focused_container_information: KomorebiNotificationStateContainerInformation,
@@ -742,7 +745,6 @@ impl KomorebiNotificationState {
true true
}; };
if should_show {
workspaces.push(( workspaces.push((
ws.name().to_owned().unwrap_or_else(|| format!("{}", i + 1)), ws.name().to_owned().unwrap_or_else(|| format!("{}", i + 1)),
if show_all_icons { if show_all_icons {
@@ -776,9 +778,9 @@ impl KomorebiNotificationState {
vec![(true, ws.into())] vec![(true, ws.into())]
}, },
ws.layer().to_owned(), ws.layer().to_owned(),
should_show,
)); ));
} }
}
self.workspaces = workspaces; self.workspaces = workspaces;