Sort windows by position
This commit is contained in:
parent
b6e789c102
commit
cf85fc5283
|
|
@ -278,7 +278,9 @@ function Workspaces({ connector }: { connector: string }): JSX.Element {
|
|||
<box class="workspaces">
|
||||
{/* Generate a derived binding by passing a transformation function into the `workspaces` state */}
|
||||
<For each={workspaces((wss: any[]) =>
|
||||
wss.filter((ws) => ws.output === connector).sort((a, b) => a.idx - b.idx)
|
||||
wss.filter((ws) => ws.output === connector)
|
||||
.filter((ws) => ws.is_active || windows().some((w: any) => w.workspace_id === ws.id))
|
||||
.sort((a, b) => a.idx - b.idx)
|
||||
)}>
|
||||
{(ws: any) => (
|
||||
<button
|
||||
|
|
@ -311,6 +313,11 @@ function Clients({ connector }: { connector: string }): JSX.Element {
|
|||
<For each={windows((wins: any[]) =>
|
||||
wins.filter((w: any) => !w.title?.includes("rofi"))
|
||||
.filter((w: any) => w.workspace_id === active_ws_for_monitor)
|
||||
.sort((a: any, b: any) => {
|
||||
const posA = a.layout?.pos_in_scrolling_layout?.[0] ?? 0;
|
||||
const posB = b.layout?.pos_in_scrolling_layout?.[0] ?? 0;
|
||||
return posA - posB;
|
||||
})
|
||||
)}>
|
||||
{(win: any) => (
|
||||
<box class={win.is_focused ? "focused" : "unfocused"}>
|
||||
|
|
|
|||
Loading…
Reference in New Issue