nixos-configs/nixosModules/ags/config/ts/bar/hovers/audio.ts
matt1432 24aa4b9842
All checks were successful
Discord / discord commits (push) Has been skipped
refactor: make modules independant and exposed in the flake for outside use
2024-08-02 22:32:29 -04:00

21 lines
516 B
TypeScript

const Audio = await Service.import('audio');
const { Label, Icon } = Widget;
import { SpeakerIcon } from '../../misc/audio-icons.ts';
import HoverRevealer from './hover-revealer.ts';
export default () => HoverRevealer({
class_name: 'audio',
icon: Icon({
icon: SpeakerIcon.bind(),
}),
label: Label().hook(Audio, (self) => {
if (Audio.speaker.volume) {
self.label =
`${Math.round(Audio.speaker.volume * 100)}%`;
}
}, 'speaker-changed'),
});