nixos-configs/modules/ags/config/ts/bar/hovers/audio.ts
matt1432 a0014161ce
All checks were successful
Discord / discord commits (push) Has been skipped
refactor(ags): move wim and binto configs together under modules
2024-01-17 19:18:41 -05:00

22 lines
587 B
TypeScript

import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
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'),
});