Update volumemixer.js

This commit is contained in:
end-4
2024-03-27 17:50:03 +07:00
parent 33f871b698
commit 0537e94004
@@ -6,69 +6,62 @@ import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
const { Box, Button, Icon, Label, Scrollable, Slider, Stack } = Widget; const { Box, Button, Icon, Label, Scrollable, Slider, Stack } = Widget;
import { MaterialIcon } from '../../.commonwidgets/materialicon.js'; import { MaterialIcon } from '../../.commonwidgets/materialicon.js';
import { setupCursorHover } from '../../.widgetutils/cursorhover.js'; import { setupCursorHover } from '../../.widgetutils/cursorhover.js';
import { AnimatedSlider } from '../../.commonwidgets/cairo_slider.js'; // import { AnimatedSlider } from '../../.commonwidgets/cairo_slider.js';
const AppVolume = (stream) => { const AppVolume = (stream) => Box({
// console.log(stream) className: 'sidebar-volmixer-stream spacing-h-10',
return Box({ children: [
className: 'sidebar-volmixer-stream spacing-h-10', Icon({
children: [ className: 'sidebar-volmixer-stream-appicon',
Icon({ vpack: 'center',
className: 'sidebar-volmixer-stream-appicon', tooltipText: stream.stream.name,
vpack: 'center', setup: (self) => {
tooltipText: stream.stream.name, self.hook(stream, (self) => {
setup: (self) => { self.icon = stream.stream.name.toLowerCase();
self.hook(stream, (self) => { })
self.icon = stream.stream.name.toLowerCase(); },
}),
Box({
hexpand: true,
vpack: 'center',
vertical: true,
className: 'spacing-v-5',
children: [
Label({
xalign: 0,
maxWidthChars: 10,
truncate: 'end',
label: stream.description,
className: 'txt-small',
setup: (self) => self.hook(stream, (self) => {
self.label = `${stream.description}`
}) })
}, }),
}), Slider({
Box({ drawValue: false,
hexpand: true, hpack: 'fill',
vpack: 'center', className: 'sidebar-volmixer-stream-slider',
vertical: true, value: stream.volume,
className: 'spacing-v-5', min: 0, max: 1,
children: [ onChange: ({ value }) => {
Label({ stream.volume = value;
xalign: 0, },
maxWidthChars: 10, setup: (self) => self.hook(stream, (self) => {
truncate: 'end', self.value = stream.volume;
label: stream.description, })
className: 'txt-small', }),
setup: (self) => { // Box({
self.hook(stream, (self) => { // homogeneous: true,
self.label = `${stream.description}` // className: 'test',
}) // children: [AnimatedSlider({
} // className: 'sidebar-volmixer-stream-slider',
}), // value: stream.volume,
Slider({ // })],
drawValue: false, // })
hpack: 'fill', ]
className: 'sidebar-volmixer-stream-slider', })
value: stream.volume, ]
min: 0, max: 1, });
onChange: ({ value }) => {
stream.volume = value;
},
setup: (self) => {
self.hook(stream, (self) => {
self.value = stream.volume;
})
}
}),
// Box({
// homogeneous: true,
// className: 'test',
// children: [AnimatedSlider({
// className: 'sidebar-volmixer-stream-slider',
// value: stream.volume,
// })],
// })
]
})
]
})
}
export default (props) => { export default (props) => {
const emptyContent = Box({ const emptyContent = Box({