mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
ported some quickshell stuff from rivendell-hyprdots
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Wayland
|
||||
import Quickshell.Services.Notifications
|
||||
import "."
|
||||
|
||||
PanelWindow {
|
||||
id: root
|
||||
|
||||
required property var bar
|
||||
property list<Notification> notifs
|
||||
|
||||
WlrLayershell.namespace: "shell:notifications"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
color: "transparent"
|
||||
|
||||
anchors {
|
||||
left: true
|
||||
top: true
|
||||
bottom: true
|
||||
right: true
|
||||
}
|
||||
|
||||
NotificationServer {
|
||||
actionsSupported: true
|
||||
|
||||
onNotification: notif => {
|
||||
notif.tracked = true;
|
||||
root.notifs = [...root.notifs, notif];
|
||||
}
|
||||
}
|
||||
|
||||
visible: stack.children.length != 0
|
||||
mask: Region {
|
||||
item: stack
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: stack
|
||||
|
||||
model: ScriptModel {
|
||||
values: [...root.notifs]
|
||||
}
|
||||
anchors.right: parent.right
|
||||
y: root.bar.height
|
||||
implicitWidth: 240
|
||||
implicitHeight: children.reduce((h, c) => h + c.height, 0)
|
||||
interactive: false
|
||||
spacing: 20
|
||||
|
||||
displaced: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
NumberAnimation {
|
||||
property: "y"
|
||||
duration: 200
|
||||
easing.type: Easing.OutCubic
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Notif {
|
||||
required property Notification modelData
|
||||
notif: modelData
|
||||
|
||||
onDismissed: () => {
|
||||
modelData.dismiss();
|
||||
// Remove from list
|
||||
const index = root.notifs.indexOf(notif);
|
||||
if (index > -1)
|
||||
root.notifs.splice(index, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user