import QtQuick import Quickshell import Quickshell.Wayland import Quickshell.Widgets import qs.data PanelWindow { id: root property string namespace: "modal" default property alias content: wrapper.data // the Surface this is the window of: dismissing the modal closes it property string surface: "" signal dismissed() Connections { target: root function onDismissed(): void { if (root.surface !== "") Surfaces.close(root.surface); } } color: "transparent" anchors { top: true; bottom: true; left: true; right: true } exclusionMode: ExclusionMode.Ignore WlrLayershell.layer: WlrLayer.Overlay WlrLayershell.namespace: namespace WlrLayershell.keyboardFocus: WlrKeyboardFocus.Exclusive Rectangle { anchors.fill: parent color: Theme.colors.scrim opacity: holder.opacity MouseArea { anchors.fill: parent; onClicked: root.dismissed() } } FocusScope { id: holder anchors.centerIn: parent implicitWidth: wrapper.implicitWidth implicitHeight: wrapper.implicitHeight width: implicitWidth height: implicitHeight focus: true Keys.onEscapePressed: root.dismissed() opacity: 0 scale: 0.96 Component.onCompleted: { opacity = 1; scale = 1; } Behavior on opacity { Anim {} } Behavior on scale { Anim {} } WrapperMouseArea { id: wrapper anchors.fill: parent } } }