From d319ab9bfc98c11b85ce714208692fbd3f97082c Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Thu, 4 Sep 2025 09:37:50 -0400 Subject: [PATCH] IPC: IPC calls now properly identified the proper monitor so that dimming and other stuff works better. --- Modules/IPC/IPCManager.qml | 24 +++++++++++++++++------- Widgets/NPanel.qml | 5 +++-- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/Modules/IPC/IPCManager.qml b/Modules/IPC/IPCManager.qml index ebca4fa..61487b4 100644 --- a/Modules/IPC/IPCManager.qml +++ b/Modules/IPC/IPCManager.qml @@ -1,12 +1,22 @@ import QtQuick import Quickshell import Quickshell.Io +import Quickshell.Wayland import qs.Commons import qs.Services Item { id: root + // Using Wayland protocols to get focused window then determine which screen it's on. + function getActiveScreen() { + const activeWindow = ToplevelManager.activeToplevel + if (activeWindow.screens.length > 0) { + return activeWindow.screens[0] + } + return null + } + IpcHandler { target: "screenRecorder" function toggle() { @@ -17,14 +27,14 @@ Item { IpcHandler { target: "settings" function toggle() { - settingsPanel.toggle(Quickshell.screens[0]) + settingsPanel.toggle(getActiveScreen()) } } IpcHandler { target: "notifications" function toggleHistory() { - notificationHistoryPanel.toggle(Quickshell.screens[0]) + notificationHistoryPanel.toggle(getActiveScreen()) } function toggleDoNotDisturb() {// TODO } @@ -40,15 +50,15 @@ Item { IpcHandler { target: "launcher" function toggle() { - launcherPanel.toggle(Quickshell.screens[0]) + launcherPanel.toggle(Screen) } function clipboard() { launcherPanel.setSearchText(">clip ") - launcherPanel.toggle(Quickshell.screens[0]) + launcherPanel.toggle(getActiveScreen()) } function calculator() { launcherPanel.setSearchText(">calc ") - launcherPanel.toggle(Quickshell.screens[0]) + launcherPanel.toggle(getActiveScreen()) } } @@ -107,14 +117,14 @@ Item { IpcHandler { target: "powerPanel" function toggle() { - powerPanel.toggle(Quickshell.screens[0]) + powerPanel.toggle(getActiveScreen()) } } IpcHandler { target: "sidePanel" function toggle() { - sidePanel.toggle(Quickshell.screens[0]) + sidePanel.toggle(getActiveScreen()) } } diff --git a/Widgets/NPanel.qml b/Widgets/NPanel.qml index 35a3730..d6326bf 100644 --- a/Widgets/NPanel.qml +++ b/Widgets/NPanel.qml @@ -52,6 +52,7 @@ Loader { property alias isClosing: hideTimer.running readonly property real barHeight: Math.round(Style.barHeight * scaling) readonly property bool barAtBottom: Settings.data.bar.position === "bottom" + readonly property bool barIsVisible: (screen !== null) && (Settings.data.bar.monitors.includes(screen.name) || (Settings.data.bar.monitors.length === 0)) signal opened signal closed @@ -163,8 +164,8 @@ Loader { anchors.left: true anchors.right: true anchors.bottom: true - margins.top: !barAtBottom ? barHeight : 0 - margins.bottom: barAtBottom ? barHeight : 0 + margins.top: (barIsVisible && !barAtBottom) ? barHeight : 0 + margins.bottom: (barIsVisible && barAtBottom) ? barHeight : 0 // Close any panel with Esc without requiring focus Shortcut {