astal: major changes
This commit is contained in:
@@ -94,18 +94,21 @@ 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
|
{bind(hypr, "focusedWorkspace").as(fw => {
|
||||||
.filter(ws => !(ws.id >= -99 && ws.id <= -2)) // filter out special workspaces
|
if (!fw) return null
|
||||||
.sort((a, b) => a.id - b.id)
|
|
||||||
.map(ws => (
|
const currentChunkStart = Math.floor((fw.id - 1) / 5) * 5 + 1
|
||||||
<button
|
const visibleIds = Array.from({ length: 5 }, (_, i) => currentChunkStart + i)
|
||||||
className={bind(hypr, "focusedWorkspace").as(fw =>
|
|
||||||
ws === fw ? "focused" : "")}
|
return visibleIds.map(id => {
|
||||||
onClicked={() => ws.focus()}>
|
const ws = hypr.workspaces.find(w => w.id === id)
|
||||||
{ws.id}
|
return <button
|
||||||
|
className={fw.id === id ? "focused" : ""}
|
||||||
|
onClick={() => ws?.focus()}>
|
||||||
|
{id}
|
||||||
</button>
|
</button>
|
||||||
))
|
})
|
||||||
)}
|
})}
|
||||||
</box>
|
</box>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +125,7 @@ function FocusedClient() {
|
|||||||
</box>
|
</box>
|
||||||
}
|
}
|
||||||
|
|
||||||
function Time({ format = "%H:%M - %A %e" }) {
|
function Time({ format = "%H:%M %a %b %e" }) {
|
||||||
const time = Variable<string>("").poll(1000, () =>
|
const time = Variable<string>("").poll(1000, () =>
|
||||||
GLib.DateTime.new_now_local().format(format)!)
|
GLib.DateTime.new_now_local().format(format)!)
|
||||||
|
|
||||||
@@ -143,18 +146,16 @@ export default function Bar(monitor: Gdk.Monitor) {
|
|||||||
anchor={TOP | LEFT | RIGHT}>
|
anchor={TOP | LEFT | RIGHT}>
|
||||||
<centerbox>
|
<centerbox>
|
||||||
<box hexpand halign={Gtk.Align.START}>
|
<box hexpand halign={Gtk.Align.START}>
|
||||||
<Workspaces />
|
<Time />
|
||||||
<FocusedClient />
|
|
||||||
</box>
|
</box>
|
||||||
<box>
|
<box>
|
||||||
<Media />
|
<Workspaces />
|
||||||
</box>
|
</box>
|
||||||
<box hexpand halign={Gtk.Align.END} >
|
<box hexpand halign={Gtk.Align.END} >
|
||||||
<SysTray />
|
<SysTray />
|
||||||
<Wifi />
|
<Wifi />
|
||||||
<AudioSlider />
|
<AudioSlider />
|
||||||
<BatteryLevel />
|
<BatteryLevel />
|
||||||
<Time />
|
|
||||||
</box>
|
</box>
|
||||||
</centerbox>
|
</centerbox>
|
||||||
</window>
|
</window>
|
||||||
|
|||||||
Reference in New Issue
Block a user