nixos-configs/modules/ags/config/ts/bar/hovers/audio.ts
matt1432 99545ac48e
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags bar): improve hover state on hover revealers
2024-04-23 22:26:13 -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'),
});