summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml
diff options
context:
space:
mode:
authorNippy <nippy@rp1.hu>2026-05-09 13:33:09 +0200
committerNippy <nippy@rp1.hu>2026-05-09 13:33:09 +0200
commita2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5 (patch)
tree1a8769217f84bfe9d6216fafaadaf8cdd876d457 /raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml
parent34b9c34f982b2596cfa9e368a2d7f74e9a17477c (diff)
downloadRaveOS-PKGBUILD-a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5.tar.gz
RaveOS-PKGBUILD-a2b924d7e9492b978ad6dc33b6c1ffcb304b4bc5.zip
raveos update
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml')
-rw-r--r--raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml224
1 files changed, 0 insertions, 224 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml
deleted file mode 100644
index cf07f3e..0000000
--- a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/DankBar/Widgets/GpuTemperature.qml
+++ /dev/null
@@ -1,224 +0,0 @@
-import QtQuick
-import qs.Common
-import qs.Modules.Plugins
-import qs.Services
-import qs.Widgets
-
-BasePill {
- id: root
-
- property bool showPercentage: true
- property bool showIcon: true
- property var toggleProcessList
- property var popoutTarget: null
- property var widgetData: null
- property int selectedGpuIndex: (widgetData && widgetData.selectedGpuIndex !== undefined) ? widgetData.selectedGpuIndex : 0
- property bool minimumWidth: (widgetData && widgetData.minimumWidth !== undefined) ? widgetData.minimumWidth : true
-
- signal gpuTempClicked
-
- property real displayTemp: {
- if (!DgopService.availableGpus || DgopService.availableGpus.length === 0) {
- return 0;
- }
-
- if (selectedGpuIndex >= 0 && selectedGpuIndex < DgopService.availableGpus.length) {
- return DgopService.availableGpus[selectedGpuIndex].temperature || 0;
- }
-
- return 0;
- }
-
- function updateWidgetPciId(pciId) {
- const sections = ["left", "center", "right"];
- const defaultBar = SettingsData.barConfigs[0] || SettingsData.getBarConfig("default");
- if (!defaultBar)
- return;
- for (let s = 0; s < sections.length; s++) {
- const sectionId = sections[s];
- let widgets = [];
- if (sectionId === "left") {
- widgets = (defaultBar.leftWidgets || []).slice();
- } else if (sectionId === "center") {
- widgets = (defaultBar.centerWidgets || []).slice();
- } else if (sectionId === "right") {
- widgets = (defaultBar.rightWidgets || []).slice();
- }
- for (let i = 0; i < widgets.length; i++) {
- const widget = widgets[i];
- if (typeof widget === "object" && widget.id === "gpuTemp" && (!widget.pciId || widget.pciId === "")) {
- widgets[i] = {
- "id": widget.id,
- "enabled": widget.enabled !== undefined ? widget.enabled : true,
- "selectedGpuIndex": 0,
- "pciId": pciId
- };
- if (sectionId === "left") {
- SettingsData.setDankBarLeftWidgets(widgets);
- } else if (sectionId === "center") {
- SettingsData.setDankBarCenterWidgets(widgets);
- } else if (sectionId === "right") {
- SettingsData.setDankBarRightWidgets(widgets);
- }
- return;
- }
- }
- }
- }
-
- Component.onCompleted: {
- DgopService.addRef(["gpu"]);
- if (widgetData && widgetData.pciId) {
- DgopService.addGpuPciId(widgetData.pciId);
- } else {
- autoSaveTimer.running = true;
- }
- }
- Component.onDestruction: {
- DgopService.removeRef(["gpu"]);
- if (widgetData && widgetData.pciId) {
- DgopService.removeGpuPciId(widgetData.pciId);
- }
- }
-
- Connections {
- function onWidgetDataChanged() {
- root.selectedGpuIndex = Qt.binding(() => {
- return (root.widgetData && root.widgetData.selectedGpuIndex !== undefined) ? root.widgetData.selectedGpuIndex : 0;
- });
- }
-
- target: SettingsData
- }
-
- content: Component {
- Item {
- implicitWidth: root.isVerticalOrientation ? (root.widgetThickness - root.horizontalPadding * 2) : gpuTempRow.implicitWidth
- implicitHeight: root.isVerticalOrientation ? gpuTempColumn.implicitHeight : gpuTempRow.implicitHeight
-
- Column {
- id: gpuTempColumn
- visible: root.isVerticalOrientation
- anchors.centerIn: parent
- spacing: 1
-
- DankIcon {
- name: "auto_awesome_mosaic"
- size: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
- color: {
- if (root.displayTemp > 80) {
- return Theme.tempDanger;
- }
-
- if (root.displayTemp > 65) {
- return Theme.tempWarning;
- }
-
- return Theme.widgetIconColor;
- }
- anchors.horizontalCenter: parent.horizontalCenter
- }
-
- StyledText {
- text: {
- if (root.displayTemp === undefined || root.displayTemp === null || root.displayTemp === 0) {
- return "--";
- }
-
- return Math.round(root.displayTemp).toString();
- }
- font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
- color: Theme.widgetTextColor
- anchors.horizontalCenter: parent.horizontalCenter
- }
- }
-
- Row {
- id: gpuTempRow
- visible: !root.isVerticalOrientation
- anchors.centerIn: parent
- spacing: Theme.spacingXS
-
- DankIcon {
- id: gpuTempIcon
- name: "auto_awesome_mosaic"
- size: Theme.barIconSize(root.barThickness, undefined, root.barConfig?.maximizeWidgetIcons, root.barConfig?.iconScale)
- color: {
- if (root.displayTemp > 80) {
- return Theme.tempDanger;
- }
-
- if (root.displayTemp > 65) {
- return Theme.tempWarning;
- }
-
- return Theme.widgetIconColor;
- }
- anchors.verticalCenter: parent.verticalCenter
- }
-
- Item {
- id: textBox
- anchors.verticalCenter: parent.verticalCenter
-
- implicitWidth: root.minimumWidth ? Math.max(gpuTempBaseline.width, gpuTempText.paintedWidth) : gpuTempText.paintedWidth
- implicitHeight: gpuTempText.implicitHeight
-
- width: implicitWidth
- height: implicitHeight
-
- StyledTextMetrics {
- id: gpuTempBaseline
- font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
- text: "88°"
- }
-
- StyledText {
- id: gpuTempText
- text: {
- if (root.displayTemp === undefined || root.displayTemp === null || root.displayTemp === 0) {
- return "--°";
- }
-
- return Math.round(root.displayTemp) + "°";
- }
- font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
- color: Theme.widgetTextColor
-
- anchors.fill: parent
- horizontalAlignment: Text.AlignHCenter
- verticalAlignment: Text.AlignVCenter
- elide: Text.ElideNone
- }
- }
- }
- }
- }
-
- MouseArea {
- anchors.fill: parent
- cursorShape: Qt.PointingHandCursor
- acceptedButtons: Qt.LeftButton
- onPressed: mouse => {
- root.triggerRipple(this, mouse.x, mouse.y);
- DgopService.setSortBy("cpu");
- gpuTempClicked();
- }
- }
-
- Timer {
- id: autoSaveTimer
-
- interval: 100
- running: false
- onTriggered: {
- if (DgopService.availableGpus && DgopService.availableGpus.length > 0) {
- const firstGpu = DgopService.availableGpus[0];
- if (firstGpu && firstGpu.pciId) {
- updateWidgetPciId(firstGpu.pciId);
- DgopService.addGpuPciId(firstGpu.pciId);
- }
- }
- }
- }
-}