1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

fix some dock behaviors on hyprland

This commit is contained in:
bbedward
2025-08-23 13:37:54 -04:00
parent 5e91aaa13e
commit 75e04137de
2 changed files with 42 additions and 8 deletions

View File

@@ -25,10 +25,14 @@ Item {
property bool isHovered: mouseArea.containsMouse && !dragging
property bool showTooltip: mouseArea.containsMouse && !dragging
property bool isWindowFocused: {
if (!appData || appData.type !== "window" || !appData.toplevelObject) {
if (!appData || appData.type !== "window") {
return false
}
return appData.toplevelObject.activated
var toplevel = getToplevelObject()
if (!toplevel) {
return false
}
return toplevel.activated
}
property string tooltipText: {
if (!appData)
@@ -52,6 +56,35 @@ Item {
width: 40
height: 40
function getToplevelObject() {
if (!appData || appData.type !== "window") {
return null
}
var sortedToplevels = CompositorService.sortedToplevels
if (!sortedToplevels) {
return null
}
if (appData.uniqueId) {
for (var i = 0; i < sortedToplevels.length; i++) {
var toplevel = sortedToplevels[i]
var checkId = toplevel.title + "|" + (toplevel.appId || "") + "|" + i
if (checkId === appData.uniqueId) {
return toplevel
}
}
}
if (appData.windowId !== undefined && appData.windowId !== null && appData.windowId >= 0) {
if (appData.windowId < sortedToplevels.length) {
return sortedToplevels[appData.windowId]
}
}
return null
}
onIsHoveredChanged: {
if (isHovered) {
exitAnimation.stop()
@@ -208,8 +241,9 @@ Item {
desktopEntry.execute()
}
} else if (appData.type === "window") {
if (appData.toplevelObject) {
appData.toplevelObject.activate()
var toplevel = getToplevelObject()
if (toplevel) {
toplevel.activate()
}
}
} else if (mouse.button === Qt.MiddleButton) {

View File

@@ -88,22 +88,22 @@ Item {
}
// Second section: Running windows (sorted using Theme.sortToplevels)
sortedToplevels.forEach(toplevel => {
sortedToplevels.forEach((toplevel, index) => {
// Limit window title length for tooltip
var title = toplevel.title || "(Unnamed)"
if (title.length > 50) {
title = title.substring(0, 47) + "..."
}
var uniqueId = toplevel.title + "|" + (toplevel.appId || "") + "|" + index
items.push({
"type": "window",
"appId": toplevel.appId || "",
"windowId": -1, // Toplevel doesn't have numeric ID
"windowId": index,
"windowTitle": title,
"workspaceId": -1, // Will be handled by sorting
"isPinned": false,
"isRunning": true,
"toplevelObject": toplevel
"uniqueId": uniqueId
})
})