mirror of
https://github.com/kittywitch/nixfiles.git
synced 2026-02-09 12:29:19 -08:00
feat: battery, refactor
This commit is contained in:
parent
9ae22c832f
commit
1ba98534eb
15 changed files with 122 additions and 6 deletions
76
quickshell/Components/NotificationArea/NotificationItem.qml
Normal file
76
quickshell/Components/NotificationArea/NotificationItem.qml
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import Quickshell
|
||||
import Quickshell.Widgets
|
||||
import Quickshell.Io
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import "root:/DataSources"
|
||||
import "root:/Helpers"
|
||||
import Quickshell.Services.Notifications
|
||||
|
||||
Item {
|
||||
required property Notification modelData
|
||||
|
||||
function calculateHeight() {
|
||||
if (modelData.actions.length > 0) {
|
||||
return 150
|
||||
} else if (modelData.image != "") {
|
||||
return 100
|
||||
} else {
|
||||
return 60
|
||||
}
|
||||
}
|
||||
|
||||
function calculateBodyHeight() {
|
||||
if (modelData.image != "" || modelData.actions.length > 0) {
|
||||
return 40
|
||||
} else {
|
||||
return 20
|
||||
}
|
||||
}
|
||||
|
||||
height: calculateHeight()
|
||||
width: 450
|
||||
|
||||
Rectangle {
|
||||
id: indivNotif
|
||||
color: Stylix.base02
|
||||
radius: 5
|
||||
anchors {
|
||||
fill: parent
|
||||
leftMargin: 5
|
||||
rightMargin: 5
|
||||
}
|
||||
RowLayout {
|
||||
anchors {
|
||||
fill: parent
|
||||
}
|
||||
NotificationImage {
|
||||
image: modelData.image
|
||||
}
|
||||
ColumnLayout {
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.leftMargin: 5
|
||||
Layout.rightMargin: 5
|
||||
Layout.fillWidth: true
|
||||
NotificationHeader {
|
||||
modelData_: modelData
|
||||
}
|
||||
Text {
|
||||
font.pointSize: 10
|
||||
wrapMode: Text.WordWrap
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: modelData.image != "" ? indivNotif.width - 80 : indivNotif.width
|
||||
Layout.maximumHeight: calculateBodyHeight()
|
||||
Layout.maximumWidth: indivNotif.width
|
||||
elide: Text.ElideRight
|
||||
text: modelData.body
|
||||
color: Stylix.base05
|
||||
}
|
||||
NotificationActions {
|
||||
modelData_: modelData
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue