import QtQuick import Quickshell import "." as M import "../services" as S import "../applets" as C M.BarSection { id: root spacing: Math.max(1, S.Theme.moduleSpacing - 2) tooltip: "" readonly property int _warm: S.Modules.temperature.warm || 80 readonly property int _hot: S.Modules.temperature.hot || 90 readonly property string _deviceFilter: S.Modules.temperature.device || "" // If a device filter is set, use that device's temp; otherwise fall back to system max readonly property int _temp: { if (_deviceFilter !== "") { const dev = S.SystemStats.tempDevices.find(d => d.name === _deviceFilter); if (dev) return dev.celsius; } return S.SystemStats.tempCelsius; } property color _stateColor: _temp > _hot ? S.Theme.base08 : _temp > _warm ? S.Theme.base0A : root.accentColor Behavior on _stateColor { ColorAnimation { duration: 300 } } property bool _pinned: false readonly property bool _anyHover: root._hovered || hoverPanel.panelHovered readonly property bool _showPanel: _anyHover || _pinned on_AnyHoverChanged: { if (_anyHover) _unpinTimer.stop(); else if (_pinned) _unpinTimer.start(); } Timer { id: _unpinTimer interval: 500 onTriggered: root._pinned = false } M.BarIcon { icon: "\uF2C9" color: root._stateColor anchors.verticalCenter: parent.verticalCenter TapHandler { cursorShape: Qt.PointingHandCursor onTapped: root._pinned = !root._pinned } } M.BarLabel { label: root._temp + "\u00B0C" minText: "100\u00B0C" color: root._stateColor anchors.verticalCenter: parent.verticalCenter TapHandler { cursorShape: Qt.PointingHandCursor onTapped: root._pinned = !root._pinned } } M.HoverPanel { id: hoverPanel showPanel: root._showPanel screen: QsWindow.window?.screen ?? null anchorItem: root accentColor: root.accentColor panelNamespace: "nova-temperature" panelTitle: "Temperature" contentWidth: 220 C.TemperatureApplet { width: hoverPanel.contentWidth temp: root._temp warm: root._warm hot: root._hot history: S.SystemStats.tempHistory devices: S.SystemStats.tempDevices accentColor: root.accentColor deviceFilter: root._deviceFilter active: root._showPanel } } }