From 257df891ee98f8b6d5adf8a9e27f18ee5efd9290 Mon Sep 17 00:00:00 2001 From: bbedward Date: Tue, 26 Aug 2025 15:55:32 -0400 Subject: [PATCH 1/4] hyprland running apps improvement --- Modules/Dock/DockAppButton.qml | 2 +- Modules/Dock/DockApps.qml | 5 ++-- Services/CompositorService.qml | 49 +++++++++++++++++++++++++++------- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/Modules/Dock/DockAppButton.qml b/Modules/Dock/DockAppButton.qml index 9efb1abc..1dcc1029 100644 --- a/Modules/Dock/DockAppButton.qml +++ b/Modules/Dock/DockAppButton.qml @@ -277,7 +277,7 @@ Item { anchors.centerIn: parent implicitSize: 40 - source: Quickshell.iconPath(DesktopEntries.byId(Paths.moddedAppId(appData.appId)).icon, true) + source: appData.appId !== "__SEPARATOR__" ? Quickshell.iconPath(DesktopEntries.byId(Paths.moddedAppId(appData.appId)).icon, true) : "" mipmap: true smooth: true asynchronous: true diff --git a/Modules/Dock/DockApps.qml b/Modules/Dock/DockApps.qml index 77da0477..52c2efe9 100644 --- a/Modules/Dock/DockApps.qml +++ b/Modules/Dock/DockApps.qml @@ -95,12 +95,13 @@ Item { title = title.substring(0, 47) + "..." } var uniqueId = toplevel.title + "|" + (toplevel.appId || "") + "|" + index + items.push({ "type": "window", - "appId": toplevel.appId || "", + "appId": toplevel.appId, "windowId": index, "windowTitle": title, - "workspaceId": -1, // Will be handled by sorting + "workspaceId": -1, "isPinned": false, "isRunning": true, "uniqueId": uniqueId diff --git a/Services/CompositorService.qml b/Services/CompositorService.qml index b0330bf5..7856dc34 100644 --- a/Services/CompositorService.qml +++ b/Services/CompositorService.qml @@ -21,7 +21,6 @@ Singleton { property bool useNiriSorting: isNiri && NiriService property bool useHyprlandSorting: false - // Unified sorted toplevels - automatically chooses sorting based on compositor property var sortedToplevels: { if (!ToplevelManager.toplevels || !ToplevelManager.toplevels.values) { return [] @@ -48,13 +47,26 @@ Singleton { if (workspaceCompare !== 0) return workspaceCompare } - // Then by position on workspace (x first for columns, then y within column) + if (a.lastIpcObject && b.lastIpcObject && a.lastIpcObject.at && b.lastIpcObject.at) { - const xCompare = a.lastIpcObject.at[0] - b.lastIpcObject.at[0] - if (xCompare !== 0) return xCompare - return a.lastIpcObject.at[1] - b.lastIpcObject.at[1] + const aX = a.lastIpcObject.at[0] + const bX = b.lastIpcObject.at[0] + const aY = a.lastIpcObject.at[1] + const bY = b.lastIpcObject.at[1] + + const xCompare = aX - bX + if (Math.abs(xCompare) > 10) return xCompare + return aY - bY } + if (a.lastIpcObject && !b.lastIpcObject) return -1 + if (!a.lastIpcObject && b.lastIpcObject) return 1 + + if (a.title && b.title) { + return a.title.localeCompare(b.title) + } + + return 0 }) @@ -90,14 +102,31 @@ Singleton { for (var i = 0; i < hyprlandToplevels.length; i++) { var hyprToplevel = hyprlandToplevels[i] - if (hyprToplevel.activated && hyprToplevel.monitor && hyprToplevel.monitor.name === screenName) { - currentWorkspaceId = hyprToplevel.workspace ? hyprToplevel.workspace.id : null - break + if (hyprToplevel.monitor && hyprToplevel.monitor.name === screenName && hyprToplevel.workspace) { + if (hyprToplevel.activated) { + currentWorkspaceId = hyprToplevel.workspace.id + break + } + if (currentWorkspaceId === null) { + currentWorkspaceId = hyprToplevel.workspace.id + } } } - if (currentWorkspaceId === null && Hyprland.focusedWorkspace) { - currentWorkspaceId = Hyprland.focusedWorkspace.id + if (currentWorkspaceId === null && Hyprland.workspaces) { + const workspaces = Array.from(Hyprland.workspaces.values) + for (var k = 0; k < workspaces.length; k++) { + var workspace = workspaces[k] + if (workspace.monitor && workspace.monitor === screenName) { + if (Hyprland.focusedWorkspace && workspace.id === Hyprland.focusedWorkspace.id) { + currentWorkspaceId = workspace.id + break + } + if (currentWorkspaceId === null) { + currentWorkspaceId = workspace.id + } + } + } } if (currentWorkspaceId === null) { From 5aa34b898c7116aa54a3e7efac82790b6c75f123 Mon Sep 17 00:00:00 2001 From: Vantesh <121645908+Vantesh@users.noreply.github.com> Date: Wed, 27 Aug 2025 00:51:33 +0300 Subject: [PATCH 2/4] feat: implement uwsm session check on logout --- Services/CompositorService.qml | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Services/CompositorService.qml b/Services/CompositorService.qml index 7856dc34..601b1662 100644 --- a/Services/CompositorService.qml +++ b/Services/CompositorService.qml @@ -187,10 +187,33 @@ Singleton { } function logout() { - if (isNiri) { - NiriService.quit() - return + // Trigger the check process + uwsmCheck.running = true + } + + Process { + id: uwsmCheck + // `uwsm check is-active` returns 0 if in uwsm-managed session, 1 otherwise + command: ["uwsm", "check", "is-active"] + running: false + onExited: function(exitCode) { + if (exitCode === 0) { + uwsmStop.running = true + return + } + + // Not a uwsm-managed session; fall back to compositor-specific logout + if (isNiri) { + NiriService.quit() + return + } + Hyprland.dispatch("exit") } - Hyprland.dispatch("exit") + } + + Process { + id: uwsmStop + command: ["uwsm", "stop"] + running: false } } From 4ca64a85bc3dfe12cbe662b9b3999b8844737975 Mon Sep 17 00:00:00 2001 From: Vantesh <121645908+Vantesh@users.noreply.github.com> Date: Wed, 27 Aug 2025 02:34:46 +0300 Subject: [PATCH 3/4] feat:implement uwsm session check --- Services/CompositorService.qml | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/Services/CompositorService.qml b/Services/CompositorService.qml index 601b1662..6ec06184 100644 --- a/Services/CompositorService.qml +++ b/Services/CompositorService.qml @@ -13,6 +13,7 @@ Singleton { // Compositor detection property bool isHyprland: false property bool isNiri: false + property bool uwsmActive: false property string compositor: "unknown" readonly property string hyprlandSignature: Quickshell.env("HYPRLAND_INSTANCE_SIGNATURE") @@ -80,6 +81,7 @@ Singleton { Component.onCompleted: { detectCompositor() + uwsmCheck.running = true } function filterCurrentWorkspace(toplevels, screen){ @@ -187,8 +189,18 @@ Singleton { } function logout() { - // Trigger the check process - uwsmCheck.running = true + if (uwsmActive) { + Quickshell.execDetached(["uwsm", "stop"]) + return + } + + if (isNiri) { + NiriService.quit() + return + } + + // Hyprland fallback + Hyprland.dispatch("exit") } Process { @@ -197,23 +209,7 @@ Singleton { command: ["uwsm", "check", "is-active"] running: false onExited: function(exitCode) { - if (exitCode === 0) { - uwsmStop.running = true - return - } - - // Not a uwsm-managed session; fall back to compositor-specific logout - if (isNiri) { - NiriService.quit() - return - } - Hyprland.dispatch("exit") + uwsmActive = exitCode === 0 } } - - Process { - id: uwsmStop - command: ["uwsm", "stop"] - running: false - } } From eda3ee8d3bdb79d57fd9cb915ad6c55dc4321156 Mon Sep 17 00:00:00 2001 From: purian23 Date: Tue, 26 Aug 2025 22:03:13 -0400 Subject: [PATCH 4/4] fix: Workspace padding settings --- Modules/Dock/DockAppButton.qml | 6 +++++- Modules/TopBar/WorkspaceSwitcher.qml | 6 ++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules/Dock/DockAppButton.qml b/Modules/Dock/DockAppButton.qml index 1dcc1029..2b9648ca 100644 --- a/Modules/Dock/DockAppButton.qml +++ b/Modules/Dock/DockAppButton.qml @@ -277,7 +277,11 @@ Item { anchors.centerIn: parent implicitSize: 40 - source: appData.appId !== "__SEPARATOR__" ? Quickshell.iconPath(DesktopEntries.byId(Paths.moddedAppId(appData.appId)).icon, true) : "" + source: { + if (appData.appId === "__SEPARATOR__") return "" + var desktopEntry = DesktopEntries.byId(Paths.moddedAppId(appData.appId)) + return desktopEntry && desktopEntry.icon ? Quickshell.iconPath(desktopEntry.icon, true) : "" + } mipmap: true smooth: true asynchronous: true diff --git a/Modules/TopBar/WorkspaceSwitcher.qml b/Modules/TopBar/WorkspaceSwitcher.qml index a1c89ade..930b49ef 100644 --- a/Modules/TopBar/WorkspaceSwitcher.qml +++ b/Modules/TopBar/WorkspaceSwitcher.qml @@ -252,8 +252,14 @@ Rectangle { anchors.centerIn: parent text: { if (CompositorService.isHyprland) { + if (modelData && modelData.id === -1) { + return index + 1 + } return modelData && modelData.id ? modelData.id : "" } + if (modelData === -1) { + return index + 1 + } return modelData - 1 } color: isActive ? Qt.rgba(