mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-07-16 10:02:41 +02:00
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:
@@ -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(
|
||||||
@@ -302,6 +303,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,42 +745,41 @@ 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 {
|
let mut containers = vec![];
|
||||||
let mut containers = vec![];
|
let mut has_monocle = false;
|
||||||
let mut has_monocle = false;
|
|
||||||
|
|
||||||
// add monocle container
|
// add monocle container
|
||||||
if let Some(container) = ws.monocle_container() {
|
if let Some(container) = ws.monocle_container() {
|
||||||
containers.push((true, container.into()));
|
containers.push((true, container.into()));
|
||||||
has_monocle = true;
|
has_monocle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all tiled windows
|
// add all tiled windows
|
||||||
for (i, container) in ws.containers().iter().enumerate() {
|
for (i, container) in ws.containers().iter().enumerate() {
|
||||||
containers.push((
|
containers.push((
|
||||||
!has_monocle && i == ws.focused_container_idx(),
|
!has_monocle && i == ws.focused_container_idx(),
|
||||||
container.into(),
|
container.into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// add all floating windows
|
// add all floating windows
|
||||||
for floating_window in ws.floating_windows() {
|
for floating_window in ws.floating_windows() {
|
||||||
containers.push((
|
containers.push((
|
||||||
!has_monocle && floating_window.is_focused(),
|
!has_monocle && floating_window.is_focused(),
|
||||||
floating_window.into(),
|
floating_window.into(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
containers
|
containers
|
||||||
} else {
|
} else {
|
||||||
vec![(true, ws.into())]
|
vec![(true, ws.into())]
|
||||||
},
|
},
|
||||||
ws.layer().to_owned(),
|
ws.layer().to_owned(),
|
||||||
));
|
should_show,
|
||||||
}
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
self.workspaces = workspaces;
|
self.workspaces = workspaces;
|
||||||
|
|||||||
Reference in New Issue
Block a user