mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-07 22:15:38 -05:00
Fix OSDs disappearing and toast exit anim
This commit is contained in:
@@ -24,10 +24,6 @@ DankOSD {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetHideTimer() {
|
|
||||||
if (root.shouldBeVisible)
|
|
||||||
root.hideTimer.restart()
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: BrightnessService
|
target: BrightnessService
|
||||||
@@ -92,10 +88,14 @@ DankOSD {
|
|||||||
if (BrightnessService.brightnessAvailable) {
|
if (BrightnessService.brightnessAvailable) {
|
||||||
root.brightnessDebounceTimer.pendingValue = newValue
|
root.brightnessDebounceTimer.pendingValue = newValue
|
||||||
root.brightnessDebounceTimer.restart()
|
root.brightnessDebounceTimer.restart()
|
||||||
root.resetHideTimer()
|
resetHideTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
setChildHovered(containsMouse)
|
||||||
|
}
|
||||||
|
|
||||||
onSliderDragFinished: function(finalValue) {
|
onSliderDragFinished: function(finalValue) {
|
||||||
if (BrightnessService.brightnessAvailable) {
|
if (BrightnessService.brightnessAvailable) {
|
||||||
root.brightnessDebounceTimer.stop()
|
root.brightnessDebounceTimer.stop()
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ DankOSD {
|
|||||||
autoHideInterval: 3000
|
autoHideInterval: 3000
|
||||||
enableMouseInteraction: true
|
enableMouseInteraction: true
|
||||||
|
|
||||||
function resetHideTimer() {
|
|
||||||
if (root.shouldBeVisible)
|
|
||||||
root.hideTimer.restart()
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: AudioService
|
target: AudioService
|
||||||
@@ -62,7 +58,10 @@ DankOSD {
|
|||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
AudioService.toggleMute()
|
AudioService.toggleMute()
|
||||||
root.resetHideTimer()
|
resetHideTimer()
|
||||||
|
}
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
setChildHovered(containsMouse || volumeSlider.containsMouse)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,10 +87,14 @@ DankOSD {
|
|||||||
onSliderValueChanged: function(newValue) {
|
onSliderValueChanged: function(newValue) {
|
||||||
if (AudioService.sink && AudioService.sink.audio) {
|
if (AudioService.sink && AudioService.sink.audio) {
|
||||||
AudioService.sink.audio.volume = newValue / 100
|
AudioService.sink.audio.volume = newValue / 100
|
||||||
root.resetHideTimer()
|
resetHideTimer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
setChildHovered(containsMouse || muteButton.containsMouse)
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
|
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,36 @@ PanelWindow {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var modelData
|
property var modelData
|
||||||
|
property bool shouldBeVisible: false
|
||||||
|
property real frozenWidth: 0
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ToastService
|
||||||
|
function onToastVisibleChanged() {
|
||||||
|
if (ToastService.toastVisible) {
|
||||||
|
shouldBeVisible = true
|
||||||
|
visible = true
|
||||||
|
} else {
|
||||||
|
// Freeze the width before starting exit animation
|
||||||
|
frozenWidth = toast.width
|
||||||
|
shouldBeVisible = false
|
||||||
|
closeTimer.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: closeTimer
|
||||||
|
interval: Theme.mediumDuration + 50
|
||||||
|
onTriggered: {
|
||||||
|
if (!shouldBeVisible) {
|
||||||
|
visible = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
visible: ToastService.toastVisible
|
visible: shouldBeVisible
|
||||||
WlrLayershell.layer: WlrLayershell.Overlay
|
WlrLayershell.layer: WlrLayershell.Overlay
|
||||||
WlrLayershell.exclusiveZone: -1
|
WlrLayershell.exclusiveZone: -1
|
||||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||||
@@ -39,8 +66,9 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
width: ToastService.hasDetails ? 380 : messageText.implicitWidth + Theme.iconSize
|
width: shouldBeVisible ?
|
||||||
+ Theme.spacingM * 3 + Theme.spacingL * 2
|
(ToastService.hasDetails ? 380 : messageText.implicitWidth + Theme.iconSize + Theme.spacingM * 3 + Theme.spacingL * 2) :
|
||||||
|
frozenWidth
|
||||||
height: toastContent.height + Theme.spacingL * 2
|
height: toastContent.height + Theme.spacingL * 2
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
y: Theme.barHeight - 4 + SettingsData.topBarSpacing + 2
|
y: Theme.barHeight - 4 + SettingsData.topBarSpacing + 2
|
||||||
@@ -58,7 +86,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
radius: Theme.cornerRadius
|
radius: Theme.cornerRadius
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
opacity: ToastService.toastVisible ? 0.9 : 0
|
opacity: shouldBeVisible ? 0.9 : 0
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: toastContent
|
id: toastContent
|
||||||
@@ -228,9 +256,6 @@ PanelWindow {
|
|||||||
shadowOpacity: 0.3
|
shadowOpacity: 0.3
|
||||||
}
|
}
|
||||||
|
|
||||||
transform: Translate {
|
|
||||||
y: ToastService.toastVisible ? 0 : -20
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on opacity {
|
Behavior on opacity {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
@@ -247,11 +272,7 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Behavior on height {
|
Behavior on height {
|
||||||
enabled: ToastService.toastVisible
|
enabled: false
|
||||||
NumberAnimation {
|
|
||||||
duration: Anims.durShort
|
|
||||||
easing.type: Easing.Linear
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Behavior on width {
|
Behavior on width {
|
||||||
|
|||||||
@@ -35,8 +35,34 @@ PanelWindow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetHideTimer() {
|
function resetHideTimer() {
|
||||||
if (shouldBeVisible && enableMouseInteraction)
|
if (shouldBeVisible && enableMouseInteraction) {
|
||||||
hideTimer.restart()
|
// Only restart timer if we're not currently hovering
|
||||||
|
let isHovered = (enableMouseInteraction && mouseArea.containsMouse) || osdContainer.childHovered
|
||||||
|
if (!isHovered) {
|
||||||
|
hideTimer.restart()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopHideTimer() {
|
||||||
|
if (enableMouseInteraction)
|
||||||
|
hideTimer.stop()
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateHoverState() {
|
||||||
|
let isHovered = (enableMouseInteraction && mouseArea.containsMouse) || osdContainer.childHovered
|
||||||
|
if (enableMouseInteraction) {
|
||||||
|
if (isHovered) {
|
||||||
|
stopHideTimer()
|
||||||
|
} else if (shouldBeVisible) {
|
||||||
|
resetHideTimer()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setChildHovered(hovered) {
|
||||||
|
osdContainer.childHovered = hovered
|
||||||
|
updateHoverState()
|
||||||
}
|
}
|
||||||
|
|
||||||
screen: modelData
|
screen: modelData
|
||||||
@@ -82,6 +108,7 @@ PanelWindow {
|
|||||||
id: osdContainer
|
id: osdContainer
|
||||||
|
|
||||||
property bool containsMouse: enableMouseInteraction && mouseArea.containsMouse
|
property bool containsMouse: enableMouseInteraction && mouseArea.containsMouse
|
||||||
|
property bool childHovered: false
|
||||||
|
|
||||||
width: osdWidth
|
width: osdWidth
|
||||||
height: osdHeight
|
height: osdHeight
|
||||||
@@ -103,6 +130,14 @@ PanelWindow {
|
|||||||
acceptedButtons: Qt.NoButton
|
acceptedButtons: Qt.NoButton
|
||||||
propagateComposedEvents: true
|
propagateComposedEvents: true
|
||||||
z: -1
|
z: -1
|
||||||
|
|
||||||
|
onContainsMouseChanged: {
|
||||||
|
updateHoverState()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onChildHoveredChanged: {
|
||||||
|
root.updateHoverState()
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Item {
|
|||||||
property string unit: "%"
|
property string unit: "%"
|
||||||
property bool showValue: true
|
property bool showValue: true
|
||||||
property bool isDragging: false
|
property bool isDragging: false
|
||||||
|
readonly property bool containsMouse: sliderMouseArea.containsMouse
|
||||||
|
|
||||||
signal sliderValueChanged(int newValue)
|
signal sliderValueChanged(int newValue)
|
||||||
signal sliderDragFinished(int finalValue)
|
signal sliderDragFinished(int finalValue)
|
||||||
|
|||||||
Reference in New Issue
Block a user