nova-shell/modules/Temperature.qml
2026-04-12 00:49:58 +02:00

41 lines
980 B
QML

import QtQuick
import Quickshell.Io
import QtQuick.Controls
import "." as M
Row {
id: root
spacing: 2
property int celsius: 0
FileView {
id: thermal
path: "/sys/class/thermal/thermal_zone0/temp"
onLoaded: root.celsius = Math.round(parseInt(text()) / 1000)
}
Timer {
interval: 2000
running: true
repeat: true
onTriggered: thermal.reload()
}
M.BarIcon {
icon: "\uF2C9"
color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05
anchors.verticalCenter: parent.verticalCenter
}
Text {
text: root.celsius + "°C"
color: root.celsius > 80 ? M.Theme.base08 : M.Theme.base05
font.pixelSize: M.Theme.fontSize
font.family: M.Theme.fontFamily
verticalAlignment: Text.AlignVCenter
}
HoverHandler { id: hover }
ToolTip {
visible: hover.hovered
text: "Temperature: " + root.celsius + "\u00B0C"
}
}