TRAY
This commit is contained in:
+8
-25
@@ -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
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user