Fixed IPCHandlers by wrapping it in an Item

This commit is contained in:
quadbyte 2025-08-07 20:26:27 -04:00
parent 9e78807071
commit 7be3ea1eb2

View file

@ -1,46 +1,54 @@
import QtQuick
import Quickshell.Io import Quickshell.Io
import qs.Bar.Modules
import qs.Helpers
import qs.Widgets.LockScreen
import qs.Widgets.Notification
import "./IdleInhibitor.qml" Item {
id: root
property Applauncher appLauncherPanel
property LockScreen lockScreen
property IdleInhibitor idleInhibitor
property NotificationPopup notificationPopup
IpcHandler { IpcHandler {
property var appLauncherPanel
property var lockScreen
property IdleInhibitor idleInhibitor
property var notificationPopup
target: "globalIPC" target: "globalIPC"
function toggleIdleInhibitor(): void { function toggleIdleInhibitor(): void {
idleInhibitor.toggle() root.idleInhibitor.toggle()
} }
function toggleNotificationPopup(): void { function toggleNotificationPopup(): void {
console.log("[IPC] NotificationPopup toggle() called") console.log("[IPC] NotificationPopup toggle() called")
// Use the global toggle function from the notification manager // Use the global toggle function from the notification manager
notificationPopup.togglePopup(); root.notificationPopup.togglePopup();
} }
// Toggle Applauncher visibility // Toggle Applauncher visibility
function toggleLauncher(): void { function toggleLauncher(): void {
if (!appLauncherPanel) { if (!root.appLauncherPanel) {
console.warn("AppLauncherIpcHandler: appLauncherPanel not set!"); console.warn("AppLauncherIpcHandler: appLauncherPanel not set!");
return; return;
} }
if (appLauncherPanel.visible) { if (root.appLauncherPanel.visible) {
appLauncherPanel.hidePanel(); root.appLauncherPanel.hidePanel();
} else { } else {
console.log("[IPC] Applauncher show() called"); console.log("[IPC] Applauncher show() called");
appLauncherPanel.showAt(); root.appLauncherPanel.showAt();
} }
} }
// Toggle LockScreen // Toggle LockScreen
function toggleLock(): void { function toggleLock(): void {
if (!lockScreen) { if (!root.lockScreen) {
console.warn("LockScreenIpcHandler: lockScreen not set!"); console.warn("LockScreenIpcHandler: lockScreen not set!");
return; return;
} }
console.log("[IPC] LockScreen show() called"); console.log("[IPC] LockScreen show() called");
lockScreen.locked = true; root.lockScreen.locked = true;
} }
} }
}