fix(ags bar): use right getters for workspace widget
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
179e402504
commit
42bd408a76
1 changed files with 11 additions and 11 deletions
|
@ -86,10 +86,10 @@ export default () => {
|
||||||
const currentId = Hyprland.get_focused_workspace().get_id().toString();
|
const currentId = Hyprland.get_focused_workspace().get_id().toString();
|
||||||
|
|
||||||
const indicators = ((self.get_parent() as Widget.Overlay)
|
const indicators = ((self.get_parent() as Widget.Overlay)
|
||||||
.child as Widget.Box)
|
.get_child() as Widget.Box)
|
||||||
.children as Widget.Revealer[];
|
.get_children() as Widget.Revealer[];
|
||||||
|
|
||||||
const currentIndex = indicators.findIndex((w) => w.get_name() === currentId);
|
const currentIndex = indicators.findIndex((w) => w.name === currentId);
|
||||||
|
|
||||||
if (currentIndex >= 0) {
|
if (currentIndex >= 0) {
|
||||||
self.set_css(`margin-left: ${L_PADDING + (currentIndex * WS_WIDTH)}px`);
|
self.set_css(`margin-left: ${L_PADDING + (currentIndex * WS_WIDTH)}px`);
|
||||||
|
@ -135,7 +135,7 @@ export default () => {
|
||||||
const updateWorkspaces = () => {
|
const updateWorkspaces = () => {
|
||||||
Hyprland.get_workspaces().forEach((ws) => {
|
Hyprland.get_workspaces().forEach((ws) => {
|
||||||
const currentWs = (self.get_children() as Widget.Revealer[])
|
const currentWs = (self.get_children() as Widget.Revealer[])
|
||||||
.find((ch) => ch.get_name() === ws.get_id().toString());
|
.find((ch) => ch.name === ws.get_id().toString());
|
||||||
|
|
||||||
if (!currentWs && ws.get_id() > 0) {
|
if (!currentWs && ws.get_id() > 0) {
|
||||||
self.add(Workspace({ id: ws.get_id() }));
|
self.add(Workspace({ id: ws.get_id() }));
|
||||||
|
@ -144,7 +144,8 @@ export default () => {
|
||||||
|
|
||||||
// Make sure the order is correct
|
// Make sure the order is correct
|
||||||
workspaces.forEach((workspace, i) => {
|
workspaces.forEach((workspace, i) => {
|
||||||
(workspace.get_parent() as Widget.Box).reorder_child(workspace, i);
|
(workspace.get_parent() as Widget.Box)
|
||||||
|
.reorder_child(workspace, i);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -152,11 +153,10 @@ export default () => {
|
||||||
workspaces = (self.get_children() as Widget.Revealer[])
|
workspaces = (self.get_children() as Widget.Revealer[])
|
||||||
.filter((ch) => {
|
.filter((ch) => {
|
||||||
return Hyprland.get_workspaces().find((ws) => {
|
return Hyprland.get_workspaces().find((ws) => {
|
||||||
return ws.get_id().toString() === ch.get_name();
|
return ws.get_id().toString() === ch.name;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.sort((a, b) =>
|
.sort((a, b) => parseInt(a.name ?? '0') - parseInt(b.name ?? '0'));
|
||||||
parseInt(a.get_name() ?? '0') - parseInt(b.get_name() ?? '0'));
|
|
||||||
|
|
||||||
updateWorkspaces();
|
updateWorkspaces();
|
||||||
refresh();
|
refresh();
|
||||||
|
|
Loading…
Reference in a new issue