sidebar doesn't reduce height when new notifs come in
This commit is contained in:
+19
-10
@@ -21,6 +21,15 @@ CustomWindow {
|
||||
readonly property real borderLayoutThickness: hasFullscreen ? 0 : Config.barConfig.border
|
||||
readonly property real borderRounding: Config.barConfig.rounding * (1 - fsTransitionProg)
|
||||
readonly property real borderThickness: Config.barConfig.border * (1 - fsTransitionProg)
|
||||
readonly property int dragMaskPadding: {
|
||||
if (focusGrab.active)
|
||||
return 0;
|
||||
|
||||
if (monitor?.lastIpcObject.specialWorkspace?.name || monitor?.activeWorkspace.lastIpcObject.windows > 0)
|
||||
return 0;
|
||||
|
||||
return 100;
|
||||
}
|
||||
property real fsTransitionProg: hasFullscreen ? 1 : 0
|
||||
readonly property bool hasFullscreen: {
|
||||
if (hasSpecialWorkspace) {
|
||||
@@ -102,12 +111,12 @@ CustomWindow {
|
||||
Region {
|
||||
id: region
|
||||
|
||||
height: root.height - bar.implicitHeight - Config.barConfig.border
|
||||
height: root.height - bar.implicitHeight - root.borderThickness - root.dragMaskPadding * 2
|
||||
intersection: Intersection.Xor
|
||||
regions: [...popoutRegions.instances, menuPopoutRegion]
|
||||
width: root.width - Config.barConfig.border * 2
|
||||
x: Config.barConfig.border
|
||||
y: bar.implicitHeight
|
||||
width: root.width - root.borderThickness * 2 - root.dragMaskPadding * 2
|
||||
x: root.borderThickness + root.dragMaskPadding
|
||||
y: bar.implicitHeight + root.dragMaskPadding
|
||||
}
|
||||
|
||||
anchors {
|
||||
@@ -128,7 +137,7 @@ CustomWindow {
|
||||
height: modelData.height
|
||||
intersection: Intersection.Subtract
|
||||
width: modelData.width
|
||||
x: modelData.x + Config.barConfig.border
|
||||
x: modelData.x + root.borderThickness
|
||||
y: modelData.y + bar.implicitHeight
|
||||
}
|
||||
}
|
||||
@@ -224,7 +233,7 @@ CustomWindow {
|
||||
implicitWidth: panels.dashboard.width
|
||||
panel: panels.dashboardWrapper
|
||||
radius: Appearance.rounding.normal
|
||||
x: panels.dashboardWrapper.x + panels.dashboard.x + Config.barConfig.border
|
||||
x: panels.dashboardWrapper.x + panels.dashboard.x + root.borderThickness
|
||||
y: panels.dashboardWrapper.y + panels.dashboard.y + bar.implicitHeight - panels.dashboard.height * extraHeight
|
||||
}
|
||||
|
||||
@@ -258,7 +267,7 @@ CustomWindow {
|
||||
implicitWidth: panels.osd.width
|
||||
panel: panels.osdWrapper
|
||||
radius: 20
|
||||
x: panels.osdWrapper.x + panels.osd.x + Config.barConfig.border
|
||||
x: panels.osdWrapper.x + panels.osd.x + root.borderThickness
|
||||
y: panels.osdWrapper.y + panels.osd.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
@@ -288,7 +297,7 @@ CustomWindow {
|
||||
implicitWidth: panels.popouts.width
|
||||
panel: panels.popoutsWrapper
|
||||
radius: panels.popouts.current?.panelRadius ?? Appearance.rounding.normal
|
||||
x: panels.popoutsWrapper.x + panels.popouts.x + Config.barConfig.border
|
||||
x: panels.popoutsWrapper.x + panels.popouts.x + root.borderThickness
|
||||
y: panels.popoutsWrapper.y + panels.popouts.y + bar.implicitHeight - panels.popouts.height * extraHeight
|
||||
|
||||
Behavior on extraHeight {
|
||||
@@ -305,7 +314,7 @@ CustomWindow {
|
||||
implicitWidth: panels.resources.width
|
||||
panel: panels.resourcesWrapper
|
||||
radius: Appearance.rounding.large
|
||||
x: panels.resourcesWrapper.x + panels.resources.x + Config.barConfig.border
|
||||
x: panels.resourcesWrapper.x + panels.resources.x + root.borderThickness
|
||||
y: panels.resourcesWrapper.y + panels.resources.y + bar.implicitHeight
|
||||
}
|
||||
|
||||
@@ -321,7 +330,7 @@ CustomWindow {
|
||||
radius: Appearance.rounding.large
|
||||
topLeftRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||
topRightRadius: Appearance.rounding.large + Appearance.padding.smaller
|
||||
x: panels.settingsWrapper.x + panels.settings.x + Config.barConfig.border
|
||||
x: panels.settingsWrapper.x + panels.settings.x + root.borderThickness
|
||||
y: panels.settingsWrapper.y + panels.settings.y + bar.implicitHeight - panels.settings.height * extraHeight
|
||||
}
|
||||
|
||||
|
||||
@@ -20,28 +20,26 @@ Item {
|
||||
if (count === 0)
|
||||
return 0;
|
||||
|
||||
let height = (count - 1) * 8;
|
||||
let height = (count - 1) * Appearance.spacing.small;
|
||||
for (let i = 0; i < count; i++)
|
||||
height += list.itemAtIndex(i)?.nonAnimHeight ?? 0;
|
||||
height += (list.itemAtIndex(i) as NotifWrapper)?.nonAnimHeight ?? 0;
|
||||
|
||||
if (visibilities && panels) {
|
||||
if (panels.popouts.hasCurrent && (panels.popouts.currentCenter + (panels.popouts.current?.width / 2)) > panels.notifications.x || visibilities.dashboard)
|
||||
return 0;
|
||||
if (panels.popouts.hasCurrent && (panels.popouts.currentCenter + (panels.popouts.current?.width / 2)) > panels.notifications.x || visibilities.dashboard || visibilities.sidebar)
|
||||
return 0;
|
||||
|
||||
if (visibilities.osd) {
|
||||
const h = panels.osd.y - 8 * 2 - padding * 2;
|
||||
if (height > h)
|
||||
height = h;
|
||||
}
|
||||
|
||||
if (visibilities.session) {
|
||||
const h = panels.session.y - 8 * 2 - padding * 2;
|
||||
if (height > h)
|
||||
height = h;
|
||||
}
|
||||
if (visibilities.osd) {
|
||||
const h = panels.osd.y - Appearance.spacing.small * 2 - padding * 2;
|
||||
if (height > h)
|
||||
height = h;
|
||||
}
|
||||
|
||||
return Math.min((QsWindow.window?.screen?.height ?? 0) - 1 * 2, height + padding * 2);
|
||||
if (visibilities.session) {
|
||||
const h = panels.session.y - Appearance.spacing.small * 2 - padding * 2;
|
||||
if (height > h)
|
||||
height = h;
|
||||
}
|
||||
|
||||
return Math.min(((QsWindow.window as QsWindow)?.screen?.height ?? 0) - 1 * 2, height + padding * 2);
|
||||
}
|
||||
implicitWidth: Config.notifs.sizes.width + padding * 2
|
||||
|
||||
@@ -60,83 +58,11 @@ Item {
|
||||
id: list
|
||||
|
||||
anchors.fill: parent
|
||||
cacheBuffer: QsWindow.window?.screen.height ?? 0
|
||||
cacheBuffer: (QsWindow.window as QsWindow)?.screen.height ?? 0
|
||||
orientation: Qt.Vertical
|
||||
spacing: 0
|
||||
|
||||
delegate: Item {
|
||||
id: wrapper
|
||||
|
||||
property int idx
|
||||
required property int index
|
||||
required property NotifServer.Notif modelData
|
||||
readonly property alias nonAnimHeight: notif.nonAnimHeight
|
||||
|
||||
implicitHeight: notif.implicitHeight + (idx === 0 ? 0 : Appearance.spacing.small)
|
||||
implicitWidth: notif.implicitWidth
|
||||
|
||||
ListView.onRemove: removeAnim.start()
|
||||
onIndexChanged: {
|
||||
if (index !== -1)
|
||||
idx = index;
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: removeAnim
|
||||
|
||||
PropertyAction {
|
||||
property: "ListView.delayRemove"
|
||||
target: wrapper
|
||||
value: true
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "enabled"
|
||||
target: wrapper
|
||||
value: false
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "implicitHeight"
|
||||
target: wrapper
|
||||
value: 0
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "z"
|
||||
target: wrapper
|
||||
value: 1
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
property: "x"
|
||||
target: notif
|
||||
to: (notif.x >= 0 ? Config.notifs.sizes.width : -Config.notifs.sizes.width) * 2
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "ListView.delayRemove"
|
||||
target: wrapper
|
||||
value: false
|
||||
}
|
||||
}
|
||||
|
||||
ClippingRectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: wrapper.idx === 0 ? 0 : 8
|
||||
color: "transparent"
|
||||
implicitHeight: notif.implicitHeight
|
||||
implicitWidth: notif.implicitWidth
|
||||
radius: Appearance.rounding.smallest / 2
|
||||
|
||||
Notification {
|
||||
id: notif
|
||||
|
||||
modelData: wrapper.modelData
|
||||
}
|
||||
}
|
||||
delegate: NotifWrapper {
|
||||
}
|
||||
displaced: Transition {
|
||||
Anim {
|
||||
@@ -158,4 +84,78 @@ Item {
|
||||
duration: Appearance.anim.durations.expressiveDefaultSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveDefaultSpatial
|
||||
}
|
||||
component NotifWrapper: Item {
|
||||
id: wrapper
|
||||
|
||||
property int idx
|
||||
required property int index
|
||||
required property NotifServer.Notif modelData
|
||||
readonly property alias nonAnimHeight: notif.nonAnimHeight
|
||||
|
||||
implicitHeight: notif.implicitHeight + (idx === 0 ? 0 : Appearance.spacing.small)
|
||||
implicitWidth: notif.implicitWidth
|
||||
|
||||
ListView.onRemove: removeAnim.start()
|
||||
onIndexChanged: {
|
||||
if (index !== -1)
|
||||
idx = index;
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: removeAnim
|
||||
|
||||
PropertyAction {
|
||||
property: "ListView.delayRemove"
|
||||
target: wrapper
|
||||
value: true
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "enabled"
|
||||
target: wrapper
|
||||
value: false
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "implicitHeight"
|
||||
target: wrapper
|
||||
value: 0
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "z"
|
||||
target: wrapper
|
||||
value: 1
|
||||
}
|
||||
|
||||
Anim {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
property: "x"
|
||||
target: notif
|
||||
to: (notif.x >= 0 ? Config.notifs.sizes.width : -Config.notifs.sizes.width) * 2
|
||||
}
|
||||
|
||||
PropertyAction {
|
||||
property: "ListView.delayRemove"
|
||||
target: wrapper
|
||||
value: false
|
||||
}
|
||||
}
|
||||
|
||||
ClippingRectangle {
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: wrapper.idx === 0 ? 0 : 8
|
||||
color: "transparent"
|
||||
implicitHeight: notif.implicitHeight
|
||||
implicitWidth: notif.implicitWidth
|
||||
radius: Appearance.rounding.smallest / 2
|
||||
|
||||
Notification {
|
||||
id: notif
|
||||
|
||||
modelData: wrapper.modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ Item {
|
||||
id: layout
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: 8
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
CustomRect {
|
||||
Layout.fillHeight: true
|
||||
@@ -29,7 +29,7 @@ Item {
|
||||
|
||||
CustomRect {
|
||||
Layout.fillWidth: true
|
||||
Layout.topMargin: 8 - layout.spacing
|
||||
Layout.topMargin: Appearance.padding.normal - layout.spacing
|
||||
color: DynamicColors.tPalette.m3outlineVariant
|
||||
implicitHeight: 1
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ Item {
|
||||
required property var visibilities
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
anchors.margins: Appearance.padding.normal
|
||||
|
||||
Component.onCompleted: NotifServer.list.forEach(n => n.popup = false)
|
||||
|
||||
@@ -156,7 +156,7 @@ Item {
|
||||
Loader {
|
||||
active: opacity > 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.margins: 8
|
||||
anchors.margins: Appearance.padding.normal
|
||||
anchors.right: parent.right
|
||||
opacity: root.notifCount > 0 ? 1 : 0
|
||||
scale: root.notifCount > 0 ? 1 : 0.5
|
||||
|
||||
@@ -10,7 +10,7 @@ Item {
|
||||
required property var visibilities
|
||||
|
||||
implicitHeight: content.implicitHeight
|
||||
implicitWidth: Math.max(sidebarPanel.width * (1 - sidebarPanel.offsetScale), content.implicitWidth)
|
||||
implicitWidth: content.implicitWidth
|
||||
visible: height > 0
|
||||
|
||||
Content {
|
||||
|
||||
Reference in New Issue
Block a user