feat: shadow

Border exclusivity
Fix slider handle text colour
This commit is contained in:
2 * r + 2 * t 2025-05-05 11:04:03 +10:00
parent c665c0ca98
commit 9071de0d60
6 changed files with 103 additions and 42 deletions

View file

@ -19,7 +19,7 @@ Singleton {
property int totalHeight: height property int totalHeight: height
property int height: 40 property int height: 40
property int innerHeight: 30 property int innerHeight: 30
property int floatingGap: 10 + BackgroundConfig.border.thickness property int floatingGap: 15
property int maxLabelWidth: 600 property int maxLabelWidth: 600
property int maxLabelHeight: 400 property int maxLabelHeight: 400
} }

View file

@ -4,54 +4,96 @@ import Quickshell
import QtQuick import QtQuick
import QtQuick.Effects import QtQuick.Effects
StyledWindow { Scope {
id: win id: root
name: "border" required property ShellScreen screen
exclusionMode: ExclusionMode.Ignore
mask: Region { StyledWindow {
x: BackgroundConfig.border.thickness id: win
y: BackgroundConfig.border.thickness
width: win.screen.width - BackgroundConfig.border.thickness * 2
height: win.screen.height - BackgroundConfig.border.thickness * 2
intersection: Intersection.Xor
}
anchors.top: true screen: root.screen
anchors.bottom: true name: "border"
anchors.left: true exclusionMode: ExclusionMode.Ignore
anchors.right: true
StyledRect { mask: Region {
id: rect x: BackgroundConfig.border.thickness
y: BackgroundConfig.border.thickness
width: win.screen.width - BackgroundConfig.border.thickness * 2
height: win.screen.height - BackgroundConfig.border.thickness * 2
intersection: Intersection.Xor
}
anchors.fill: parent anchors.top: true
color: Appearance.alpha(Appearance.colours.m3surface, false) anchors.bottom: true
visible: false anchors.left: true
} anchors.right: true
Item { StyledRect {
id: mask id: rect
anchors.fill: parent
layer.enabled: true
visible: false
Rectangle {
anchors.fill: parent anchors.fill: parent
anchors.margins: BackgroundConfig.border.thickness color: Appearance.alpha(Appearance.colours.m3surface, false)
radius: BackgroundConfig.border.rounding visible: false
}
Item {
id: mask
anchors.fill: parent
layer.enabled: true
visible: false
Rectangle {
anchors.fill: parent
anchors.margins: BackgroundConfig.border.thickness
radius: BackgroundConfig.border.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
} }
} }
MultiEffect { ExclusionZone {
anchors.fill: parent anchors.left: false
maskEnabled: true }
maskInverted: true
maskSource: mask ExclusionZone {
source: rect anchors.top: false
maskThresholdMin: 0.5 }
maskSpreadAtMin: 1
ExclusionZone {
anchors.right: false
}
ExclusionZone {
anchors.bottom: false
}
component ExclusionZone: StyledWindow {
screen: root.screen
name: "border-exclusion"
width: BackgroundConfig.border.thickness
height: BackgroundConfig.border.thickness
anchors.top: true
anchors.left: true
anchors.bottom: true
anchors.right: true
} }
} }

View file

@ -25,7 +25,6 @@ Scope {
item: wrapper item: wrapper
} }
margins.bottom: BackgroundConfig.border.thickness
anchors.top: true anchors.top: true
anchors.left: true anchors.left: true
anchors.bottom: true anchors.bottom: true
@ -34,6 +33,8 @@ Scope {
Background { Background {
id: bg id: bg
visible: false
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
@ -41,6 +42,10 @@ Scope {
realWrapperHeight: Math.min(wrapper.height, content.height) realWrapperHeight: Math.min(wrapper.height, content.height)
} }
LayerShadow {
source: bg
}
Wrapper { Wrapper {
id: wrapper id: wrapper

View file

@ -64,7 +64,6 @@ Variants {
item: wrapper item: wrapper
} }
margins.right: BackgroundConfig.border.thickness
anchors.left: true anchors.left: true
anchors.right: true anchors.right: true
height: wrapper.height height: wrapper.height
@ -72,6 +71,8 @@ Variants {
Background { Background {
id: bg id: bg
visible: false
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right anchors.right: parent.right
@ -79,6 +80,10 @@ Variants {
realWrapperWidth: Math.min(wrapper.width, content.width) realWrapperWidth: Math.min(wrapper.width, content.width)
} }
LayerShadow {
source: bg
}
Wrapper { Wrapper {
id: wrapper id: wrapper

9
widgets/LayerShadow.qml Normal file
View file

@ -0,0 +1,9 @@
import "root:/config"
import Qt5Compat.GraphicalEffects
DropShadow {
anchors.fill: source
color: Qt.alpha(Appearance.colours.m3shadow, 0.7)
radius: 10
samples: 1 + radius * 2
}

View file

@ -57,7 +57,7 @@ Slider {
animate: true animate: true
text: root.icon text: root.icon
color: Appearance.colours.m3onInverseSurface color: Appearance.colours.m3inverseOnSurface
anchors.centerIn: parent anchors.centerIn: parent
states: State { states: State {