Added an osd for microphone inputs. (#60)
This commit is contained in:
@@ -38,7 +38,7 @@ const renderActiveInput = () => {
|
|||||||
hpack: "start",
|
hpack: "start",
|
||||||
truncate: "end",
|
truncate: "end",
|
||||||
wrap: true,
|
wrap: true,
|
||||||
label: audio.bind("microphone").as((v) => v.description || ""),
|
label: audio.bind("microphone").as((v) => v.description === null ? "No input device found..." : v.description),
|
||||||
}),
|
}),
|
||||||
Widget.Slider({
|
Widget.Slider({
|
||||||
value: audio.microphone.bind("volume").as((v) => v),
|
value: audio.microphone.bind("volume").as((v) => v),
|
||||||
|
|||||||
@@ -18,10 +18,14 @@ export const OSDBar = (ort: OSDOrientation) => {
|
|||||||
self.hook(brightness, () => {
|
self.hook(brightness, () => {
|
||||||
self.value = brightness.kbd;
|
self.value = brightness.kbd;
|
||||||
}, "notify::kbd")
|
}, "notify::kbd")
|
||||||
self.hook(audio, () => {
|
self.hook(audio.microphone, () => {
|
||||||
|
self.toggleClassName("overflow", audio.microphone.volume > 1)
|
||||||
|
self.value = audio.microphone.volume <= 1 ? audio.microphone.volume : audio.microphone.volume - 1;
|
||||||
|
}, "notify::volume")
|
||||||
|
self.hook(audio.speaker, () => {
|
||||||
self.toggleClassName("overflow", audio.speaker.volume > 1)
|
self.toggleClassName("overflow", audio.speaker.volume > 1)
|
||||||
self.value = audio.speaker.volume <= 1 ? audio.speaker.volume : audio.speaker.volume - 1;
|
self.value = audio.speaker.volume <= 1 ? audio.speaker.volume : audio.speaker.volume - 1;
|
||||||
})
|
}, "notify::volume")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -19,9 +19,18 @@ export const OSDIcon = (ort: OSDOrientation) => {
|
|||||||
self.hook(brightness, () => {
|
self.hook(brightness, () => {
|
||||||
self.label = "";
|
self.label = "";
|
||||||
}, "notify::kbd")
|
}, "notify::kbd")
|
||||||
self.hook(audio, () => {
|
self.hook(audio.microphone, () => {
|
||||||
|
self.label = audio.microphone.is_muted ? "" : "";
|
||||||
|
}, "notify::volume")
|
||||||
|
self.hook(audio.microphone, () => {
|
||||||
|
self.label = audio.microphone.is_muted ? "" : "";
|
||||||
|
}, "notify::is-muted")
|
||||||
|
self.hook(audio.speaker, () => {
|
||||||
self.label = audio.speaker.is_muted ? "" : "";
|
self.label = audio.speaker.is_muted ? "" : "";
|
||||||
})
|
}, "notify::volume")
|
||||||
|
self.hook(audio.speaker, () => {
|
||||||
|
self.label = audio.speaker.is_muted ? "" : "";
|
||||||
|
}, "notify::is-muted")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -65,13 +65,20 @@ const renderOSD = () => {
|
|||||||
self.hook(brightness, () => {
|
self.hook(brightness, () => {
|
||||||
handleReveal(self, "reveal_child");
|
handleReveal(self, "reveal_child");
|
||||||
}, "notify::kbd")
|
}, "notify::kbd")
|
||||||
|
self.hook(audio.microphone, () => {
|
||||||
|
handleReveal(self, "reveal_child");
|
||||||
|
}, "notify::volume")
|
||||||
|
self.hook(audio.microphone, () => {
|
||||||
|
handleReveal(self, "reveal_child");
|
||||||
|
}, "notify::is-muted")
|
||||||
self.hook(audio.speaker, () => {
|
self.hook(audio.speaker, () => {
|
||||||
handleReveal(self, "reveal_child");
|
handleReveal(self, "reveal_child");
|
||||||
}, "notify::volume")
|
}, "notify::volume")
|
||||||
self.hook(audio.speaker, () => {
|
self.hook(audio.speaker, () => {
|
||||||
handleReveal(self, "visible");
|
handleReveal(self, "reveal_child");
|
||||||
}, "notify::is-muted")
|
}, "notify::is-muted")
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
child: Widget.Box({
|
child: Widget.Box({
|
||||||
class_name: "osd-container",
|
class_name: "osd-container",
|
||||||
@@ -126,12 +133,17 @@ export default () => Widget.Window({
|
|||||||
self.hook(brightness, () => {
|
self.hook(brightness, () => {
|
||||||
handleReveal(self, "visible");
|
handleReveal(self, "visible");
|
||||||
}, "notify::kbd")
|
}, "notify::kbd")
|
||||||
|
self.hook(audio.microphone, () => {
|
||||||
|
handleReveal(self, "visible");
|
||||||
|
}, "notify::volume")
|
||||||
|
self.hook(audio.microphone, () => {
|
||||||
|
handleReveal(self, "visible");
|
||||||
|
}, "notify::is-muted")
|
||||||
self.hook(audio.speaker, () => {
|
self.hook(audio.speaker, () => {
|
||||||
handleReveal(self, "visible");
|
handleReveal(self, "visible");
|
||||||
}, "notify::volume")
|
}, "notify::volume")
|
||||||
self.hook(audio.speaker, () => {
|
self.hook(audio.speaker, () => {
|
||||||
handleReveal(self, "visible");
|
handleReveal(self, "visible");
|
||||||
}, "notify::is-muted")
|
}, "notify::is-muted")
|
||||||
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -20,10 +20,14 @@ export const OSDLabel = (ort: OSDOrientation) => {
|
|||||||
self.hook(brightness, () => {
|
self.hook(brightness, () => {
|
||||||
self.label = `${Math.round(brightness.kbd * 100)}`;
|
self.label = `${Math.round(brightness.kbd * 100)}`;
|
||||||
}, "notify::kbd")
|
}, "notify::kbd")
|
||||||
self.hook(audio, () => {
|
self.hook(audio.microphone, () => {
|
||||||
|
self.toggleClassName("overflow", audio.microphone.volume > 1)
|
||||||
|
self.label = `${Math.round(audio.microphone.volume * 100)}`;
|
||||||
|
}, "notify::volume")
|
||||||
|
self.hook(audio.speaker, () => {
|
||||||
self.toggleClassName("overflow", audio.speaker.volume > 1)
|
self.toggleClassName("overflow", audio.speaker.volume > 1)
|
||||||
self.label = `${Math.round(audio.speaker.volume * 100)}`;
|
self.label = `${Math.round(audio.speaker.volume * 100)}`;
|
||||||
})
|
}, "notify::volume")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user