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