notifs: move to drawers
This commit is contained in:
parent
9c3e2fffbd
commit
8ea4362ba1
8 changed files with 86 additions and 303 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
import "root:/services"
|
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 Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
|
|
@ -21,4 +22,11 @@ Shape {
|
||||||
startX: root.width
|
startX: root.width
|
||||||
startY: (root.height - panels.osd.height) / 2
|
startY: (root.height - panels.osd.height) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Notifications.Background {
|
||||||
|
wrapper: panels.notifications
|
||||||
|
|
||||||
|
startX: root.width
|
||||||
|
startY: 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,7 @@ Variants {
|
||||||
|
|
||||||
property bool launcher
|
property bool launcher
|
||||||
property bool osd
|
property bool osd
|
||||||
property bool notifs
|
property bool notifications: Notifs.popups.length > 0
|
||||||
property bool session
|
property bool session
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
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 Quickshell
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
|
|
@ -10,6 +11,7 @@ Item {
|
||||||
required property PersistentProperties visibilities
|
required property PersistentProperties visibilities
|
||||||
|
|
||||||
readonly property Osd.Wrapper osd: osd
|
readonly property Osd.Wrapper osd: osd
|
||||||
|
readonly property Notifications.Wrapper notifications: notifications
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: BorderConfig.thickness
|
anchors.margins: BorderConfig.thickness
|
||||||
|
|
@ -23,4 +25,14 @@ Item {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Notifications.Wrapper {
|
||||||
|
id: notifications
|
||||||
|
|
||||||
|
screen: root.screen
|
||||||
|
visibility: visibilities.notifications
|
||||||
|
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,63 +3,54 @@ import "root:/config"
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Shapes
|
import QtQuick.Shapes
|
||||||
|
|
||||||
Shape {
|
ShapePath {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property real wrapperWidth
|
required property Wrapper wrapper
|
||||||
required property real wrapperHeight
|
|
||||||
readonly property real rounding: BorderConfig.rounding
|
readonly property real rounding: BorderConfig.rounding
|
||||||
readonly property bool flatten: wrapperHeight < rounding * 2
|
readonly property bool flatten: wrapper.height < rounding * 2
|
||||||
readonly property real roundingY: flatten ? wrapperHeight / 2 : rounding
|
readonly property real roundingY: flatten ? wrapper.height / 2 : rounding
|
||||||
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
strokeWidth: -1
|
||||||
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
|
fillColor: BorderConfig.colour
|
||||||
|
|
||||||
ShapePath {
|
PathLine {
|
||||||
strokeWidth: -1
|
relativeX: -root.wrapper.width
|
||||||
fillColor: BorderConfig.colour
|
relativeY: 0
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: root.roundingY
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: Math.min(root.rounding, root.wrapper.height)
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: 0
|
||||||
|
relativeY: root.wrapper.height - root.roundingY * 2
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: root.roundingY
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: Math.min(root.rounding, root.wrapper.height)
|
||||||
|
direction: PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: root.wrapper.height > 0 ? root.wrapper.width - root.rounding * 3 : root.wrapper.width
|
||||||
|
relativeY: 0
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.rounding
|
||||||
|
relativeY: root.rounding
|
||||||
|
radiusX: root.rounding
|
||||||
|
radiusY: root.rounding
|
||||||
|
}
|
||||||
|
|
||||||
startX: root.wrapperWidth
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
PathLine {}
|
duration: Appearance.anim.durations.normal
|
||||||
PathArc {
|
easing.type: Easing.BezierSpline
|
||||||
relativeX: root.rounding
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
relativeY: root.roundingY
|
|
||||||
radiusX: root.rounding
|
|
||||||
radiusY: Math.min(root.rounding, root.wrapperHeight)
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
relativeX: 0
|
|
||||||
y: root.flatten ? root.roundingY : root.wrapperHeight - root.rounding
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: root.rounding
|
|
||||||
relativeY: root.roundingY
|
|
||||||
radiusX: root.rounding
|
|
||||||
radiusY: Math.min(root.rounding, root.wrapperHeight)
|
|
||||||
direction: PathArc.Counterclockwise
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
x: root.wrapperWidth - root.rounding - 1
|
|
||||||
relativeY: 0
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: root.rounding
|
|
||||||
relativeY: root.rounding
|
|
||||||
radiusX: root.rounding
|
|
||||||
radiusY: root.rounding
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
relativeX: 1
|
|
||||||
relativeY: 0
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on fillColor {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Appearance.anim.durations.normal
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.standard
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
import "root:/widgets"
|
|
||||||
import "root:/services"
|
|
||||||
import "root:/config"
|
|
||||||
import Quickshell
|
|
||||||
import Quickshell.Wayland
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
Scope {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property ShellScreen modelData
|
|
||||||
property bool osdVisible: Notifs.popups.length > 0
|
|
||||||
|
|
||||||
LazyLoader {
|
|
||||||
loading: true
|
|
||||||
|
|
||||||
StyledWindow {
|
|
||||||
id: win
|
|
||||||
|
|
||||||
screen: root.modelData
|
|
||||||
name: "notifications"
|
|
||||||
visible: wrapper.shouldBeVisible
|
|
||||||
exclusionMode: ExclusionMode.Normal
|
|
||||||
|
|
||||||
mask: Region {
|
|
||||||
item: wrapper
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.top: true
|
|
||||||
anchors.bottom: true
|
|
||||||
anchors.left: true
|
|
||||||
anchors.right: true
|
|
||||||
|
|
||||||
width: wrapper.width
|
|
||||||
height: wrapper.height
|
|
||||||
|
|
||||||
Background {
|
|
||||||
id: bg
|
|
||||||
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
wrapperWidth: wrapper.width
|
|
||||||
wrapperHeight: Math.min(wrapper.height, content.height)
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerShadow {
|
|
||||||
source: bg
|
|
||||||
}
|
|
||||||
|
|
||||||
Wrapper {
|
|
||||||
id: wrapper
|
|
||||||
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
implicitWidth: content.width + bg.rounding
|
|
||||||
|
|
||||||
osdVisible: root.osdVisible
|
|
||||||
contentHeight: content.height
|
|
||||||
|
|
||||||
Content {
|
|
||||||
id: content
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
|
import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property bool osdVisible
|
required property ShellScreen screen
|
||||||
required property real contentHeight
|
required property bool visibility
|
||||||
property bool shouldBeVisible
|
|
||||||
|
|
||||||
visible: height > 0
|
visible: height > 0
|
||||||
height: 0
|
implicitHeight: 0
|
||||||
|
implicitWidth: content.width + BorderConfig.rounding
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "visible"
|
name: "visible"
|
||||||
when: root.osdVisible
|
when: root.visibility
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
root.height: contentHeight
|
root.implicitHeight: content.height
|
||||||
root.shouldBeVisible: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,37 +26,29 @@ Item {
|
||||||
from: ""
|
from: ""
|
||||||
to: "visible"
|
to: "visible"
|
||||||
|
|
||||||
SequentialAnimation {
|
NumberAnimation {
|
||||||
PropertyAction {
|
target: root
|
||||||
target: root
|
property: "implicitHeight"
|
||||||
property: "shouldBeVisible"
|
duration: Appearance.anim.durations.large
|
||||||
}
|
easing.type: Easing.BezierSpline
|
||||||
NumberAnimation {
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
target: root
|
|
||||||
property: "height"
|
|
||||||
duration: Appearance.anim.durations.large
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Transition {
|
Transition {
|
||||||
from: "visible"
|
from: "visible"
|
||||||
to: ""
|
to: ""
|
||||||
|
|
||||||
SequentialAnimation {
|
NumberAnimation {
|
||||||
NumberAnimation {
|
target: root
|
||||||
target: root
|
property: "implicitHeight"
|
||||||
property: "height"
|
duration: Appearance.anim.durations.normal
|
||||||
duration: Appearance.anim.durations.normal
|
easing.type: Easing.BezierSpline
|
||||||
easing.type: Easing.BezierSpline
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
easing.bezierCurve: Appearance.anim.curves.standard
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: root
|
|
||||||
property: "shouldBeVisible"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,142 +0,0 @@
|
||||||
import "root:/widgets"
|
|
||||||
import "root:/services"
|
|
||||||
import "root:/config"
|
|
||||||
import Quickshell
|
|
||||||
import QtQuick
|
|
||||||
|
|
||||||
Variants {
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
Scope {
|
|
||||||
id: root
|
|
||||||
|
|
||||||
required property ShellScreen modelData
|
|
||||||
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(modelData)
|
|
||||||
property int winHeight
|
|
||||||
property bool osdVisible
|
|
||||||
property bool hovered
|
|
||||||
|
|
||||||
function show(): void {
|
|
||||||
root.osdVisible = true;
|
|
||||||
timer.restart();
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Audio
|
|
||||||
|
|
||||||
function onMutedChanged(): void {
|
|
||||||
root.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
function onVolumeChanged(): void {
|
|
||||||
root.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: root.monitor
|
|
||||||
|
|
||||||
function onBrightnessChanged(): void {
|
|
||||||
root.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: timer
|
|
||||||
|
|
||||||
interval: OsdConfig.hideDelay
|
|
||||||
onTriggered: {
|
|
||||||
if (!root.hovered)
|
|
||||||
root.osdVisible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Connections {
|
|
||||||
target: Drawers
|
|
||||||
|
|
||||||
function onPosChanged(screen: ShellScreen, x: int, y: int): void {
|
|
||||||
if (screen === root.modelData && x > screen.width - BorderConfig.thickness && y > (screen.height - root.winHeight) / 2 && y < (screen.height + root.winHeight) / 2)
|
|
||||||
root.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LazyLoader {
|
|
||||||
loading: true
|
|
||||||
|
|
||||||
StyledWindow {
|
|
||||||
id: win
|
|
||||||
|
|
||||||
screen: root.modelData
|
|
||||||
name: "osd"
|
|
||||||
visible: wrapper.shouldBeVisible
|
|
||||||
|
|
||||||
mask: Region {
|
|
||||||
item: wrapper
|
|
||||||
}
|
|
||||||
|
|
||||||
anchors.left: true
|
|
||||||
anchors.right: true
|
|
||||||
height: wrapper.height
|
|
||||||
|
|
||||||
Component.onCompleted: root.winHeight = height
|
|
||||||
|
|
||||||
Item {
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Drawers.rightExclusion
|
|
||||||
|
|
||||||
clip: true
|
|
||||||
visible: width > 0
|
|
||||||
implicitWidth: wrapper.width
|
|
||||||
implicitHeight: wrapper.height
|
|
||||||
|
|
||||||
Background {
|
|
||||||
id: bg
|
|
||||||
|
|
||||||
visible: false
|
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
wrapperWidth: Math.min(wrapper.width, content.width)
|
|
||||||
wrapperHeight: wrapper.height
|
|
||||||
}
|
|
||||||
|
|
||||||
LayerShadow {
|
|
||||||
source: bg
|
|
||||||
}
|
|
||||||
|
|
||||||
Wrapper {
|
|
||||||
id: wrapper
|
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
|
||||||
|
|
||||||
implicitHeight: content.height + bg.rounding * 2
|
|
||||||
|
|
||||||
osdVisible: root.osdVisible
|
|
||||||
contentWidth: content.width
|
|
||||||
|
|
||||||
Content {
|
|
||||||
id: content
|
|
||||||
|
|
||||||
monitor: root.monitor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HoverHandler {
|
|
||||||
id: hoverHandler
|
|
||||||
|
|
||||||
onHoveredChanged: {
|
|
||||||
root.hovered = hovered;
|
|
||||||
if (hovered)
|
|
||||||
timer.stop();
|
|
||||||
else
|
|
||||||
root.osdVisible = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
import "modules/bar"
|
import "modules/bar"
|
||||||
import "modules/launcher"
|
import "modules/launcher"
|
||||||
import "modules/osd"
|
|
||||||
import "modules/notifications"
|
|
||||||
import "modules/session"
|
import "modules/session"
|
||||||
import "modules/drawers"
|
import "modules/drawers"
|
||||||
import "modules/background"
|
import "modules/background"
|
||||||
|
|
@ -10,9 +8,7 @@ import Quickshell
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
Bar {}
|
Bar {}
|
||||||
Launcher {}
|
Launcher {}
|
||||||
//Osd {}
|
|
||||||
Background {}
|
Background {}
|
||||||
Drawers {}
|
Drawers {}
|
||||||
Notifications {}
|
|
||||||
Session {}
|
Session {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue