This commit is contained in:
Zacharias-Brohn
2025-10-07 23:22:46 +02:00
parent 0da7e57a64
commit f6d25c98a6
10 changed files with 727 additions and 70 deletions
+8 -25
View File
@@ -2,12 +2,10 @@ import QtQuick
import Quickshell
import Quickshell.Widgets
import Quickshell.Services.SystemTray
import qs.Modules
IconImage {
id: root
required property SystemTrayItem item
property var customMenu
source: root.item.icon
implicitSize: 15
@@ -19,34 +17,19 @@ IconImage {
case Qt.LeftButton: root.item.activate(); break;
case Qt.RightButton:
if (root.item.hasMenu) {
root.customMenu = menuComponent.createObject(root);
root.customMenu.menuHandle = root.item.menu;
const window = QsWindow.window;
const widgetRect = window.contentItem.mapFromItem(root, 0, root.height + 4, root.width, root.height);
root.customMenu.anchor.rect = widgetRect
root.customMenu.anchor.window = window
root.customMenu.anchor.adjustment = PopupAdjustment.Flip
root.customMenu.visible = true;
root.customMenu.rebuild();
// menuAnchor.anchor.rect = widgetRect;
// menuAnchor.open();
const widgetRect = window.contentItem.mapFromItem(root, 0, root.height + 10 , root.width, root.height);
menuAnchor.anchor.rect = widgetRect;
menuAnchor.open();
}
break;
}
}
}
Component {
id: menuComponent
CustomTrayMenu {}
QsMenuAnchor {
id: menuAnchor
menu: root.item.menu
anchor.window: root.QsWindow.window?? null
anchor.adjustment: PopupAdjustment.Flip
}
// QsMenuAnchor {
// id: menuAnchor
// menu: root.item.menu
// anchor.window: root.QsWindow.window?? null
// anchor.adjustment: PopupAdjustment.Flip
// }
}