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 QtQuick
import Quickshell import Quickshell
import Quickshell.Io import Quickshell.Io
import Quickshell.Wayland
import qs.Commons import qs.Commons
import qs.Services import qs.Services
Item { Item {
id: root 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 { IpcHandler {
target: "screenRecorder" target: "screenRecorder"
function toggle() { function toggle() {
@ -17,14 +27,14 @@ Item {
IpcHandler { IpcHandler {
target: "settings" target: "settings"
function toggle() { function toggle() {
settingsPanel.toggle(Quickshell.screens[0]) settingsPanel.toggle(getActiveScreen())
} }
} }
IpcHandler { IpcHandler {
target: "notifications" target: "notifications"
function toggleHistory() { function toggleHistory() {
notificationHistoryPanel.toggle(Quickshell.screens[0]) notificationHistoryPanel.toggle(getActiveScreen())
} }
function toggleDoNotDisturb() {// TODO function toggleDoNotDisturb() {// TODO
} }
@ -40,15 +50,15 @@ Item {
IpcHandler { IpcHandler {
target: "launcher" target: "launcher"
function toggle() { function toggle() {
launcherPanel.toggle(Quickshell.screens[0]) launcherPanel.toggle(Screen)
} }
function clipboard() { function clipboard() {
launcherPanel.setSearchText(">clip ") launcherPanel.setSearchText(">clip ")
launcherPanel.toggle(Quickshell.screens[0]) launcherPanel.toggle(getActiveScreen())
} }
function calculator() { function calculator() {
launcherPanel.setSearchText(">calc ") launcherPanel.setSearchText(">calc ")
launcherPanel.toggle(Quickshell.screens[0]) launcherPanel.toggle(getActiveScreen())
} }
} }
@ -107,14 +117,14 @@ Item {
IpcHandler { IpcHandler {
target: "powerPanel" target: "powerPanel"
function toggle() { function toggle() {
powerPanel.toggle(Quickshell.screens[0]) powerPanel.toggle(getActiveScreen())
} }
} }
IpcHandler { IpcHandler {
target: "sidePanel" target: "sidePanel"
function toggle() { function toggle() {
sidePanel.toggle(Quickshell.screens[0]) sidePanel.toggle(getActiveScreen())
} }
} }

View file

@ -52,6 +52,7 @@ Loader {
property alias isClosing: hideTimer.running property alias isClosing: hideTimer.running
readonly property real barHeight: Math.round(Style.barHeight * scaling) readonly property real barHeight: Math.round(Style.barHeight * scaling)
readonly property bool barAtBottom: Settings.data.bar.position === "bottom" 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 opened
signal closed signal closed
@ -163,8 +164,8 @@ Loader {
anchors.left: true anchors.left: true
anchors.right: true anchors.right: true
anchors.bottom: true anchors.bottom: true
margins.top: !barAtBottom ? barHeight : 0 margins.top: (barIsVisible && !barAtBottom) ? barHeight : 0
margins.bottom: barAtBottom ? barHeight : 0 margins.bottom: (barIsVisible && barAtBottom) ? barHeight : 0
// Close any panel with Esc without requiring focus // Close any panel with Esc without requiring focus
Shortcut { Shortcut {