Files
quickshell/modules/background/Background.qml
T
2026-07-03 17:59:14 +02:00

44 lines
1.3 KiB
QML

import QtQuick
import Quickshell
import Quickshell.Wayland
Variants {
id: root
// Automatically generates a trap for every connected monitor
model: Quickshell.screens
delegate: PanelWindow {
screen: modelData
// Force the panel window to take up the full screen real estate
anchors.top: true
anchors.bottom: true
anchors.left: true
anchors.right: true
// Push it to the background layer below normal windows
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.namespace: "transparent-focus-trap"
// Keep it transparent so your current wallpaper shows right through
color: "transparent"
// The core trap mechanism
MouseArea {
anchors.fill: parent
hoverEnabled: true
// Having an active hover area on the background layer forces the
// Wayland compositor to shift cursor target focus to this surface
// the exact millisecond your mouse exits a tiled/floating window.
onEntered: {
console.log("DEBUG: Mouse entered background (Focus Trap Active)");
}
onExited: {
console.log("DEBUG: Mouse left background (Focusing on Window)");
}
}
}
}