ui/widgets/resourceDial.js

25 lines
687 B
JavaScript
Raw Normal View History

2024-09-06 16:55:55 -07:00
const { Gio, GioUnix } = imports.gi;
export const resource_dial = (label, icon, timeout, command, transformer) => {
let poll = Variable(100, {
poll: [timeout, command, v => Number(v)]
})
return Widget.Box({
className: 'dial-parent',
children: [
Widget.CircularProgress({
startAt: 0.75,
className: 'resource-dial',
value: poll.bind().as(v => transformer(v)),
tooltipText: poll.bind().as(v => label(v)),
child: Widget.Icon({
className: 'dial-icon',
icon: icon
}),
})
]
})
}