notifs: better height
Get blocked by other panels from the right side (osd and session) Limit max height to screen height
This commit is contained in:
parent
daf92f36e1
commit
f305c3f3f6
4 changed files with 29 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import "root:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import "root:/modules/osd" as Osd
|
import "root:/modules/osd" as Osd
|
||||||
import "root:/modules/notifications" as Notifications
|
import "root:/modules/notifications" as Notifications
|
||||||
|
|
@ -22,6 +23,8 @@ Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: BorderConfig.thickness
|
anchors.margins: BorderConfig.thickness
|
||||||
|
|
||||||
|
Component.onCompleted: Visibilities.panels[screen] = this
|
||||||
|
|
||||||
Osd.Wrapper {
|
Osd.Wrapper {
|
||||||
id: osd
|
id: osd
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ Item {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
implicitWidth: NotifsConfig.sizes.width + root.padding * 2
|
implicitWidth: NotifsConfig.sizes.width + root.padding * 2
|
||||||
implicitHeight: list.height + root.padding * 2
|
implicitHeight: list.implicitHeight + root.padding * 2
|
||||||
|
|
||||||
ListView {
|
ListView {
|
||||||
id: list
|
id: list
|
||||||
|
|
@ -31,13 +31,32 @@ Item {
|
||||||
implicitHeight: {
|
implicitHeight: {
|
||||||
let height = (count - 1) * spacing;
|
let height = (count - 1) * spacing;
|
||||||
for (let i = 0; i < count; i++)
|
for (let i = 0; i < count; i++)
|
||||||
height += itemAtIndex(i).nonAnimHeight;
|
height += itemAtIndex(i)?.nonAnimHeight ?? 0;
|
||||||
return Math.max(61, height);
|
|
||||||
|
const screen = QsWindow.window?.screen;
|
||||||
|
const visibilities = Visibilities.screens[screen];
|
||||||
|
const panel = Visibilities.panels[screen];
|
||||||
|
if (visibilities && panel) {
|
||||||
|
if (visibilities.osd) {
|
||||||
|
const h = panel.osd.y - BorderConfig.rounding * 2;
|
||||||
|
if (height > h)
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (visibilities.session) {
|
||||||
|
const h = panel.session.y - BorderConfig.rounding * 2;
|
||||||
|
if (height > h)
|
||||||
|
height = h;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Math.max(61, Math.min(screen?.height - root.padding * 2 - BorderConfig.thickness * 2, height));
|
||||||
}
|
}
|
||||||
|
|
||||||
orientation: Qt.Vertical
|
orientation: Qt.Vertical
|
||||||
spacing: Appearance.spacing.smaller
|
spacing: Appearance.spacing.smaller
|
||||||
interactive: false
|
cacheBuffer: QsWindow.window?.screen.height ?? 0
|
||||||
|
clip: true
|
||||||
|
|
||||||
delegate: ClippingRectangle {
|
delegate: ClippingRectangle {
|
||||||
id: wrapper
|
id: wrapper
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ StyledRect {
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
cursorShape: pressed ? Qt.ClosedHandCursor : undefined
|
||||||
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
acceptedButtons: Qt.LeftButton | Qt.MiddleButton
|
||||||
|
preventStealing: true
|
||||||
|
|
||||||
onEntered: root.modelData?.timer.stop()
|
onEntered: root.modelData?.timer.stop()
|
||||||
onExited: root.modelData?.timer.start()
|
onExited: root.modelData?.timer.start()
|
||||||
|
|
@ -461,7 +462,7 @@ StyledRect {
|
||||||
TextMetrics {
|
TextMetrics {
|
||||||
id: actionTextMetrics
|
id: actionTextMetrics
|
||||||
|
|
||||||
text: modelData?.text
|
text: modelData?.text ?? ""
|
||||||
font.family: actionText.font.family
|
font.family: actionText.font.family
|
||||||
font.pointSize: actionText.font.pointSize
|
font.pointSize: actionText.font.pointSize
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import Quickshell
|
||||||
Singleton {
|
Singleton {
|
||||||
property var screens: ({})
|
property var screens: ({})
|
||||||
property var bars: ({})
|
property var bars: ({})
|
||||||
|
property var panels: ({})
|
||||||
|
|
||||||
function getForActive(): PersistentProperties {
|
function getForActive(): PersistentProperties {
|
||||||
return Object.entries(screens).find(s => s[0].slice(s[0].indexOf('"') + 1, s[0].lastIndexOf('"')) === Hyprland.focusedMonitor.name)[1];
|
return Object.entries(screens).find(s => s[0].slice(s[0].indexOf('"') + 1, s[0].lastIndexOf('"')) === Hyprland.focusedMonitor.name)[1];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue