💥 fix(osd): info not updating correctly
This commit is contained in:
+9
-6
@@ -37,14 +37,14 @@ export class OSDMode extends GObject.Object {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const OSDModes: Record<string, OSDMode> = {
|
export const OSDModes: Record<string, () => OSDMode> = {
|
||||||
SINK: new OSDMode({
|
SINK: () => new OSDMode({
|
||||||
icon: createBinding(Wireplumber.getWireplumber().defaultSpeaker, "volumeIcon"),
|
icon: createBinding(Wireplumber.getWireplumber().defaultSpeaker, "volumeIcon"),
|
||||||
value: createBinding(Wireplumber.getWireplumber().defaultSpeaker, "volume"),
|
value: createBinding(Wireplumber.getWireplumber().defaultSpeaker, "volume"),
|
||||||
text: createBinding(Wireplumber.getWireplumber().defaultSpeaker, "description"),
|
text: createBinding(Wireplumber.getWireplumber().defaultSpeaker, "description"),
|
||||||
max: Wireplumber.getDefault().getMaxSinkVolume() / 100
|
max: Wireplumber.getDefault().getMaxSinkVolume() / 100
|
||||||
}),
|
}),
|
||||||
BRIGHTNESS: Backlights.getDefault().available ? new OSDMode({
|
BRIGHTNESS: () => Backlights.getDefault().available ? new OSDMode({
|
||||||
icon: "display-brightness-symbolic",
|
icon: "display-brightness-symbolic",
|
||||||
value: createBinding(Backlights.getDefault().default, "brightness"),
|
value: createBinding(Backlights.getDefault().default, "brightness"),
|
||||||
max: createBinding(Backlights.getDefault().default, "maxBrightness"),
|
max: createBinding(Backlights.getDefault().default, "maxBrightness"),
|
||||||
@@ -67,7 +67,9 @@ export const OSD = (mon: number) =>
|
|||||||
|
|
||||||
<Gtk.Box class={"osd"}>
|
<Gtk.Box class={"osd"}>
|
||||||
<With value={osdMode}>
|
<With value={osdMode}>
|
||||||
{(mode: OSDMode) => <Gtk.Box>
|
{(modeFun: () => OSDMode) => {
|
||||||
|
const mode = modeFun();
|
||||||
|
return <Gtk.Box>
|
||||||
<Gtk.Image class={"icon"} iconName={
|
<Gtk.Image class={"icon"} iconName={
|
||||||
createBinding(mode, "icon")
|
createBinding(mode, "icon")
|
||||||
} />
|
} />
|
||||||
@@ -80,12 +82,13 @@ export const OSD = (mon: number) =>
|
|||||||
maxValue={createBinding(mode, "max")}
|
maxValue={createBinding(mode, "max")}
|
||||||
/>
|
/>
|
||||||
</Gtk.Box>
|
</Gtk.Box>
|
||||||
</Gtk.Box>}
|
</Gtk.Box>;
|
||||||
|
}}
|
||||||
</With>
|
</With>
|
||||||
</Gtk.Box>
|
</Gtk.Box>
|
||||||
</Astal.Window>;
|
</Astal.Window>;
|
||||||
|
|
||||||
export function triggerOSD(mode: OSDMode) {
|
export function triggerOSD(mode: () => OSDMode) {
|
||||||
setOSDMode(mode);
|
setOSDMode(mode);
|
||||||
Windows.getDefault().open("osd");
|
Windows.getDefault().open("osd");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user