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

fix system trya item activation

This commit is contained in:
bbedward
2025-08-10 14:15:56 -04:00
parent 62e1aa8ae8
commit 1a4e16fc7a

View File

@@ -10,8 +10,8 @@ Rectangle {
property var parentScreen: null
readonly property int calculatedWidth: SystemTray.items.values.length
> 0 ? SystemTray.items.values.length * 24
+ (SystemTray.items.values.length - 1)
> 0 ? SystemTray.items.values.length
* 24 + (SystemTray.items.values.length - 1)
* Theme.spacingXS + Theme.spacingS * 2 : 0
width: calculatedWidth
@@ -47,7 +47,8 @@ Rectangle {
return icon
const name = split[0]
const path = split[1]
const fileName = name.substring(name.lastIndexOf("/") + 1)
const fileName = name.substring(
name.lastIndexOf("/") + 1)
return `file://${path}/${fileName}`
}
return icon
@@ -94,19 +95,24 @@ Rectangle {
if (!trayItem)
return
if (mouse.button === Qt.LeftButon && !trayItem.onlyMenu) {
trayItem.activate()
return
}
if (trayItem.hasMenu) {
var globalPos = mapToGlobal(0, 0)
var currentScreen = parentScreen || Screen
var currentScreen = parentScreen
|| Screen
var screenX = currentScreen.x || 0
var relativeX = globalPos.x - screenX
menuAnchor.menu = trayItem.menu
menuAnchor.anchor.window = parentWindow
menuAnchor.anchor.rect = Qt.rect(
relativeX, Theme.barHeight + Theme.spacingS,
relativeX,
Theme.barHeight + Theme.spacingS,
parent.width, 1)
menuAnchor.open()
} else if (mouse.button === Qt.LeftButton) {
trayItem.activate()
}
}
}