mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
@@ -3,3 +3,4 @@
|
||||
- Added clipboard and clipboard history integration
|
||||
- Added swipe to dismiss notification popups and from center
|
||||
- Added paste from clipboard history view - requires wtype
|
||||
- Optimize surface damage of OSD & Toast
|
||||
|
||||
@@ -16,6 +16,10 @@ PanelWindow {
|
||||
property real frozenWidth: 0
|
||||
readonly property string copiedText: I18n.tr("Copied!")
|
||||
|
||||
readonly property real dpr: modelData ? CompositorService.getScreenScale(modelData) : 1
|
||||
readonly property real shadowBuffer: 5
|
||||
readonly property real toastY: Theme.barHeight - 4 + (SettingsData.barConfigs[0]?.spacing ?? 4) + 2
|
||||
|
||||
Connections {
|
||||
target: ToastService
|
||||
function onToastVisibleChanged() {
|
||||
@@ -23,7 +27,6 @@ PanelWindow {
|
||||
shouldBeVisible = true;
|
||||
visible = true;
|
||||
} else {
|
||||
// Freeze the width before starting exit animation
|
||||
frozenWidth = toast.width;
|
||||
shouldBeVisible = false;
|
||||
closeTimer.restart();
|
||||
@@ -48,13 +51,22 @@ PanelWindow {
|
||||
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
||||
color: "transparent"
|
||||
|
||||
readonly property real toastWidth: shouldBeVisible ? Math.min(900, messageText.implicitWidth + statusIcon.width + Theme.spacingM + (ToastService.hasDetails ? (expandButton.width + closeButton.width + 4) : (ToastService.currentLevel === ToastService.levelError ? closeButton.width + Theme.spacingS : 0)) + Theme.spacingL * 2 + Theme.spacingM * 2) : frozenWidth
|
||||
readonly property real toastHeight: toastContent.height + Theme.spacingL * 2
|
||||
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
bottom: true
|
||||
}
|
||||
|
||||
WlrLayershell.margins {
|
||||
left: Math.max(0, Theme.snap((modelData?.width ?? 1920) / 2 - toastWidth / 2 - shadowBuffer, dpr))
|
||||
top: Math.max(0, Theme.snap(toastY - shadowBuffer, dpr))
|
||||
}
|
||||
|
||||
implicitWidth: toastWidth + (shadowBuffer * 2)
|
||||
implicitHeight: toastHeight + (shadowBuffer * 2)
|
||||
|
||||
Rectangle {
|
||||
id: toast
|
||||
|
||||
@@ -67,10 +79,10 @@ PanelWindow {
|
||||
}
|
||||
}
|
||||
|
||||
width: shouldBeVisible ? Math.min(900, messageText.implicitWidth + statusIcon.width + Theme.spacingM + (ToastService.hasDetails ? (expandButton.width + closeButton.width + 4) : (ToastService.currentLevel === ToastService.levelError ? closeButton.width + Theme.spacingS : 0)) + Theme.spacingL * 2 + Theme.spacingM * 2) : frozenWidth
|
||||
height: toastContent.height + Theme.spacingL * 2
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
y: Theme.barHeight - 4 + (SettingsData.barConfigs[0]?.spacing ?? 4) + 2
|
||||
x: shadowBuffer
|
||||
y: shadowBuffer
|
||||
width: root.toastWidth
|
||||
height: root.toastHeight
|
||||
color: {
|
||||
switch (ToastService.currentLevel) {
|
||||
case ToastService.levelError:
|
||||
|
||||
@@ -74,6 +74,7 @@ PanelWindow {
|
||||
readonly property real dpr: CompositorService.getScreenScale(screen)
|
||||
readonly property real screenWidth: screen.width
|
||||
readonly property real screenHeight: screen.height
|
||||
readonly property real shadowBuffer: 5
|
||||
readonly property real alignedWidth: Theme.px(osdWidth, dpr)
|
||||
readonly property real alignedHeight: Theme.px(osdHeight, dpr)
|
||||
|
||||
@@ -172,10 +173,16 @@ PanelWindow {
|
||||
anchors {
|
||||
top: true
|
||||
left: true
|
||||
right: true
|
||||
bottom: true
|
||||
}
|
||||
|
||||
WlrLayershell.margins {
|
||||
left: Math.max(0, Theme.snap(alignedX - shadowBuffer, dpr))
|
||||
top: Math.max(0, Theme.snap(alignedY - shadowBuffer, dpr))
|
||||
}
|
||||
|
||||
implicitWidth: alignedWidth + (shadowBuffer * 2)
|
||||
implicitHeight: alignedHeight + (shadowBuffer * 2)
|
||||
|
||||
Timer {
|
||||
id: hideTimer
|
||||
|
||||
@@ -203,8 +210,8 @@ PanelWindow {
|
||||
|
||||
Item {
|
||||
id: osdContainer
|
||||
x: alignedX
|
||||
y: alignedY
|
||||
x: shadowBuffer
|
||||
y: shadowBuffer
|
||||
width: alignedWidth
|
||||
height: alignedHeight
|
||||
opacity: shouldBeVisible ? 1 : 0
|
||||
|
||||
Reference in New Issue
Block a user