2024-01-30 11:29:07 -05:00
|
|
|
const Audio = await Service.import('audio');
|
|
|
|
const { Label, Icon } = Widget;
|
2023-12-28 00:19:57 -05:00
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import { SpeakerIcon } from '../../misc/audio-icons.ts';
|
|
|
|
import HoverRevealer from './hover-revealer.ts';
|
2023-12-28 00:19:57 -05:00
|
|
|
|
|
|
|
|
|
|
|
export default () => HoverRevealer({
|
|
|
|
class_name: 'audio',
|
|
|
|
|
|
|
|
icon: Icon({
|
|
|
|
icon: SpeakerIcon.bind(),
|
|
|
|
}),
|
|
|
|
|
|
|
|
label: Label().hook(Audio, (self) => {
|
2024-04-23 22:26:13 -04:00
|
|
|
if (Audio.speaker.volume) {
|
2023-12-28 00:19:57 -05:00
|
|
|
self.label =
|
2024-04-23 22:26:13 -04:00
|
|
|
`${Math.round(Audio.speaker.volume * 100)}%`;
|
2023-12-28 00:19:57 -05:00
|
|
|
}
|
|
|
|
}, 'speaker-changed'),
|
|
|
|
});
|