refactor!: start migration to latest ags

This commit is contained in:
2025-12-05 17:00:22 -08:00
parent 1759e2d976
commit 42b4f99c37
12 changed files with 191 additions and 147 deletions

View File

@@ -3,15 +3,16 @@ import AstalWp from "gi://AstalWp?version=0.1"
export default function Audio() {
const speaker = AstalWp.get_default()?.default_speaker!
const derived = Variable.derive([bind(speaker, "volume"), bind(speaker, "mute")], (volume: number, muted: boolean) => {
if (muted) {
return { label: ` (muted)`, muted }
}
return { label: `${Math.floor(volume * 100)}% ` }
})
// const derived = Variable.derive([bind(speaker, "volume"), bind(speaker, "mute")], (volume: number, muted: boolean) => {
// if (muted) {
// return { label: ` (muted)`, muted }
// }
// return { label: `${Math.floor(volume * 100)}% ` }
// })
// return <box className={derived((v) => ["status-box", v.muted && "inactive"].filter(Boolean).join(" "))}>
// <label
// label={derived((v) => v.label)} />
// </box>
return <box className={derived((v) => ["status-box", v.muted && "inactive"].filter(Boolean).join(" "))}>
<label
label={derived((v) => v.label)} />
</box>
}