Tray: fix for hyprland (untested)

This commit is contained in:
ItsLemmy
2025-11-11 13:35:35 -05:00
parent 093b32803b
commit 8aa4254d57
6 changed files with 145 additions and 61 deletions
+15
View File
@@ -83,5 +83,20 @@ Variants {
Logger.d("Shell", "BarExclusionZone created for", modelData?.name)
}
}
// TrayMenuWindow - separate window for tray context menus
// This must be a top-level PanelWindow.
Loader {
active: parent.windowLoaded && parent.shouldBeActive
asynchronous: false
sourceComponent: TrayMenuWindow {
screen: modelData
}
onLoaded: {
Logger.d("Shell", "TrayMenuWindow created for", modelData?.name)
}
}
}
}
-45
View File
@@ -44,7 +44,6 @@ PanelWindow {
readonly property alias trayDrawerPanel: trayDrawerPanel
readonly property alias wallpaperPanel: wallpaperPanel
readonly property alias wifiPanel: wifiPanel
readonly property alias trayMenuWindow: trayMenuWindow
Component.onCompleted: {
Logger.d("MainScreen", "Initialized for screen:", screen?.name, "- Dimensions:", screen?.width, "x", screen?.height, "- Position:", screen?.x, ",", screen?.y)
@@ -286,7 +285,6 @@ PanelWindow {
TrayDrawerPanel {
id: trayDrawerPanel
screen: root.screen
trayMenuWindow: root.trayMenuWindow
z: 50
Component.onCompleted: {
@@ -317,49 +315,6 @@ PanelWindow {
}
}
// ----------------------------------------------
// Shared TrayMenu window for context menus (used by both Tray widget and TrayDrawerPanel)
PanelWindow {
id: trayMenuWindow
anchors.top: true
anchors.left: true
anchors.right: true
anchors.bottom: true
visible: false
color: Color.transparent
screen: root.screen
// Expose the trayMenu Loader directly
readonly property alias trayMenuLoader: trayMenu
function open() {
visible = true
}
function close() {
visible = false
if (trayMenu.item) {
trayMenu.item.hideMenu()
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: trayMenuWindow.close()
}
Loader {
id: trayMenu
source: "../Bar/Extras/TrayMenu.qml"
onLoaded: {
if (item) {
item.screen = root.screen
}
}
}
}
// ----------------------------------------------
// Bar background placeholder - just for background positioning (actual bar content is in BarContentWindow)
Item {
+63
View File
@@ -0,0 +1,63 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import qs.Commons
import qs.Services.UI
import qs.Modules.Bar.Extras
// Separate window for TrayMenu context menus
// This is a top-level PanelWindow (sibling to MainScreen, not nested inside it)
PanelWindow {
id: root
required property ShellScreen screen
anchors.top: true
anchors.left: true
anchors.right: true
anchors.bottom: true
visible: false
color: Color.transparent
// Use Top layer (same as MainScreen) for proper event handling
WlrLayershell.layer: WlrLayer.Top
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
WlrLayershell.namespace: "noctalia-traymenu-" + (screen?.name || "unknown")
WlrLayershell.exclusionMode: ExclusionMode.Ignore
// Expose the trayMenu Loader directly
readonly property alias trayMenuLoader: trayMenu
// Register with PanelService so panels can find this window
Component.onCompleted: {
objectName = "trayMenuWindow-" + (screen?.name || "unknown")
PanelService.registerTrayMenuWindow(screen, root)
}
function open() {
visible = true
}
function close() {
visible = false
if (trayMenu.item) {
trayMenu.item.hideMenu()
}
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: root.close()
}
Loader {
id: trayMenu
source: "../Bar/Extras/TrayMenu.qml"
onLoaded: {
if (item) {
item.screen = root.screen
}
}
}
}