This commit is contained in:
end-4
2025-02-12 10:27:56 +01:00
parent 236e45a1e4
commit 230b402a9a
@@ -59,24 +59,24 @@ const WifiNetwork = (accessPoint) => {
const NetResource = (icon, command) => { const NetResource = (icon, command) => {
const resourceLabel = Label({ const resourceLabel = Label({
className: `txt-smaller txt-subtext`, className: `txt-smaller txt-subtext`,
}); });
const widget = Button({ const widget = Button({
child: Box({ child: Box({
hpack: 'start', hpack: 'start',
className: `spacing-h-4`, className: `spacing-h-4`,
children: [ children: [
MaterialIcon(icon, 'very-small'), MaterialIcon(icon, 'very-small'),
resourceLabel, resourceLabel,
], ],
setup: (self) => self.poll(2000, () => execAsync(['bash', '-c', command]) setup: (self) => self.poll(2000, () => execAsync(['bash', '-c', command])
.then((output) => { .then((output) => {
resourceLabel.label = output; resourceLabel.label = output;
}).catch(print)) }).catch(print))
, ,
}) })
}); });
return widget; return widget;
} }
const CurrentNetwork = () => { const CurrentNetwork = () => {
@@ -109,10 +109,10 @@ const CurrentNetwork = () => {
hexpand: true, hexpand: true,
hpack: 'center', hpack: 'center',
className: 'sidebar-wifinetworks-bandwidth', className: 'sidebar-wifinetworks-bandwidth',
children: [ children: [
NetResource('arrow_warm_up' , `${App.configDir}/scripts/network_scripts/network_bandwidth.py sent`), NetResource('arrow_warm_up', `${App.configDir}/scripts/network_scripts/network_bandwidth.py sent`),
NetResource('arrow_cool_down', `${App.configDir}/scripts/network_scripts/network_bandwidth.py recv`), NetResource('arrow_cool_down', `${App.configDir}/scripts/network_scripts/network_bandwidth.py recv`),
] ]
}); });
const networkStatus = Box({ const networkStatus = Box({
children: [Label({ children: [Label({
@@ -169,7 +169,7 @@ const CurrentNetwork = () => {
children: [ children: [
MaterialIcon('language', 'hugerass'), MaterialIcon('language', 'hugerass'),
networkName, networkName,
networkBandwidth, networkBandwidth,
networkStatus, networkStatus,
] ]