make bar (more likely to work with) multimonitor (#162)

This commit is contained in:
end-4
2024-01-24 23:20:53 +07:00
parent 1cb1b94ad2
commit 830f6a780d
5 changed files with 39 additions and 61 deletions
+1 -20
View File
@@ -121,25 +121,6 @@ const BarBattery = () => Box({
]
});
const BarResourceValue = (name, icon, command) => Widget.Box({
vpack: 'center',
className: 'bar-batt spacing-h-5',
children: [
MaterialIcon(icon, 'small'),
Widget.ProgressBar({ // Progress
vpack: 'center', hexpand: true,
className: 'bar-prog-batt',
setup: (self) => self.poll(5000, (progress) => execAsync(['bash', '-c', command])
.then((output) => {
progress.value = Number(output) / 100;
progress.tooltipText = `${name}: ${Number(output)}%`
})
.catch(print)
),
}),
]
});
const BarResource = (name, icon, command) => {
const resourceLabel = Label({
className: 'txt-smallie txt-onSurfaceVariant',
@@ -195,7 +176,7 @@ const moveToRelativeWorkspace = async (self, num) => {
}
}
export const ModuleSystem = () => Widget.EventBox({
export default () => Widget.EventBox({
onScrollUp: (self) => moveToRelativeWorkspace(self, -1),
onScrollDown: (self) => moveToRelativeWorkspace(self, +1),
onPrimaryClick: () => App.toggleWindow('sideright'),