1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

hyprland running apps improvement

This commit is contained in:
bbedward
2025-08-26 15:55:32 -04:00
parent e2df1da5be
commit 257df891ee
3 changed files with 43 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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) {