import { App } from "astal/gtk3"
import { Variable, GLib, bind } from "astal"
import { Astal, Gtk, Gdk } from "astal/gtk3"
import Hyprland from "gi://AstalHyprland"
import Mpris from "gi://AstalMpris"
import Battery from "gi://AstalBattery"
import Wp from "gi://AstalWp"
import Tray from "gi://AstalTray"
function SysTray() {
const tray = Tray.get_default()
return
{bind(tray, "items").as(items => items.map(item => {
if (item.iconThemePath)
App.add_icons(item.iconThemePath)
const menu = item.create_menu()
return
}))}
}
function AudioPercent() {
const speaker = Wp.get_default()?.audio.defaultSpeaker!
return
}
function BatteryLevel() {
const bat = Battery.get_default()
return
}
function Media() {
const mpris = Mpris.get_default()
return
{bind(mpris, "players").as(ps => ps[0] ? (
`background-image: url('${cover}');`
)}
/>
) : (
"Nothing Playing"
))}
}
function Workspaces() {
const hypr = Hyprland.get_default()
const workspaceButtons: number[] = (Array.from({ length: 10 }, (_, id) => id + 1))
const focusWorkspace = (workspaceId: number) => hypr.dispatch("workspace", workspaceId.toString());
return
{workspaceButtons.map (workspace =>
)}
}
function FocusedClient() {
const hypr = Hyprland.get_default()
const focused = bind(hypr, "focusedClient")
return
{focused.as(client => (
client &&
))}
}
function Time({ format = "%H:%M - %A %e." }) {
const time = Variable("").poll(1000, () =>
GLib.DateTime.new_now_local().format(format)!)
return