1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-28 23:42:51 -05:00

notifications: try to prevent zombies better, markdown, re-org

This commit is contained in:
bbedward
2025-07-26 16:08:58 -04:00
parent 484a947127
commit 01a94a17de
22 changed files with 684 additions and 350 deletions

View File

@@ -12,6 +12,17 @@ PanelWindow {
property bool volumePopupVisible: false
function show() {
root.volumePopupVisible = true;
hideTimer.restart();
}
function resetHideTimer() {
if (root.volumePopupVisible)
hideTimer.restart();
}
visible: volumePopupVisible
WlrLayershell.layer: WlrLayershell.Overlay
WlrLayershell.exclusiveZone: -1
@@ -27,40 +38,30 @@ PanelWindow {
Timer {
id: hideTimer
interval: 3000
repeat: false
onTriggered: {
if (!volumePopup.containsMouse) {
root.volumePopupVisible = false
} else {
hideTimer.restart()
}
}
}
function show() {
root.volumePopupVisible = true;
hideTimer.restart();
}
function resetHideTimer() {
if (root.volumePopupVisible) {
hideTimer.restart();
if (!volumePopup.containsMouse)
root.volumePopupVisible = false;
else
hideTimer.restart();
}
}
Connections {
target: AudioService
function onVolumeChanged() {
root.show();
}
function onSinkChanged() {
if (root.volumePopupVisible) {
root.show();
}
}
}
function onSinkChanged() {
if (root.volumePopupVisible)
root.show();
}
target: AudioService
}
Rectangle {
id: volumePopup
@@ -72,28 +73,27 @@ PanelWindow {
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.spacingM
color: Theme.popupBackground()
radius: Theme.cornerRadiusLarge
border.color: Qt.rgba(Theme.outline.r, Theme.outline.g, Theme.outline.b, 0.08)
border.width: 1
opacity: root.volumePopupVisible ? 1 : 0
scale: root.volumePopupVisible ? 1 : 0.9
layer.enabled: true
Column {
id: volumeContent
anchors.centerIn: parent
width: parent.width - Theme.spacingS * 2
spacing: Theme.spacingXS
Item {
property int gap: Theme.spacingS
width: parent.width
height: 40
property int gap: Theme.spacingS
Rectangle {
width: Theme.iconSize
height: Theme.iconSize
@@ -104,14 +104,14 @@ PanelWindow {
DankIcon {
anchors.centerIn: parent
name: AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted ?
"volume_off" : "volume_up"
name: AudioService.sink && AudioService.sink.audio && AudioService.sink.audio.muted ? "volume_off" : "volume_up"
size: Theme.iconSize
color: muteButton.containsMouse ? Theme.primary : Theme.surfaceText
}
MouseArea {
id: muteButton
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
@@ -120,10 +120,12 @@ PanelWindow {
root.resetHideTimer();
}
}
}
DankSlider {
id: volumeSlider
width: parent.width - Theme.iconSize - parent.gap * 3
height: 40
x: parent.gap * 2 + Theme.iconSize
@@ -133,33 +135,35 @@ PanelWindow {
enabled: AudioService.sink && AudioService.sink.audio
showValue: true
unit: "%"
Connections {
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
function onVolumeChanged() {
volumeSlider.value = Math.round(AudioService.sink.audio.volume * 100);
}
}
Component.onCompleted: {
if (AudioService.sink && AudioService.sink.audio) {
if (AudioService.sink && AudioService.sink.audio)
value = Math.round(AudioService.sink.audio.volume * 100);
}
}
onSliderValueChanged: function(newValue) {
if (AudioService.sink && AudioService.sink.audio) {
AudioService.sink.audio.volume = newValue / 100;
root.resetHideTimer();
}
}
Connections {
function onVolumeChanged() {
volumeSlider.value = Math.round(AudioService.sink.audio.volume * 100);
}
target: AudioService.sink && AudioService.sink.audio ? AudioService.sink.audio : null
}
}
}
}
MouseArea {
id: popupMouseArea
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
@@ -167,7 +171,6 @@ PanelWindow {
z: -1
}
layer.enabled: true
layer.effect: MultiEffect {
shadowEnabled: true
shadowHorizontalOffset: 0
@@ -186,6 +189,7 @@ PanelWindow {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on scale {
@@ -193,6 +197,7 @@ PanelWindow {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on transform {
@@ -200,10 +205,13 @@ PanelWindow {
duration: Theme.mediumDuration
easing.type: Theme.emphasizedEasing
}
}
}
mask: Region {
item: volumePopup
}
}
}