forked from Shinonome/dots-hyprland
chore(bar): delete temperature and related reading logic
This commit is contained in:
@@ -21,14 +21,6 @@ Rectangle {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: 8
|
spacing: 8
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
spacing: 5
|
|
||||||
Layout.fillWidth: true
|
|
||||||
MaterialSymbol { text: "thermostat"; color: Appearance.m3colors.m3onSecondaryContainer }
|
|
||||||
StyledText { text: Translation.tr("Temperature:"); color: Appearance.colors.colOnLayer1 }
|
|
||||||
StyledText { Layout.fillWidth: true; horizontalAlignment: Text.AlignRight; color: Appearance.colors.colOnLayer1; text: `${Battery.temperature}°C` }
|
|
||||||
}
|
|
||||||
|
|
||||||
// This row is hidden when the battery is full.
|
// This row is hidden when the battery is full.
|
||||||
RowLayout {
|
RowLayout {
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
|||||||
@@ -26,39 +26,6 @@ Singleton {
|
|||||||
property real energyRate: UPower.displayDevice.changeRate
|
property real energyRate: UPower.displayDevice.changeRate
|
||||||
property real timeToEmpty: UPower.displayDevice.timeToEmpty
|
property real timeToEmpty: UPower.displayDevice.timeToEmpty
|
||||||
property real timeToFull: UPower.displayDevice.timeToFull
|
property real timeToFull: UPower.displayDevice.timeToFull
|
||||||
property real temperature: 0
|
|
||||||
|
|
||||||
Process {
|
|
||||||
id: tempProcess
|
|
||||||
command: ["bash", "-c", "cat /sys/class/thermal/thermal_zone0/temp"]
|
|
||||||
stdout: StdioCollector {
|
|
||||||
onStreamFinished: {
|
|
||||||
if (text && text.trim() !== "") {
|
|
||||||
Battery.temperature = parseInt(text.trim()) / 1000
|
|
||||||
} else {
|
|
||||||
Battery.temperature = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
interval: 3000
|
|
||||||
repeat: true
|
|
||||||
running: true
|
|
||||||
onTriggered: {
|
|
||||||
if (!tempProcess.running) {
|
|
||||||
tempProcess.running = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Component.onCompleted: {
|
|
||||||
if (!tempProcess.running) {
|
|
||||||
tempProcess.running = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
onIsLowAndNotChargingChanged: {
|
onIsLowAndNotChargingChanged: {
|
||||||
if (available && isLowAndNotCharging) Quickshell.execDetached([
|
if (available && isLowAndNotCharging) Quickshell.execDetached([
|
||||||
|
|||||||
Reference in New Issue
Block a user