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 Network from "gi://AstalNetwork"
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 Wifi() {
const { wifi } = Network.get_default()
return
}
function AudioSlider() {
const speaker = Wp.get_default()?.audio.defaultSpeaker!
return
speaker.volume = value}
value={bind(speaker, "volume")}
/>
}
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()
return
{bind(hypr, "workspaces").as(wss => wss
.sort((a, b) => a.id - b.id)
.map(ws => (
))
)}
}
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