refactor: move to single window
This commit is contained in:
parent
c64e602725
commit
ad7c6ea98e
7 changed files with 176 additions and 91 deletions
24
modules/drawers/Backgrounds.qml
Normal file
24
modules/drawers/Backgrounds.qml
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/osd" as Osd
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
import QtQuick.Shapes
|
||||||
|
|
||||||
|
Shape {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property Panels panels
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: BorderConfig.thickness
|
||||||
|
preferredRendererType: Shape.CurveRenderer
|
||||||
|
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
|
||||||
|
|
||||||
|
Osd.Background {
|
||||||
|
wrapper: panels.osd
|
||||||
|
|
||||||
|
startX: root.width
|
||||||
|
startY: (root.height - panels.osd.height) / 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
|
pragma ComponentBehavior: Bound
|
||||||
|
|
||||||
import "root:/widgets"
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
import "root:/config"
|
import "root:/config"
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
Variants {
|
Variants {
|
||||||
model: Quickshell.screens
|
model: Quickshell.screens
|
||||||
|
|
@ -27,6 +31,13 @@ Variants {
|
||||||
width: scope.modelData.width - BorderConfig.thickness * 2
|
width: scope.modelData.width - BorderConfig.thickness * 2
|
||||||
height: scope.modelData.height - BorderConfig.thickness * 2
|
height: scope.modelData.height - BorderConfig.thickness * 2
|
||||||
intersection: Intersection.Xor
|
intersection: Intersection.Xor
|
||||||
|
|
||||||
|
regions: panels.children.map(c => regionComp.createObject(this, {
|
||||||
|
x: c.x,
|
||||||
|
y: c.y,
|
||||||
|
width: c.width,
|
||||||
|
height: c.height
|
||||||
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
anchors.top: true
|
anchors.top: true
|
||||||
|
|
@ -34,14 +45,35 @@ Variants {
|
||||||
anchors.left: true
|
anchors.left: true
|
||||||
anchors.right: true
|
anchors.right: true
|
||||||
|
|
||||||
Border {
|
Component {
|
||||||
id: border
|
id: regionComp
|
||||||
|
|
||||||
|
Region {
|
||||||
|
intersection: Intersection.Subtract
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: background
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
visible: false
|
visible: false
|
||||||
|
|
||||||
|
Border {}
|
||||||
|
|
||||||
|
Backgrounds {
|
||||||
|
panels: panels
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LayerShadow {
|
LayerShadow {
|
||||||
source: border
|
source: background
|
||||||
|
}
|
||||||
|
|
||||||
|
Panels {
|
||||||
|
id: panels
|
||||||
|
|
||||||
|
screen: scope.modelData
|
||||||
}
|
}
|
||||||
|
|
||||||
Interactions {
|
Interactions {
|
||||||
|
|
|
||||||
25
modules/drawers/Panels.qml
Normal file
25
modules/drawers/Panels.qml
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
import "root:/widgets"
|
||||||
|
import "root:/services"
|
||||||
|
import "root:/config"
|
||||||
|
import "root:/modules/osd" as Osd
|
||||||
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property ShellScreen screen
|
||||||
|
readonly property Osd.Wrapper osd: osd
|
||||||
|
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: BorderConfig.thickness
|
||||||
|
|
||||||
|
Osd.Wrapper {
|
||||||
|
id: osd
|
||||||
|
|
||||||
|
screen: root.screen
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -3,68 +3,61 @@ 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: wrapperWidth < rounding * 2
|
readonly property bool flatten: wrapper.width < rounding * 2
|
||||||
readonly property real roundingX: flatten ? wrapperWidth / 2 : rounding
|
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
|
||||||
|
|
||||||
preferredRendererType: Shape.CurveRenderer
|
strokeWidth: -1
|
||||||
opacity: Colours.transparency.enabled ? Colours.transparency.base : 1
|
fillColor: BorderConfig.colour
|
||||||
|
|
||||||
ShapePath {
|
PathArc {
|
||||||
strokeWidth: -1
|
relativeX: -root.roundingX
|
||||||
fillColor: BorderConfig.colour
|
relativeY: root.rounding
|
||||||
|
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||||
|
radiusY: root.rounding
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: -(root.wrapper.width - root.roundingX * 2)
|
||||||
|
relativeY: 0
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: -root.roundingX
|
||||||
|
relativeY: root.rounding
|
||||||
|
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||||
|
radiusY: root.rounding
|
||||||
|
direction: PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: 0
|
||||||
|
relativeY: root.wrapper.height - root.rounding * 4
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.roundingX
|
||||||
|
relativeY: root.rounding
|
||||||
|
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||||
|
radiusY: root.rounding
|
||||||
|
direction: PathArc.Counterclockwise
|
||||||
|
}
|
||||||
|
PathLine {
|
||||||
|
relativeX: root.wrapper.width - root.roundingX * 2
|
||||||
|
relativeY: 0
|
||||||
|
}
|
||||||
|
PathArc {
|
||||||
|
relativeX: root.roundingX
|
||||||
|
relativeY: root.rounding
|
||||||
|
radiusX: Math.min(root.rounding, root.wrapper.width)
|
||||||
|
radiusY: root.rounding
|
||||||
|
}
|
||||||
|
|
||||||
startX: root.wrapperWidth - 1
|
Behavior on fillColor {
|
||||||
|
ColorAnimation {
|
||||||
PathArc {
|
duration: Appearance.anim.durations.normal
|
||||||
relativeX: -root.roundingX
|
easing.type: Easing.BezierSpline
|
||||||
relativeY: root.rounding
|
easing.bezierCurve: Appearance.anim.curves.standard
|
||||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
|
||||||
radiusY: root.rounding
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
x: root.roundingX
|
|
||||||
relativeY: 0
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: -root.roundingX
|
|
||||||
relativeY: root.rounding
|
|
||||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
|
||||||
radiusY: root.rounding
|
|
||||||
direction: PathArc.Counterclockwise
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
y: root.wrapperHeight - root.rounding * 2
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: root.roundingX
|
|
||||||
relativeY: root.rounding
|
|
||||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
|
||||||
radiusY: root.rounding
|
|
||||||
direction: PathArc.Counterclockwise
|
|
||||||
}
|
|
||||||
PathLine {
|
|
||||||
x: (root.flatten ? root.roundingX : root.wrapperWidth - root.rounding) - 1
|
|
||||||
relativeY: 0
|
|
||||||
}
|
|
||||||
PathArc {
|
|
||||||
relativeX: root.roundingX
|
|
||||||
relativeY: root.rounding
|
|
||||||
radiusX: Math.min(root.rounding, root.wrapperWidth)
|
|
||||||
radiusY: root.rounding
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on fillColor {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Appearance.anim.durations.normal
|
|
||||||
easing.type: Easing.BezierSpline
|
|
||||||
easing.bezierCurve: Appearance.anim.curves.standard
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,23 @@
|
||||||
|
import "root:/services"
|
||||||
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 contentWidth
|
|
||||||
property bool shouldBeVisible
|
|
||||||
|
|
||||||
visible: width > 0
|
visible: width > 0
|
||||||
width: 0
|
implicitWidth: 0
|
||||||
|
implicitHeight: content.height + BorderConfig.rounding * 2
|
||||||
|
|
||||||
states: State {
|
states: State {
|
||||||
name: "visible"
|
name: "visible"
|
||||||
when: root.osdVisible
|
when: Drawers.visibilities[root.screen].osd
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
root.width: contentWidth
|
root.implicitWidth: content.width
|
||||||
root.shouldBeVisible: true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -26,37 +26,31 @@ Item {
|
||||||
from: ""
|
from: ""
|
||||||
to: "visible"
|
to: "visible"
|
||||||
|
|
||||||
SequentialAnimation {
|
NumberAnimation {
|
||||||
PropertyAction {
|
target: root
|
||||||
target: root
|
property: "implicitWidth"
|
||||||
property: "shouldBeVisible"
|
duration: Appearance.anim.durations.large
|
||||||
}
|
easing.type: Easing.BezierSpline
|
||||||
NumberAnimation {
|
easing.bezierCurve: Appearance.anim.curves.emphasizedDecel
|
||||||
target: root
|
|
||||||
property: "width"
|
|
||||||
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: "implicitWidth"
|
||||||
property: "width"
|
duration: Appearance.anim.durations.normal
|
||||||
duration: Appearance.anim.durations.normal
|
easing.type: Easing.BezierSpline
|
||||||
easing.type: Easing.BezierSpline
|
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
|
||||||
easing.bezierCurve: Appearance.anim.curves.emphasizedAccel
|
|
||||||
}
|
|
||||||
PropertyAction {
|
|
||||||
target: root
|
|
||||||
property: "shouldBeVisible"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Content {
|
||||||
|
id: content
|
||||||
|
|
||||||
|
monitor: Brightness.getMonitorForScreen(root.screen)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,16 @@
|
||||||
pragma Singleton
|
pragma Singleton
|
||||||
|
|
||||||
import Quickshell
|
import Quickshell
|
||||||
|
import QtQuick
|
||||||
|
|
||||||
Singleton {
|
Singleton {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
property var visibilities: Quickshell.screens.reduce((acc, s) => {
|
||||||
|
acc[s] = visibleComp.createObject(root);
|
||||||
|
return acc;
|
||||||
|
}, {})
|
||||||
|
|
||||||
property var positions: ({})
|
property var positions: ({})
|
||||||
property int rightExclusion
|
property int rightExclusion
|
||||||
|
|
||||||
|
|
@ -14,4 +20,15 @@ Singleton {
|
||||||
positions[screen] = Qt.point(x, y);
|
positions[screen] = Qt.point(x, y);
|
||||||
posChanged(screen, x, y);
|
posChanged(screen, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: visibleComp
|
||||||
|
|
||||||
|
QtObject {
|
||||||
|
property bool launcher
|
||||||
|
property bool osd
|
||||||
|
property bool notifs
|
||||||
|
property bool session
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import Quickshell
|
||||||
ShellRoot {
|
ShellRoot {
|
||||||
Bar {}
|
Bar {}
|
||||||
Launcher {}
|
Launcher {}
|
||||||
Osd {}
|
//Osd {}
|
||||||
Background {}
|
Background {}
|
||||||
Drawers {}
|
Drawers {}
|
||||||
Notifications {}
|
Notifications {}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue