summaryrefslogtreecommitdiff
path: root/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml
diff options
context:
space:
mode:
authorAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
committerAlexanderCurl <alexc@alexc.hu>2026-04-18 17:46:06 +0100
commit70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69 (patch)
treeab1123d4067c1b086dd6faa7ee4ea643236b565a /raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml
parent5d94c0a7d44a2255b81815a52a7056a94a39842d (diff)
downloadRaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.tar.gz
RaveOS-PKGBUILD-70ca3fef77ee8bdc6e3ac28589a6fa08c024cc69.zip
Replaced file structures for themes in the correct format
Diffstat (limited to 'raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml')
-rw-r--r--raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml76
1 files changed, 76 insertions, 0 deletions
diff --git a/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml
new file mode 100644
index 0000000..827df4e
--- /dev/null
+++ b/raveos-hyprland-theme/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/Widgets/DiskUsagePill.qml
@@ -0,0 +1,76 @@
+import QtQuick
+import qs.Common
+import qs.Services
+import qs.Modules.ControlCenter.Widgets
+
+CompoundPill {
+ id: root
+
+ property string mountPath: "/"
+ property string instanceId: ""
+
+ iconName: "storage"
+
+ property var selectedMount: {
+ if (!DgopService.diskMounts || DgopService.diskMounts.length === 0) {
+ return null;
+ }
+
+ const targetMount = DgopService.diskMounts.find(mount => mount.mount === mountPath);
+ return targetMount || DgopService.diskMounts.find(mount => mount.mount === "/") || DgopService.diskMounts[0];
+ }
+
+ property real usagePercent: {
+ if (!selectedMount || !selectedMount.percent) {
+ return 0;
+ }
+ const percentStr = selectedMount.percent.replace("%", "");
+ return parseFloat(percentStr) || 0;
+ }
+
+ isActive: DgopService.dgopAvailable && selectedMount !== null
+
+ primaryText: {
+ if (!DgopService.dgopAvailable) {
+ return I18n.tr("Disk Usage");
+ }
+ if (!selectedMount) {
+ return I18n.tr("No disk data");
+ }
+ return selectedMount.mount;
+ }
+
+ secondaryText: {
+ if (!DgopService.dgopAvailable) {
+ return I18n.tr("dgop not available");
+ }
+ if (!selectedMount) {
+ return I18n.tr("No disk data available");
+ }
+ return `${selectedMount.used} / ${selectedMount.size} (${usagePercent.toFixed(0)}%)`;
+ }
+
+ iconColor: {
+ if (!DgopService.dgopAvailable || !selectedMount) {
+ return Qt.rgba(Theme.surfaceText.r, Theme.surfaceText.g, Theme.surfaceText.b, 0.5);
+ }
+ if (usagePercent > 90) {
+ return Theme.error;
+ }
+ if (usagePercent > 75) {
+ return Theme.warning;
+ }
+ return Theme.surfaceText;
+ }
+
+ Component.onCompleted: {
+ DgopService.addRef(["diskmounts"]);
+ }
+ Component.onDestruction: {
+ DgopService.removeRef(["diskmounts"]);
+ }
+
+ onToggled: {
+ expandClicked();
+ }
+}