IPC: IPC calls now properly identified the proper monitor so that dimming and other stuff works better.

This commit is contained in:
LemmyCook 2025-09-04 09:37:50 -04:00
parent 902cdc39e0
commit d319ab9bfc
2 changed files with 20 additions and 9 deletions

View file

@ -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())
}
}

View file

@ -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 {