mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-28 14:05:21 -04:00
feat(HoverMode): implement hover popout & launcher functionality in all modes
- New Hover toggle found in DankBar Settings - New Hover to Reveal Launcher in FrameTab Settings
This commit is contained in:
@@ -13,6 +13,8 @@ PanelWindow {
|
||||
WlrLayershell.namespace: layerNamespace
|
||||
|
||||
property bool isVisible: false
|
||||
property bool hoverDismissEnabled: false
|
||||
property bool hoverDismissSuspended: false
|
||||
property var targetScreen: null
|
||||
property var modelData: null
|
||||
property bool triggerUsesOverlayLayer: false
|
||||
@@ -25,6 +27,7 @@ PanelWindow {
|
||||
property real edgeGap: 0
|
||||
property string slideEdge: "right"
|
||||
readonly property bool slideFromLeft: slideEdge === "left"
|
||||
readonly property real surfaceOriginX: slideFromLeft ? 0 : Math.max(0, (modelData?.width ?? width) - width)
|
||||
property Component content: null
|
||||
property string title: ""
|
||||
property alias container: contentContainer
|
||||
@@ -46,6 +49,27 @@ PanelWindow {
|
||||
isVisible = false;
|
||||
}
|
||||
|
||||
function hideFromHoverDismiss() {
|
||||
if (hoverDismissSuspended)
|
||||
return;
|
||||
hoverDismissEnabled = false;
|
||||
slideAnimation.duration = Math.round(Theme.expressiveDurations.expressiveDefaultSpatial);
|
||||
hide();
|
||||
}
|
||||
|
||||
function cancelHoverDismiss() {
|
||||
hoverDismissTracker.cancelPending();
|
||||
}
|
||||
|
||||
function containsGlobalPoint(gx, gy) {
|
||||
if (!isVisible || !modelData)
|
||||
return false;
|
||||
const padding = 24;
|
||||
const topLeft = slideContainer.mapToItem(null, 0, 0);
|
||||
const globalX = surfaceOriginX + topLeft.x;
|
||||
return gx >= globalX - padding && gx < globalX + slideContainer.width + padding && gy >= topLeft.y - padding && gy < topLeft.y + slideContainer.height + padding;
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
if (isVisible) {
|
||||
hide();
|
||||
@@ -67,6 +91,17 @@ PanelWindow {
|
||||
|
||||
color: "transparent"
|
||||
|
||||
HoverDismissTracker {
|
||||
id: hoverDismissTracker
|
||||
parent: root.contentItem
|
||||
enabled: root.hoverDismissEnabled && !root.hoverDismissSuspended && root.isVisible
|
||||
shouldDismiss: function () {
|
||||
return !PopoutManager.cursorOverBar(PopoutManager.hoverCursorGlobalX, PopoutManager.hoverCursorGlobalY);
|
||||
}
|
||||
onDismissRequested: root.hideFromHoverDismiss()
|
||||
onHoverMoved: (sceneX, sceneY) => PopoutManager.updateHoverCursor(root.surfaceOriginX + sceneX, sceneY)
|
||||
}
|
||||
|
||||
readonly property bool slideoutBlurActive: root.visible && BlurService.enabled && Theme.connectedSurfaceBlurEnabled
|
||||
|
||||
WlrLayershell.layer: (!suppressOverlayLayer && (triggerUsesOverlayLayer || CompositorService.framePeerSurfacesUseOverlayForScreen(modelData))) ? WlrLayershell.Overlay : WlrLayershell.Top
|
||||
@@ -117,8 +152,10 @@ PanelWindow {
|
||||
easing.type: Easing.OutCubic
|
||||
|
||||
onRunningChanged: {
|
||||
if (!running && !root.isVisible) {
|
||||
root.mappedVisible = false;
|
||||
if (!running) {
|
||||
if (!root.isVisible)
|
||||
root.mappedVisible = false;
|
||||
slideAnimation.duration = 450;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user