forked from Shinonome/dots-hyprland
volume mixer: add icon for empty
This commit is contained in:
@@ -159,9 +159,9 @@ export default (props) => {
|
|||||||
'empty': notifEmptyContent,
|
'empty': notifEmptyContent,
|
||||||
'list': notifList,
|
'list': notifList,
|
||||||
},
|
},
|
||||||
setup: (self) => self
|
setup: (self) => self.hook(Notifications, (self) => {
|
||||||
.hook(Notifications, (self) => self.shown = (Notifications.notifications.length > 0 ? 'list' : 'empty'))
|
self.shown = (Notifications.notifications.length > 0 ? 'list' : 'empty')
|
||||||
,
|
}),
|
||||||
});
|
});
|
||||||
return Box({
|
return Box({
|
||||||
...props,
|
...props,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ 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) => {
|
||||||
// console.log(stream)
|
// console.log(stream)
|
||||||
return Box({
|
return Box({
|
||||||
className: 'sidebar-volmixer-stream spacing-h-10',
|
className: 'sidebar-volmixer-stream spacing-h-10',
|
||||||
@@ -71,13 +71,31 @@ const appVolume = (stream) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default (props) => {
|
export default (props) => {
|
||||||
|
const emptyContent = Box({
|
||||||
|
homogeneous: true,
|
||||||
|
children: [Box({
|
||||||
|
vertical: true,
|
||||||
|
vpack: 'center',
|
||||||
|
className: 'txt spacing-v-10',
|
||||||
|
children: [
|
||||||
|
Box({
|
||||||
|
vertical: true,
|
||||||
|
className: 'spacing-v-5 txt-subtext',
|
||||||
|
children: [
|
||||||
|
MaterialIcon('brand_awareness', 'gigantic'),
|
||||||
|
Label({ label: 'No audio source', className: 'txt-small' }),
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
]
|
||||||
|
})]
|
||||||
|
});
|
||||||
const appList = Scrollable({
|
const appList = Scrollable({
|
||||||
vexpand: true,
|
vexpand: true,
|
||||||
child: Box({
|
child: Box({
|
||||||
attribute: {
|
attribute: {
|
||||||
'updateStreams': (self) => {
|
'updateStreams': (self) => {
|
||||||
const streams = Audio.apps;
|
const streams = Audio.apps;
|
||||||
self.children = streams.map(stream => appVolume(stream));
|
self.children = streams.map(stream => AppVolume(stream));
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
vertical: true,
|
vertical: true,
|
||||||
@@ -108,12 +126,21 @@ export default (props) => {
|
|||||||
})
|
})
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
const mainContent = Stack({
|
||||||
|
children: {
|
||||||
|
'empty': emptyContent,
|
||||||
|
'list': appList,
|
||||||
|
},
|
||||||
|
setup: (self) => self.hook(Audio, (self) => {
|
||||||
|
self.shown = (Audio.apps.length > 0 ? 'list' : 'empty')
|
||||||
|
}),
|
||||||
|
})
|
||||||
return Box({
|
return Box({
|
||||||
...props,
|
...props,
|
||||||
className: 'spacing-v-5',
|
className: 'spacing-v-5',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
appList,
|
mainContent,
|
||||||
status,
|
status,
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user