1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-05-03 02:52:07 -04:00

fix(DankSlideout): Improve visibility handling and state management

This commit is contained in:
purian23
2026-05-02 20:27:28 -04:00
parent 57f56dae1f
commit fa2c8c638d

View File

@@ -1,3 +1,4 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Controls
import Quickshell
@@ -6,8 +7,6 @@ import qs.Common
import qs.Services
import qs.Widgets
pragma ComponentBehavior: Bound
PanelWindow {
id: root
@@ -25,27 +24,28 @@ PanelWindow {
property string title: ""
property alias container: contentContainer
property real customTransparency: -1
property bool mappedVisible: false
signal aboutToHide
function show() {
visible = true
isVisible = true
mappedVisible = true;
Qt.callLater(() => { isVisible = true; });
}
function hide() {
aboutToHide()
isVisible = false
aboutToHide();
isVisible = false;
}
function toggle() {
if (isVisible) {
hide()
hide();
} else {
show()
show();
}
}
visible: isVisible
visible: root.mappedVisible
screen: modelData
anchors.top: true
@@ -83,15 +83,15 @@ PanelWindow {
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.right: parent.right
width: alignedWidth
height: alignedHeight
width: root.alignedWidth
height: root.alignedHeight
property real slideOffset: alignedWidth
property real slideOffset: root.alignedWidth
Connections {
target: root
function onIsVisibleChanged() {
slideContainer.slideOffset = root.isVisible ? 0 : slideContainer.width
slideContainer.slideOffset = root.isVisible ? 0 : slideContainer.width;
}
}
@@ -102,8 +102,8 @@ PanelWindow {
easing.type: Easing.OutCubic
onRunningChanged: {
if (!running && !isVisible) {
root.visible = false
if (!running && !root.isVisible) {
root.mappedVisible = false;
}
}
}
@@ -125,7 +125,7 @@ PanelWindow {
layer.textureSize: Qt.size(width * root.dpr, height * root.dpr)
opacity: 1
readonly property real effectiveTransparency: customTransparency >= 0 ? customTransparency : SettingsData.popupTransparency
readonly property real effectiveTransparency: root.customTransparency >= 0 ? root.customTransparency : SettingsData.popupTransparency
anchors.top: parent.top
anchors.bottom: parent.bottom