import { bind, derive } from "astal"; import { Gdk } from "astal/gtk4"; import AstalWp from "gi://AstalWp"; import { Mathf } from "../util/Mathf"; const WirePlumber = function () { const audio = AstalWp.get_default()?.audio!; const speakers = bind(audio, "speakers"); const defaultSpeaker = speakers.as((speakers) => speakers.find((speaker) => speaker.is_default), ); return ( <> {defaultSpeaker.as((defaultSpeaker) => defaultSpeaker ? ( { defaultSpeaker.set_volume( Mathf.clamp( defaultSpeaker.volume - Mathf.sign(dy) * 0.02, 0.0, 1.0, ), ); }} > ) : ( <> ), )} ); }; export default WirePlumber;