From 05c807b7cd87f29dc8c26f8a33cabcaa07d9c823 Mon Sep 17 00:00:00 2001 From: Timofey Date: Mon, 14 Sep 2026 23:31:40 +0500 Subject: [PATCH] hyprland: use focusedMonitor instead of focusedWorkspace.monitor (#3424) Hyprland's workspace refactor (hyprwm/Hyprland#16140) broke Hyprland.focusedWorkspace.monitor as a way to find the focused screen (quickshell-mirror/quickshell#1119). Quickshell already exposes Hyprland.focusedMonitor directly, so read the monitor from there --- quickshell/DMSShellIPC.qml | 4 ++-- quickshell/Modules/DankBar/DankBar.qml | 8 ++++---- quickshell/Modules/DankBar/Widgets/NotepadButton.qml | 2 +- quickshell/Services/BarWidgetService.qml | 4 ++-- quickshell/Services/CompositorService.qml | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/quickshell/DMSShellIPC.qml b/quickshell/DMSShellIPC.qml index f4322c2ce..fbe2c37b2 100644 --- a/quickshell/DMSShellIPC.qml +++ b/quickshell/DMSShellIPC.qml @@ -420,8 +420,8 @@ Item { IpcHandler { function getFocusedScreenName() { - if (CompositorService.isHyprland && Hyprland.focusedWorkspace && Hyprland.focusedWorkspace.monitor) { - return Hyprland.focusedWorkspace.monitor.name; + if (CompositorService.isHyprland && Hyprland.focusedMonitor) { + return Hyprland.focusedMonitor.name; } if (CompositorService.isNiri && NiriService.currentOutput) { return NiriService.currentOutput; diff --git a/quickshell/Modules/DankBar/DankBar.qml b/quickshell/Modules/DankBar/DankBar.qml index c08462c99..ba13ba51a 100644 --- a/quickshell/Modules/DankBar/DankBar.qml +++ b/quickshell/Modules/DankBar/DankBar.qml @@ -103,8 +103,8 @@ Item { function triggerControlCenterOnFocusedScreen() { let focusedScreenName = ""; - if (CompositorService.isHyprland && Hyprland.focusedWorkspace && Hyprland.focusedWorkspace.monitor) { - focusedScreenName = Hyprland.focusedWorkspace.monitor.name; + if (CompositorService.isHyprland && Hyprland.focusedMonitor) { + focusedScreenName = Hyprland.focusedMonitor.name; } else if (CompositorService.isNiri && NiriService.currentOutput) { focusedScreenName = NiriService.currentOutput; } else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) { @@ -132,8 +132,8 @@ Item { function triggerWallpaperBrowserOnFocusedScreen() { let focusedScreenName = ""; - if (CompositorService.isHyprland && Hyprland.focusedWorkspace && Hyprland.focusedWorkspace.monitor) { - focusedScreenName = Hyprland.focusedWorkspace.monitor.name; + if (CompositorService.isHyprland && Hyprland.focusedMonitor) { + focusedScreenName = Hyprland.focusedMonitor.name; } else if (CompositorService.isNiri && NiriService.currentOutput) { focusedScreenName = NiriService.currentOutput; } else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) { diff --git a/quickshell/Modules/DankBar/Widgets/NotepadButton.qml b/quickshell/Modules/DankBar/Widgets/NotepadButton.qml index 46c3ca921..217bc64b4 100644 --- a/quickshell/Modules/DankBar/Widgets/NotepadButton.qml +++ b/quickshell/Modules/DankBar/Widgets/NotepadButton.qml @@ -10,7 +10,7 @@ import qs.Widgets BasePill { id: root - readonly property string focusedScreenName: (CompositorService.isHyprland && typeof Hyprland !== "undefined" && Hyprland.focusedWorkspace && Hyprland.focusedWorkspace.monitor ? (Hyprland.focusedWorkspace.monitor.name || "") : CompositorService.isNiri && typeof NiriService !== "undefined" && NiriService.currentOutput ? NiriService.currentOutput : "") + readonly property string focusedScreenName: (CompositorService.isHyprland && typeof Hyprland !== "undefined" && Hyprland.focusedMonitor ? (Hyprland.focusedMonitor.name || "") : CompositorService.isNiri && typeof NiriService !== "undefined" && NiriService.currentOutput ? NiriService.currentOutput : "") readonly property string targetScreenName: parentScreen?.name || focusedScreenName function resolveNotepadInstance() { diff --git a/quickshell/Services/BarWidgetService.qml b/quickshell/Services/BarWidgetService.qml index 55cee3ada..31a3067ef 100644 --- a/quickshell/Services/BarWidgetService.qml +++ b/quickshell/Services/BarWidgetService.qml @@ -140,8 +140,8 @@ Singleton { function getFocusedScreenName() { if (CompositorService.isAqueous && AqueousService.available) return AqueousService.focusedOutput; - if (CompositorService.isHyprland && Hyprland.focusedWorkspace?.monitor) - return Hyprland.focusedWorkspace.monitor.name; + if (CompositorService.isHyprland && Hyprland.focusedMonitor) + return Hyprland.focusedMonitor.name; if (CompositorService.isNiri && NiriService.currentOutput) return NiriService.currentOutput; if (CompositorService.isMango && MangoService.activeOutput) diff --git a/quickshell/Services/CompositorService.qml b/quickshell/Services/CompositorService.qml index ba80c1fb8..d6f6cdd82 100644 --- a/quickshell/Services/CompositorService.qml +++ b/quickshell/Services/CompositorService.qml @@ -202,8 +202,8 @@ Singleton { let screenName = ""; if (isAqueous && AqueousService.available) screenName = AqueousService.focusedOutput; - else if (isHyprland && Hyprland.focusedWorkspace?.monitor) - screenName = Hyprland.focusedWorkspace.monitor.name; + else if (isHyprland && Hyprland.focusedMonitor) + screenName = Hyprland.focusedMonitor.name; else if (isNiri && NiriService.currentOutput) screenName = NiriService.currentOutput; else if (isSway || isScroll || isMiracle) {