2023-11-10 23:51:50 -05:00
|
|
|
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
|
|
|
|
import { Box, Icon, ProgressBar } from 'resource:///com/github/Aylur/ags/widget.js';
|
|
|
|
|
2023-11-13 16:19:09 -05:00
|
|
|
import { MicIcon } from '../misc/audio-icons.js';
|
2023-11-10 23:51:50 -05:00
|
|
|
|
|
|
|
|
|
|
|
export default () => Box({
|
|
|
|
className: 'osd',
|
|
|
|
children: [
|
|
|
|
Icon({
|
|
|
|
hpack: 'start',
|
2023-11-13 16:19:09 -05:00
|
|
|
binds: [['icon', MicIcon, 'value']],
|
|
|
|
}),
|
|
|
|
|
|
|
|
ProgressBar({
|
|
|
|
vpack: 'center',
|
2023-11-10 23:51:50 -05:00
|
|
|
connections: [[Audio, self => {
|
|
|
|
if (!Audio.microphone)
|
|
|
|
return;
|
|
|
|
|
2023-11-13 16:19:09 -05:00
|
|
|
self.value = Audio.microphone ? Audio.microphone.volume : 0;
|
|
|
|
self.sensitive = !Audio.microphone?.stream.isMuted;
|
2023-11-10 23:51:50 -05:00
|
|
|
|
|
|
|
const stack = self.get_parent().get_parent();
|
|
|
|
stack.shown = 'mic';
|
|
|
|
stack.resetTimer();
|
|
|
|
}, 'microphone-changed']],
|
|
|
|
}),
|
|
|
|
],
|
|
|
|
});
|