forked from Shinonome/dots-hyprland
overlay: make widgets have proper round corners when pinned
This commit is contained in:
@@ -104,7 +104,7 @@ Singleton {
|
|||||||
property bool pinned: false
|
property bool pinned: false
|
||||||
property bool clickthrough: false
|
property bool clickthrough: false
|
||||||
property real x: 80
|
property real x: 80
|
||||||
property real y: 250
|
property real y: 280
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ AbstractOverlayWidget {
|
|||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property Item contentItem
|
required property Item contentItem
|
||||||
|
property bool fancyBorders: true
|
||||||
|
|
||||||
required property var modelData
|
required property var modelData
|
||||||
readonly property string identifier: modelData.identifier
|
readonly property string identifier: modelData.identifier
|
||||||
@@ -29,6 +30,8 @@ AbstractOverlayWidget {
|
|||||||
property var persistentStateEntry: Persistent.states.overlay[identifier]
|
property var persistentStateEntry: Persistent.states.overlay[identifier]
|
||||||
property real radius: Appearance.rounding.windowRounding
|
property real radius: Appearance.rounding.windowRounding
|
||||||
property real minWidth: 250
|
property real minWidth: 250
|
||||||
|
property real padding: 6
|
||||||
|
property real contentRadius: radius - padding
|
||||||
|
|
||||||
draggable: GlobalStates.overlayOpen
|
draggable: GlobalStates.overlayOpen
|
||||||
x: Math.round(persistentStateEntry.x) // Round or it'll be blurry
|
x: Math.round(persistentStateEntry.x) // Round or it'll be blurry
|
||||||
@@ -96,11 +99,15 @@ AbstractOverlayWidget {
|
|||||||
Rectangle {
|
Rectangle {
|
||||||
id: border
|
id: border
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "transparent"
|
color: (root.fancyBorders && GlobalStates.overlayOpen) ? Appearance.colors.colLayer1 : "transparent"
|
||||||
radius: root.radius
|
radius: root.radius
|
||||||
border.color: ColorUtils.transparentize(Appearance.colors.colOutlineVariant, GlobalStates.overlayOpen ? 0 : 1)
|
border.color: ColorUtils.transparentize(Appearance.colors.colOutlineVariant, GlobalStates.overlayOpen ? 0 : 1)
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
animation: Appearance.animation.elementMoveFast.colorAnimation.createObject(this)
|
||||||
|
}
|
||||||
|
|
||||||
layer.enabled: GlobalStates.overlayOpen
|
layer.enabled: GlobalStates.overlayOpen
|
||||||
layer.effect: OpacityMask {
|
layer.effect: OpacityMask {
|
||||||
maskSource: Rectangle {
|
maskSource: Rectangle {
|
||||||
@@ -110,25 +117,23 @@ AbstractOverlayWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
ColumnLayout {
|
||||||
id: contentColumn
|
id: contentColumn
|
||||||
z: -1
|
z: root.fancyBorders ? 0 : -1
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
// Title bar
|
// Title bar
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: titleBar
|
id: titleBar
|
||||||
opacity: GlobalStates.overlayOpen ? 1 : 0
|
opacity: GlobalStates.overlayOpen ? 1 : 0
|
||||||
anchors {
|
Layout.fillWidth: true
|
||||||
left: parent.left
|
property real padding: 6
|
||||||
right: parent.right
|
|
||||||
}
|
|
||||||
property real padding: 2
|
|
||||||
implicitWidth: titleBarRow.implicitWidth + padding * 2
|
implicitWidth: titleBarRow.implicitWidth + padding * 2
|
||||||
implicitHeight: titleBarRow.implicitHeight + padding * 2
|
implicitHeight: titleBarRow.implicitHeight + padding * 2
|
||||||
color: Appearance.m3colors.m3surfaceContainer
|
color: root.fancyBorders ? "transparent" : Appearance.colors.colLayer1
|
||||||
border.color: Appearance.colors.colOutlineVariant
|
// border.color: Appearance.colors.colOutlineVariant
|
||||||
border.width: 1
|
// border.width: 1
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: titleBarRow
|
id: titleBarRow
|
||||||
@@ -191,7 +196,10 @@ AbstractOverlayWidget {
|
|||||||
// Content
|
// Content
|
||||||
Item {
|
Item {
|
||||||
id: contentContainer
|
id: contentContainer
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.margins: root.fancyBorders ? root.padding : 0
|
||||||
|
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||||
implicitWidth: root.contentItem.implicitWidth
|
implicitWidth: root.contentItem.implicitWidth
|
||||||
implicitHeight: root.contentItem.implicitHeight
|
implicitHeight: root.contentItem.implicitHeight
|
||||||
children: [root.contentItem]
|
children: [root.contentItem]
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import qs.modules.common
|
import qs.modules.common
|
||||||
import qs.modules.overlay
|
import qs.modules.overlay
|
||||||
|
|
||||||
StyledOverlayWidget {
|
StyledOverlayWidget {
|
||||||
id: root
|
id: root
|
||||||
contentItem: CrosshairContent {}
|
fancyBorders: false // Crosshair should be see-through
|
||||||
|
contentItem: CrosshairContent {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ StyledOverlayWidget {
|
|||||||
contentItem: Rectangle {
|
contentItem: Rectangle {
|
||||||
id: contentItem
|
id: contentItem
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
radius: root.contentRadius
|
||||||
color: Appearance.m3colors.m3surfaceContainer
|
color: Appearance.m3colors.m3surfaceContainer
|
||||||
property real padding: 8
|
property real padding: 8
|
||||||
implicitHeight: contentColumn.implicitHeight + padding * 2
|
implicitHeight: contentColumn.implicitHeight + padding * 2
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ StyledOverlayWidget {
|
|||||||
id: contentItem
|
id: contentItem
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Appearance.m3colors.m3surfaceContainer
|
color: Appearance.m3colors.m3surfaceContainer
|
||||||
|
radius: root.contentRadius
|
||||||
property real padding: 4
|
property real padding: 4
|
||||||
implicitWidth: 350
|
implicitWidth: 350
|
||||||
implicitHeight: 200
|
implicitHeight: 200
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ StyledOverlayWidget {
|
|||||||
contentItem: Rectangle {
|
contentItem: Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
color: Appearance.m3colors.m3surfaceContainer
|
color: Appearance.m3colors.m3surfaceContainer
|
||||||
|
radius: root.contentRadius
|
||||||
property real padding: 16
|
property real padding: 16
|
||||||
implicitHeight: 600
|
implicitHeight: 600
|
||||||
implicitWidth: 350
|
implicitWidth: 350
|
||||||
|
|||||||
Reference in New Issue
Block a user