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({
|
const volumeIndicator = Widget.Button({
|
||||||
on_clicked: () => audio.speaker.is_muted = !audio.speaker.is_muted,
|
on_clicked: () => audio.speaker.is_muted = !audio.speaker.is_muted,
|
||||||
|
@ -216,11 +217,12 @@ function Right() {
|
||||||
}),
|
}),
|
||||||
Widget.Label({
|
Widget.Label({
|
||||||
class_name: "item blue",
|
class_name: "item blue",
|
||||||
label: Variable("", {
|
label: sensorsAvailable ? Variable("", {
|
||||||
poll: [5000, 'sensors', out => out.split('\n')
|
poll: [5000, 'sensors', out => {
|
||||||
.find(line => line.includes('Tctl') || line.includes('Package'))
|
const match = out.split('\n').find(line => line.includes('Tctl') || line.includes('Package'))?.match(/[0-9.]*°C/);
|
||||||
.match(/[0-9.]*°C/)[0]],
|
return match ? match[0] : "N/A";
|
||||||
}).bind(),
|
}],
|
||||||
|
}).bind() : "N/A",
|
||||||
}),
|
}),
|
||||||
Widget.Button({
|
Widget.Button({
|
||||||
class_name: "item",
|
class_name: "item",
|
||||||
|
@ -244,7 +246,7 @@ function Bar(monitor = 0) {
|
||||||
monitor,
|
monitor,
|
||||||
anchor: ["top", "left", "right"],
|
anchor: ["top", "left", "right"],
|
||||||
exclusivity: "exclusive",
|
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({
|
child: Widget.CenterBox({
|
||||||
class_name: "window-box",
|
class_name: "window-box",
|
||||||
start_widget: Left(),
|
start_widget: Left(),
|
||||||
|
|
Loading…
Reference in New Issue