Verify if sensors works before using it
This commit is contained in:
parent
fe021e683c
commit
a1750022b2
|
@ -27,4 +27,5 @@
|
|||
];
|
||||
};
|
||||
};
|
||||
programs.alacritty.settings.font.size = 13;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ const batteryIndicator = Widget.Box({
|
|||
]: []
|
||||
})
|
||||
|
||||
const sensorsAvailable = await Utils.execAsync(['sensors']).then(() => true).catch(() => false)
|
||||
|
||||
const volumeIndicator = Widget.Button({
|
||||
on_clicked: () => audio.speaker.is_muted = !audio.speaker.is_muted,
|
||||
|
@ -216,11 +217,12 @@ function Right() {
|
|||
}),
|
||||
Widget.Label({
|
||||
class_name: "item blue",
|
||||
label: Variable("", {
|
||||
poll: [5000, 'sensors', out => out.split('\n')
|
||||
.find(line => line.includes('Tctl') || line.includes('Package'))
|
||||
.match(/[0-9.]*°C/)[0]],
|
||||
}).bind(),
|
||||
label: sensorsAvailable ? Variable("", {
|
||||
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";
|
||||
}],
|
||||
}).bind() : "N/A",
|
||||
}),
|
||||
Widget.Button({
|
||||
class_name: "item",
|
||||
|
@ -244,7 +246,7 @@ function Bar(monitor = 0) {
|
|||
monitor,
|
||||
anchor: ["top", "left", "right"],
|
||||
exclusivity: "exclusive",
|
||||
css: "font-size: " + (hyprland.monitors[monitor]["width"] > 1920? "1.2em;": "1em;"),
|
||||
css: "font-size: " + (hyprland.monitors[monitor]["width"] > 2000? "1.2em;": "1em;"),
|
||||
child: Widget.CenterBox({
|
||||
class_name: "window-box",
|
||||
start_widget: Left(),
|
||||
|
|
Loading…
Reference in New Issue