fix: only show workspaces on monitors they belong to
This commit is contained in:
14
astal/bun.lock
Normal file
14
astal/bun.lock
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"lockfileVersion": 1,
|
||||||
|
"workspaces": {
|
||||||
|
"": {
|
||||||
|
"name": "astal-shell",
|
||||||
|
"dependencies": {
|
||||||
|
"astal": "/nix/store/pvb3x021mr6xknm91gqq76gy32n96vj0-astal-gjs/share/astal/gjs",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"packages": {
|
||||||
|
"astal": ["astal@file:../../../../nix/store/pvb3x021mr6xknm91gqq76gy32n96vj0-astal-gjs/share/astal/gjs", {}],
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,23 +7,23 @@ import GTop from "gi://GTop"
|
|||||||
import { calc_cpu_usage, get_cpu_snapshot, get_disk_space, get_ram_info } from "./cpu"
|
import { calc_cpu_usage, get_cpu_snapshot, get_disk_space, get_ram_info } from "./cpu"
|
||||||
import AstalBattery from "gi://AstalBattery"
|
import AstalBattery from "gi://AstalBattery"
|
||||||
|
|
||||||
const time = Variable("").poll(1000, "date")
|
function Workspaces({ monitor }: { monitor: Gdk.Monitor }) {
|
||||||
|
|
||||||
function Workspaces() {
|
|
||||||
const hypr = Hyprland.get_default()
|
const hypr = Hyprland.get_default()
|
||||||
|
|
||||||
return <box className="workspaces">
|
return <box className="workspaces">
|
||||||
{bind(hypr, "workspaces").as(wss => wss.filter(ws => !(ws.id >= -99 && ws.id <= -2))
|
{bind(hypr, "workspaces").as(wss => wss.filter(ws => !(ws.id >= -99 && ws.id <= -2))
|
||||||
.sort((a, b) => a.id - b.id)
|
.sort((a, b) => a.id - b.id)
|
||||||
.map(ws => (
|
.map(ws => {
|
||||||
//@ts-ignore
|
if (ws.monitor.model !== monitor.model) return <></>
|
||||||
|
return (
|
||||||
<button
|
<button
|
||||||
className={bind(hypr, "focusedWorkspace").as(fw =>
|
className={bind(hypr, "focusedWorkspace").as(fw =>
|
||||||
ws === fw ? "focused" : "")}
|
ws === fw ? "focused" : "")}
|
||||||
onClicked={() => ws.focus()}>
|
onClicked={() => ws.focus()}>
|
||||||
{ws.id}
|
{ws.id}
|
||||||
</button>
|
</button>
|
||||||
)))}
|
)
|
||||||
|
}))}
|
||||||
</box>
|
</box>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +145,7 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|||||||
<box className="nix-icon">
|
<box className="nix-icon">
|
||||||
<icon icon="nixos-3" />
|
<icon icon="nixos-3" />
|
||||||
</box>
|
</box>
|
||||||
<Workspaces />
|
<Workspaces monitor={gdkmonitor} />
|
||||||
</box>
|
</box>
|
||||||
<box></box>
|
<box></box>
|
||||||
<box hexpand halign={Gtk.Align.END}>
|
<box hexpand halign={Gtk.Align.END}>
|
||||||
|
|||||||
Reference in New Issue
Block a user