2025-01-10 22:15:02 +03:00

29 lines
814 B
TypeScript

import { bind } from "astal"
import { Gtk } from "astal/gtk3"
import Mpris from "gi://AstalMpris"
export default function Media() {
const mpris = Mpris.get_default()
return <box className="Media">
{bind(mpris, "players").as(ps => ps[0] ? (
<box>
<box
className="Cover"
valign={Gtk.Align.CENTER}
css={bind(ps[0], "coverArt").as(cover =>
`background-image: url('${cover}');`
)}
/>
<label
label={bind(ps[0], "title").as(() =>
`${ps[0].title} - ${ps[0].artist}`
)}
/>
</box>
) : (
"Nothing Playing"
))}
</box>
}