117 lines
3 KiB
QML
117 lines
3 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import Quickshell
|
|
import Quickshell.Wayland
|
|
import Quickshell.Services.Notifications
|
|
import QtQuick
|
|
import QtQuick.Effects
|
|
|
|
import "../bar"
|
|
import "../notifications"
|
|
|
|
// import "../../services"
|
|
|
|
Variants {
|
|
model: Quickshell.screens
|
|
|
|
Scope {
|
|
id: scope
|
|
required property ShellScreen modelData
|
|
|
|
Exclusions {
|
|
screen: scope.modelData
|
|
bar: bar
|
|
}
|
|
|
|
PanelWindow {
|
|
id: win
|
|
|
|
screen: scope.modelData
|
|
color: "transparent"
|
|
|
|
WlrLayershell.exclusionMode: ExclusionMode.Ignore
|
|
WlrLayershell.keyboardFocus: WlrKeyboardFocus.None
|
|
|
|
// Clickthrough mask.
|
|
// Clickable areas of the window are determined by the provided region.
|
|
mask: Region {
|
|
x: bar.implicitWidth
|
|
y: 8
|
|
width: win.width - bar.implicitWidth
|
|
height: win.height - 8
|
|
|
|
// Setting the intersection mode to Xor will invert the mask and make everything in the mask region not clickable and pass through clicks inside it through the window.
|
|
intersection: Intersection.Xor
|
|
}
|
|
|
|
anchors {
|
|
top: true
|
|
bottom: true
|
|
left: true
|
|
right: true
|
|
}
|
|
|
|
Item {
|
|
id: background
|
|
|
|
anchors.fill: parent
|
|
visible: false
|
|
|
|
Border {
|
|
bar: bar
|
|
}
|
|
}
|
|
|
|
MultiEffect {
|
|
anchors.fill: source
|
|
source: background
|
|
shadowEnabled: true
|
|
blurMax: 15
|
|
}
|
|
|
|
Bar {
|
|
id: bar
|
|
screen: scope.modelData
|
|
}
|
|
Item {
|
|
id: notifs
|
|
|
|
readonly property list<Notif> list: []
|
|
readonly property list<Notif> popups: list.filter(n => n.popup)
|
|
|
|
NotificationServer {
|
|
id: server
|
|
|
|
keepOnReload: false
|
|
|
|
onNotification: notif => {
|
|
notif.tracked = true;
|
|
console.log("Got notification: " + notif.body);
|
|
|
|
root.list.push(notifComp.createObject(root, {
|
|
popup: true,
|
|
notification: notif,
|
|
body: notif.body,
|
|
appName: notif.appName
|
|
}));
|
|
}
|
|
}
|
|
|
|
Component {
|
|
id: notifComp
|
|
|
|
Notif {}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
component Notif: QtObject {
|
|
property bool popup
|
|
readonly property date time: new Date()
|
|
|
|
required property Notification notification
|
|
readonly property string body: notification.body
|
|
readonly property string appName: notification.appName
|
|
}
|
|
}
|