From df1d877c8f98b54eebb0ba5564d045f3859568b7 Mon Sep 17 00:00:00 2001 From: Zacharias-Brohn Date: Sat, 14 Feb 2026 12:22:10 +0100 Subject: [PATCH] dashboard on right, change trigger to clock --- Bar.qml | 12 ++++---- Drawers/Backgrounds.qml | 2 +- Drawers/Panels.qml | 2 +- Helpers/SystemUsage.qml | 19 ++++++++++-- Modules/Bar/BarLoader.qml | 20 +++++++------ Modules/Clock.qml | 17 +++++++---- Modules/Dashboard/Content.qml | 37 ++---------------------- Modules/Dashboard/Dash.qml | 43 +++++++++++++++------------- Modules/Dashboard/Dash/Resources.qml | 14 ++++++++- Modules/NotifBell.qml | 6 +++- Modules/ResourceUsage.qml | 2 +- Modules/TrayItem.qml | 12 ++++---- 12 files changed, 99 insertions(+), 87 deletions(-) diff --git a/Bar.qml b/Bar.qml index ccc0b63..76d3ae3 100644 --- a/Bar.qml +++ b/Bar.qml @@ -54,7 +54,7 @@ Variants { y: 34 property list nullRegions: [] - property bool hcurrent: ( panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu") ) || visibilities.sidebar + property bool hcurrent: ( panels.popouts.hasCurrent && panels.popouts.currentName.startsWith("traymenu") ) || visibilities.sidebar || visibilities.dashboard width: hcurrent ? 0 : bar.width height: hcurrent ? 0 : bar.screen.height - backgroundRect.implicitHeight @@ -135,17 +135,19 @@ Variants { onPressed: event => { var traywithinX = mouseX >= panels.popouts.x + 8 && mouseX < panels.popouts.x + panels.popouts.implicitWidth; var traywithinY = mouseY >= panels.popouts.y + exclusionZone.implicitHeight && mouseY < panels.popouts.y + exclusionZone.implicitHeight + panels.popouts.implicitHeight; - var sidebarwithinX = mouseX <= bar.width - panels.sidebar.width - - console.log(sidebarwithinX) + var sidebarwithinX = mouseX >= bar.width - panels.sidebar.width + var dashboardWithinX = mouseX <= panels.dashboard.width + panels.dashboard.x + var dashboardWithinY = mouseY <= backgroundRect.implicitHeight + panels.dashboard.implicitHeight if ( panels.popouts.hasCurrent ) { if ( traywithinX && traywithinY ) { } else { panels.popouts.hasCurrent = false; } - } else if ( visibilities.sidebar && sidebarwithinX ) { + } else if ( visibilities.sidebar && !sidebarwithinX ) { visibilities.sidebar = false; + } else if ( visibilities.dashboard && ( !dashboardWithinX || !dashboardWithinY )) { + visibilities.dashboard = false; } } diff --git a/Drawers/Backgrounds.qml b/Drawers/Backgrounds.qml index ef73a88..d7c8c4f 100644 --- a/Drawers/Backgrounds.qml +++ b/Drawers/Backgrounds.qml @@ -36,7 +36,7 @@ Shape { Dashboard.Background { wrapper: root.panels.dashboard - startX: ( root.width - wrapper.width ) / 2 - rounding + startX: root.width - root.panels.dashboard.width - rounding startY: 0 } diff --git a/Drawers/Panels.qml b/Drawers/Panels.qml index 343b58f..5c22606 100644 --- a/Drawers/Panels.qml +++ b/Drawers/Panels.qml @@ -67,7 +67,7 @@ Item { visibilities: root.visibilities - anchors.horizontalCenter: parent.horizontalCenter + anchors.right: parent.right anchors.top: parent.top } diff --git a/Helpers/SystemUsage.qml b/Helpers/SystemUsage.qml index 5b09ee4..d13d93b 100644 --- a/Helpers/SystemUsage.qml +++ b/Helpers/SystemUsage.qml @@ -14,6 +14,8 @@ Singleton { property string autoGpuType: "NONE" property real gpuPerc property real gpuTemp + property real gpuMemUsed + property real gpuMemTotal: 0 property real memUsed property real memTotal readonly property real memPerc: memTotal > 0 ? memUsed / memTotal : 0 @@ -150,10 +152,22 @@ Singleton { } } + Process { + id: oneshotMem + command: ["nvidia-smi", "--query-gpu=memory.total", "--format=csv,noheader,nounits"] + running: root.gpuType === "NVIDIA" && root.gpuMemTotal === 0 + stdout: StdioCollector { + onStreamFinished: { + root.gpuMemTotal = Number(this.text.trim()) + oneshotMem.running = false + } + } + } + Process { id: gpuUsage - command: root.gpuType === "GENERIC" ? ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"] : root.gpuType === "NVIDIA" ? ["nvidia-smi", "--query-gpu=utilization.gpu,temperature.gpu", "--format=csv,noheader,nounits"] : ["echo"] + command: root.gpuType === "GENERIC" ? ["sh", "-c", "cat /sys/class/drm/card*/device/gpu_busy_percent"] : root.gpuType === "NVIDIA" ? ["nvidia-smi", "--query-gpu=utilization.gpu,temperature.gpu,memory.used", "--format=csv,noheader,nounits"] : ["echo"] stdout: StdioCollector { onStreamFinished: { if (root.gpuType === "GENERIC") { @@ -161,9 +175,10 @@ Singleton { const sum = percs.reduce((acc, d) => acc + parseInt(d, 10), 0); root.gpuPerc = sum / percs.length / 100; } else if (root.gpuType === "NVIDIA") { - const [usage, temp] = text.trim().split(","); + const [usage, temp, mem] = text.trim().split(","); root.gpuPerc = parseInt(usage, 10) / 100; root.gpuTemp = parseInt(temp, 10); + root.gpuMemUsed = parseInt(mem, 10) / root.gpuMemTotal; } else { root.gpuPerc = 0; root.gpuTemp = 0; diff --git a/Modules/Bar/BarLoader.qml b/Modules/Bar/BarLoader.qml index d017b25..3efa9af 100644 --- a/Modules/Bar/BarLoader.qml +++ b/Modules/Bar/BarLoader.qml @@ -30,7 +30,7 @@ RowLayout { return; } - if ( visibilities.sidebar ) + if ( visibilities.sidebar || visibilities.dashboard ) return; const id = ch.id; @@ -145,6 +145,7 @@ RowLayout { delegate: WrappedLoader { sourceComponent: NotifBell { visibilities: root.visibilities + popouts: root.popouts } } } @@ -153,6 +154,7 @@ RowLayout { delegate: WrappedLoader { sourceComponent: Clock { popouts: root.popouts + visibilities: root.visibilities loader: root } } @@ -178,14 +180,14 @@ RowLayout { sourceComponent: NetworkWidget {} } } - DelegateChoice { - roleValue: "dash" - delegate: WrappedLoader { - sourceComponent: DashWidget { - visibilities: root.visibilities - } - } - } + // DelegateChoice { + // roleValue: "dash" + // delegate: WrappedLoader { + // sourceComponent: DashWidget { + // visibilities: root.visibilities + // } + // } + // } } } diff --git a/Modules/Clock.qml b/Modules/Clock.qml index 9a6f0f4..86a69ed 100644 --- a/Modules/Clock.qml +++ b/Modules/Clock.qml @@ -1,3 +1,4 @@ +import Quickshell import QtQuick import QtQuick.Layouts import qs.Config @@ -6,6 +7,7 @@ import qs.Helpers as Helpers import qs.Components Item { + required property PersistentProperties visibilities required property Wrapper popouts required property RowLayout loader @@ -35,12 +37,15 @@ Item { StateLayer { acceptedButtons: Qt.LeftButton onClicked: { - if ( mouse.button === Qt.LeftButton && !visibilities.sidebar ) { - Helpers.Calendar.displayYear = new Date().getFullYear(); - Helpers.Calendar.displayMonth = new Date().getMonth(); - root.popouts.currentName = "calendar"; - root.popouts.currentCenter = Qt.binding( () => item.mapToItem( root.loader, root.implicitWidth / 2, 0 ).x ); - root.popouts.hasCurrent = true; + root.visibilities.dashboard = !root.visibilities.dashboard; + if ( root.visibilities.sidebar || root.popouts.hasCurrent ) { + // Helpers.Calendar.displayYear = new Date().getFullYear(); + // Helpers.Calendar.displayMonth = new Date().getMonth(); + // root.popouts.currentName = "calendar"; + // root.popouts.currentCenter = Qt.binding( () => item.mapToItem( root.loader, root.implicitWidth / 2, 0 ).x ); + // root.popouts.hasCurrent = true; + root.popouts.hasCurrent = false; + root.visibilities.sidebar = false; } } } diff --git a/Modules/Dashboard/Content.qml b/Modules/Dashboard/Content.qml index c05e0c4..4ff2028 100644 --- a/Modules/Dashboard/Content.qml +++ b/Modules/Dashboard/Content.qml @@ -25,12 +25,12 @@ Item { anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom - anchors.margins: Appearance.padding.large + anchors.margins: Appearance.padding.smaller - radius: 8 + radius: 6 color: "transparent" - Flickable { + Item { id: view readonly property int currentIndex: root.state.currentTab @@ -38,36 +38,9 @@ Item { anchors.fill: parent - flickableDirection: Flickable.HorizontalFlick - implicitWidth: currentItem.implicitWidth implicitHeight: currentItem.implicitHeight - contentX: currentItem.x - contentWidth: row.implicitWidth - contentHeight: row.implicitHeight - - onContentXChanged: { - if (!moving) - return; - - const x = contentX - currentItem.x; - if (x > currentItem.implicitWidth / 2) - root.state.currentTab = Math.min(root.state.currentTab + 1, tabs.count - 1); - else if (x < -currentItem.implicitWidth / 2) - root.state.currentTab = Math.max(root.state.currentTab - 1, 0); - } - - onDragEnded: { - const x = contentX - currentItem.x; - if (x > currentItem.implicitWidth / 10) - root.state.currentTab = Math.min(root.state.currentTab + 1, tabs.count - 1); - else if (x < -currentItem.implicitWidth / 10) - root.state.currentTab = Math.max(root.state.currentTab - 1, 0); - else - contentX = Qt.binding(() => currentItem.x); - } - RowLayout { id: row @@ -79,10 +52,6 @@ Item { } } } - - Behavior on contentX { - Anim {} - } } } diff --git a/Modules/Dashboard/Dash.qml b/Modules/Dashboard/Dash.qml index 5e42e10..27e1a80 100644 --- a/Modules/Dashboard/Dash.qml +++ b/Modules/Dashboard/Dash.qml @@ -15,8 +15,10 @@ GridLayout { required property PersistentProperties state readonly property bool dashboardVisible: visibilities.dashboard - rowSpacing: Appearance.spacing.normal - columnSpacing: Appearance.spacing.normal + property int radius: 6 + + rowSpacing: Appearance.spacing.smaller + columnSpacing: Appearance.spacing.smaller opacity: 0 scale: 0.9 @@ -63,7 +65,7 @@ GridLayout { Layout.preferredWidth: user.implicitWidth Layout.preferredHeight: user.implicitHeight - radius: 6 + radius: root.radius User { id: user @@ -78,31 +80,31 @@ GridLayout { Layout.preferredWidth: Config.dashboard.sizes.weatherWidth Layout.fillHeight: true - radius: 6 + radius: root.radius Weather {} } - Rect { - Layout.row: 1 - Layout.preferredWidth: dateTime.implicitWidth - Layout.fillHeight: true - - radius: 6 - - DateTime { - id: dateTime - } - } + // Rect { + // Layout.row: 1 + // Layout.preferredWidth: dateTime.implicitWidth + // Layout.fillHeight: true + // + // radius: root.radius + // + // DateTime { + // id: dateTime + // } + // } Rect { Layout.row: 1 - Layout.column: 1 + Layout.column: 0 Layout.columnSpan: 3 Layout.fillWidth: true Layout.preferredHeight: calendar.implicitHeight - radius: 6 + radius: root.radius Calendar { id: calendar @@ -113,11 +115,12 @@ GridLayout { Rect { Layout.row: 1 - Layout.column: 4 + Layout.column: 3 + Layout.columnSpan: 2 Layout.preferredWidth: resources.implicitWidth Layout.fillHeight: true - radius: 6 + radius: root.radius Resources { id: resources @@ -131,7 +134,7 @@ GridLayout { Layout.preferredWidth: media.implicitWidth Layout.fillHeight: true - radius: 6 + radius: root.radius Media { id: media diff --git a/Modules/Dashboard/Dash/Resources.qml b/Modules/Dashboard/Dash/Resources.qml index 7795621..c75209e 100644 --- a/Modules/Dashboard/Dash/Resources.qml +++ b/Modules/Dashboard/Dash/Resources.qml @@ -11,7 +11,7 @@ Row { anchors.bottom: parent.bottom padding: Appearance.padding.large - spacing: Appearance.spacing.normal + spacing: Appearance.spacing.large Ref { service: SystemUsage @@ -29,6 +29,18 @@ Row { color: DynamicColors.palette.m3secondary } + Resource { + icon: "gamepad" + value: SystemUsage.gpuPerc + color: DynamicColors.palette.m3primaryFixed + } + + Resource { + icon: "host" + value: SystemUsage.gpuMemUsed + color: DynamicColors.palette.m3secondaryFixed + } + Resource { icon: "hard_disk" value: SystemUsage.storagePerc diff --git a/Modules/NotifBell.qml b/Modules/NotifBell.qml index 5148faf..e694157 100644 --- a/Modules/NotifBell.qml +++ b/Modules/NotifBell.qml @@ -9,6 +9,7 @@ Item { id: root required property PersistentProperties visibilities + required property Wrapper popouts implicitWidth: 25 anchors.top: parent.top @@ -40,8 +41,11 @@ Item { StateLayer { cursorShape: Qt.PointingHandCursor onClicked: { - // Hyprland.dispatch("global zshell-nc:toggle-nc"); root.visibilities.sidebar = !root.visibilities.sidebar; + if ( root.visibilities.dashboard || root.popouts.hasCurrent ) { + root.popouts.hasCurrent = false; + root.visibilities.dashboard = false; + } } } } diff --git a/Modules/ResourceUsage.qml b/Modules/ResourceUsage.qml index d333318..3cb8b51 100644 --- a/Modules/ResourceUsage.qml +++ b/Modules/ResourceUsage.qml @@ -60,7 +60,7 @@ Singleton { processGpu.running = true } - interval = 1000 + interval = 3000 } } diff --git a/Modules/TrayItem.qml b/Modules/TrayItem.qml index 3e5831b..becd8a9 100644 --- a/Modules/TrayItem.qml +++ b/Modules/TrayItem.qml @@ -28,12 +28,12 @@ Item { if ( mouse.button === Qt.LeftButton ) { root.item.activate(); } else if ( mouse.button === Qt.RightButton ) { - if ( visibilities.sidebar ) { - return; - } else { - root.popouts.currentName = `traymenu${ root.ind }`; - root.popouts.currentCenter = Qt.binding( () => root.mapToItem( root.loader, root.implicitWidth / 2, 0 ).x ); - root.popouts.hasCurrent = true; + root.popouts.currentName = `traymenu${ root.ind }`; + root.popouts.currentCenter = Qt.binding( () => root.mapToItem( root.loader, root.implicitWidth / 2, 0 ).x ); + root.popouts.hasCurrent = true; + if ( visibilities.sidebar || visibilities.dashboard ) { + visibilities.sidebar = false; + visibilities.dashboard = false; } } }