diff --git a/Modules/Bar/Widgets/WallpaperSelector.qml b/Modules/Bar/Widgets/WallpaperSelector.qml index 61c9e66c..eb23970f 100644 --- a/Modules/Bar/Widgets/WallpaperSelector.qml +++ b/Modules/Bar/Widgets/WallpaperSelector.qml @@ -20,7 +20,7 @@ NIconButton { colorFg: Color.mOnSurface colorBorder: Color.transparent colorBorderHover: Color.transparent - onClicked: { + onClicked: { var wallpaperPanel = PanelService.getPanel("wallpaperPanel", screen) if (Settings.data.wallpaper.panelPosition === "follow_bar") { wallpaperPanel?.toggle(this) diff --git a/Modules/MainScreen/MainScreen.qml b/Modules/MainScreen/MainScreen.qml index cc37a7db..3187ebc7 100644 --- a/Modules/MainScreen/MainScreen.qml +++ b/Modules/MainScreen/MainScreen.qml @@ -2,7 +2,9 @@ import QtQuick import QtQuick.Effects import Quickshell import Quickshell.Wayland + import qs.Commons +import qs.Services.Compositor import qs.Services.UI import "Backgrounds" as Backgrounds @@ -50,14 +52,21 @@ PanelWindow { } // Wayland - // Always use Exclusive keyboard focus when a panel is open - // This ensures all keyboard shortcuts work reliably (Escape, etc.) - // The centralized shortcuts in this window handle delegation to panels - WlrLayershell.keyboardFocus: root.isPanelOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None WlrLayershell.layer: WlrLayer.Top WlrLayershell.namespace: "noctalia-screen-" + (screen?.name || "unknown") WlrLayershell.exclusionMode: ExclusionMode.Ignore // Don't reserve space - BarExclusionZone handles that + // Different compositor handle the keyboard focus differently (inc. mouse) + // This ensures all keyboard shortcuts work reliably (Escape, etc.) + // Also ensures that the launcher get proper focus on launch. + WlrLayershell.keyboardFocus: { + if (CompositorService.isNiri) { + return root.isPanelOpen ? WlrKeyboardFocus.Exclusive : WlrKeyboardFocus.None + } else { + return root.isPanelOpen ? WlrKeyboardFocus.OnDemand : WlrKeyboardFocus.None + } + } + anchors { top: true bottom: true