Files
hyprland/config/ags/widget/control_center/buttons/mic_access.js
T
2024-05-18 15:14:03 +05:45

23 lines
634 B
JavaScript

const { microphone } = await Service.import("audio");
import QsButton from "./qs_button.js";
const Icon = () =>
microphone.is_muted || microphone.stream?.is_muted
? "microphone-disabled-symbolic"
: "microphone-sensitivity-high-symbolic";
export default () =>
QsButton({
icon: Utils.watch(Icon(), microphone, Icon),
label: "Mic Access",
on_clicked: () => (microphone.is_muted = !microphone.is_muted),
setup: (self) => {
self.hook(microphone, () => {
self.toggleClassName(
"active",
!(microphone.is_muted || microphone.stream?.is_muted),
);
});
},
});