refactor: move drawers into separate module
This commit is contained in:
parent
803ed74912
commit
ac2ef10d3f
6 changed files with 154 additions and 128 deletions
|
|
@ -5,30 +5,22 @@ import Quickshell.Wayland
|
|||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
Scope {
|
||||
id: scope
|
||||
StyledWindow {
|
||||
id: win
|
||||
|
||||
required property ShellScreen modelData
|
||||
|
||||
Border {
|
||||
screen: scope.modelData
|
||||
}
|
||||
screen: modelData
|
||||
name: "background"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
layer: WlrLayer.Background
|
||||
color: "black"
|
||||
|
||||
StyledWindow {
|
||||
id: win
|
||||
anchors.top: true
|
||||
anchors.bottom: true
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
|
||||
screen: scope.modelData
|
||||
name: "background"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
layer: WlrLayer.Background
|
||||
color: "black"
|
||||
|
||||
anchors.top: true
|
||||
anchors.bottom: true
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
|
||||
Wallpaper {}
|
||||
}
|
||||
Wallpaper {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,108 +0,0 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
|
||||
StyledWindow {
|
||||
id: win
|
||||
|
||||
screen: root.screen
|
||||
name: "border"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
|
||||
mask: Region {
|
||||
x: BorderConfig.thickness
|
||||
y: BorderConfig.thickness
|
||||
width: win.screen.width - BorderConfig.thickness * 2
|
||||
height: win.screen.height - BorderConfig.thickness * 2
|
||||
intersection: Intersection.Xor
|
||||
}
|
||||
|
||||
anchors.top: true
|
||||
anchors.bottom: true
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
|
||||
StyledRect {
|
||||
id: rect
|
||||
|
||||
anchors.fill: parent
|
||||
color: Colours.alpha(BorderConfig.colour, false)
|
||||
visible: false
|
||||
}
|
||||
|
||||
Item {
|
||||
id: mask
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: BorderConfig.thickness
|
||||
radius: BorderConfig.rounding
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
id: effect
|
||||
|
||||
visible: false
|
||||
anchors.fill: parent
|
||||
maskEnabled: true
|
||||
maskInverted: true
|
||||
maskSource: mask
|
||||
source: rect
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1
|
||||
}
|
||||
|
||||
LayerShadow {
|
||||
source: effect
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPositionChanged: event => Drawers.setPosForScreen(root.screen, event.x, event.y)
|
||||
}
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.left: false
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.top: false
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.right: false
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.bottom: false
|
||||
}
|
||||
|
||||
component ExclusionZone: StyledWindow {
|
||||
screen: root.screen
|
||||
name: "border-exclusion"
|
||||
width: BorderConfig.thickness
|
||||
height: BorderConfig.thickness
|
||||
|
||||
anchors.top: true
|
||||
anchors.left: true
|
||||
anchors.bottom: true
|
||||
anchors.right: true
|
||||
}
|
||||
}
|
||||
52
modules/drawers/Border.qml
Normal file
52
modules/drawers/Border.qml
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
import QtQuick
|
||||
import QtQuick.Effects
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
StyledRect {
|
||||
id: rect
|
||||
|
||||
anchors.fill: parent
|
||||
color: Colours.alpha(BorderConfig.colour, false)
|
||||
visible: false
|
||||
}
|
||||
|
||||
Item {
|
||||
id: mask
|
||||
|
||||
anchors.fill: parent
|
||||
layer.enabled: true
|
||||
visible: false
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
anchors.margins: BorderConfig.thickness
|
||||
radius: BorderConfig.rounding
|
||||
}
|
||||
}
|
||||
|
||||
MultiEffect {
|
||||
anchors.fill: parent
|
||||
maskEnabled: true
|
||||
maskInverted: true
|
||||
maskSource: mask
|
||||
source: rect
|
||||
maskThresholdMin: 0.5
|
||||
maskSpreadAtMin: 1
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
onPositionChanged: event => Drawers.setPosForScreen(root.screen, event.x, event.y)
|
||||
}
|
||||
}
|
||||
49
modules/drawers/Drawers.qml
Normal file
49
modules/drawers/Drawers.qml
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import "root:/widgets"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
|
||||
Variants {
|
||||
model: Quickshell.screens
|
||||
|
||||
Scope {
|
||||
id: scope
|
||||
|
||||
required property ShellScreen modelData
|
||||
|
||||
Exclusions {
|
||||
screen: scope.modelData
|
||||
}
|
||||
|
||||
StyledWindow {
|
||||
id: win
|
||||
|
||||
screen: scope.modelData
|
||||
name: "drawers"
|
||||
exclusionMode: ExclusionMode.Ignore
|
||||
|
||||
mask: Region {
|
||||
x: BorderConfig.thickness
|
||||
y: BorderConfig.thickness
|
||||
width: scope.modelData.width - BorderConfig.thickness * 2
|
||||
height: scope.modelData.height - BorderConfig.thickness * 2
|
||||
intersection: Intersection.Xor
|
||||
}
|
||||
|
||||
anchors.top: true
|
||||
anchors.bottom: true
|
||||
anchors.left: true
|
||||
anchors.right: true
|
||||
|
||||
Border {
|
||||
id: border
|
||||
|
||||
visible: false
|
||||
screen: scope.modelData
|
||||
}
|
||||
|
||||
LayerShadow {
|
||||
source: border
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
39
modules/drawers/Exclusions.qml
Normal file
39
modules/drawers/Exclusions.qml
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
pragma ComponentBehavior: Bound
|
||||
|
||||
import "root:/widgets"
|
||||
import "root:/config"
|
||||
import Quickshell
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
required property ShellScreen screen
|
||||
|
||||
ExclusionZone {
|
||||
anchors.left: false
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.top: false
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.right: false
|
||||
}
|
||||
|
||||
ExclusionZone {
|
||||
anchors.bottom: false
|
||||
}
|
||||
|
||||
component ExclusionZone: StyledWindow {
|
||||
screen: root.screen
|
||||
name: "border-exclusion"
|
||||
width: BorderConfig.thickness
|
||||
height: BorderConfig.thickness
|
||||
|
||||
anchors.top: true
|
||||
anchors.left: true
|
||||
anchors.bottom: true
|
||||
anchors.right: true
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import "modules/bar"
|
|||
import "modules/launcher"
|
||||
import "modules/osd"
|
||||
import "modules/background"
|
||||
import "modules/drawers"
|
||||
import Quickshell
|
||||
|
||||
ShellRoot {
|
||||
|
|
@ -9,4 +10,5 @@ ShellRoot {
|
|||
Launcher {}
|
||||
Osd {}
|
||||
Background {}
|
||||
Drawers {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue