mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-03 20:32:07 -04:00
fix some dock behaviors on hyprland
This commit is contained in:
@@ -25,10 +25,14 @@ Item {
|
|||||||
property bool isHovered: mouseArea.containsMouse && !dragging
|
property bool isHovered: mouseArea.containsMouse && !dragging
|
||||||
property bool showTooltip: mouseArea.containsMouse && !dragging
|
property bool showTooltip: mouseArea.containsMouse && !dragging
|
||||||
property bool isWindowFocused: {
|
property bool isWindowFocused: {
|
||||||
if (!appData || appData.type !== "window" || !appData.toplevelObject) {
|
if (!appData || appData.type !== "window") {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return appData.toplevelObject.activated
|
var toplevel = getToplevelObject()
|
||||||
|
if (!toplevel) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return toplevel.activated
|
||||||
}
|
}
|
||||||
property string tooltipText: {
|
property string tooltipText: {
|
||||||
if (!appData)
|
if (!appData)
|
||||||
@@ -52,6 +56,35 @@ Item {
|
|||||||
|
|
||||||
width: 40
|
width: 40
|
||||||
height: 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: {
|
onIsHoveredChanged: {
|
||||||
if (isHovered) {
|
if (isHovered) {
|
||||||
exitAnimation.stop()
|
exitAnimation.stop()
|
||||||
@@ -208,8 +241,9 @@ Item {
|
|||||||
desktopEntry.execute()
|
desktopEntry.execute()
|
||||||
}
|
}
|
||||||
} else if (appData.type === "window") {
|
} else if (appData.type === "window") {
|
||||||
if (appData.toplevelObject) {
|
var toplevel = getToplevelObject()
|
||||||
appData.toplevelObject.activate()
|
if (toplevel) {
|
||||||
|
toplevel.activate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (mouse.button === Qt.MiddleButton) {
|
} else if (mouse.button === Qt.MiddleButton) {
|
||||||
|
|||||||
@@ -88,22 +88,22 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Second section: Running windows (sorted using Theme.sortToplevels)
|
// Second section: Running windows (sorted using Theme.sortToplevels)
|
||||||
sortedToplevels.forEach(toplevel => {
|
sortedToplevels.forEach((toplevel, index) => {
|
||||||
// Limit window title length for tooltip
|
// Limit window title length for tooltip
|
||||||
var title = toplevel.title || "(Unnamed)"
|
var title = toplevel.title || "(Unnamed)"
|
||||||
if (title.length > 50) {
|
if (title.length > 50) {
|
||||||
title = title.substring(0, 47) + "..."
|
title = title.substring(0, 47) + "..."
|
||||||
}
|
}
|
||||||
|
var uniqueId = toplevel.title + "|" + (toplevel.appId || "") + "|" + index
|
||||||
items.push({
|
items.push({
|
||||||
"type": "window",
|
"type": "window",
|
||||||
"appId": toplevel.appId || "",
|
"appId": toplevel.appId || "",
|
||||||
"windowId": -1, // Toplevel doesn't have numeric ID
|
"windowId": index,
|
||||||
"windowTitle": title,
|
"windowTitle": title,
|
||||||
"workspaceId": -1, // Will be handled by sorting
|
"workspaceId": -1, // Will be handled by sorting
|
||||||
"isPinned": false,
|
"isPinned": false,
|
||||||
"isRunning": true,
|
"isRunning": true,
|
||||||
"toplevelObject": toplevel
|
"uniqueId": uniqueId
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user