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"); return speakers.as((speakers) => { const defaultSpeaker = speakers.find((speaker) => speaker.is_default); if (!defaultSpeaker) { return <>; } return ( { defaultSpeaker.set_volume( Mathf.clamp( defaultSpeaker.volume - Mathf.sign(dy) * 0.02, 0.0, 1.0, ), ); }} > ); }); }; export default WirePlumber;