Set ags temp to N/A if it isn't available
This commit is contained in:
parent
06a17580a9
commit
8b14e9adfb
|
@ -80,18 +80,18 @@ function Time({ format = "%H:%M:%S" }): JSX.Element {
|
|||
}
|
||||
|
||||
function Temp(): JSX.Element {
|
||||
let label = Variable<string>("N/A");
|
||||
if (sensorsAvailable) {
|
||||
const temp = Variable<string>("").poll(5000, 'sensors', out => {
|
||||
label = Variable<string>("").poll(5000, 'sensors', out => {
|
||||
const match = out.split('\n').find(line => line.includes('Tctl') || line.includes('Package'))?.match(/[0-9.]*°C/);
|
||||
return match ? match[0] : "N/A";
|
||||
})
|
||||
}
|
||||
return <label
|
||||
className="item blue"
|
||||
onDestroy={() => temp.drop()}
|
||||
label={temp()}
|
||||
onDestroy={() => label.drop()}
|
||||
label={label()}
|
||||
/>
|
||||
}
|
||||
return <box />
|
||||
}
|
||||
|
||||
function Memory(): JSX.Element {
|
||||
|
|
Loading…
Reference in New Issue