diff options
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/launcher/Background.qml | 2 | ||||
| -rw-r--r-- | modules/launcher/Content.qml | 1 | ||||
| -rw-r--r-- | modules/launcher/Launcher.qml | 2 | ||||
| -rw-r--r-- | modules/launcher/Wrapper.qml | 2 | ||||
| -rw-r--r-- | modules/osd/Background.qml | 61 | ||||
| -rw-r--r-- | modules/osd/Content.qml | 42 | ||||
| -rw-r--r-- | modules/osd/Osd.qml | 89 | ||||
| -rw-r--r-- | modules/osd/Wrapper.qml | 62 |
8 files changed, 256 insertions, 5 deletions
diff --git a/modules/launcher/Background.qml b/modules/launcher/Background.qml index 8cfaac8..0e9f7dd 100644 --- a/modules/launcher/Background.qml +++ b/modules/launcher/Background.qml @@ -11,8 +11,6 @@ Shape { readonly property int roundingY: Math.min(rounding, realWrapperHeight / 2) readonly property real wrapperHeight: realWrapperHeight - 1 // Pixel issues :sob: - anchors.bottom: parent.bottom - preferredRendererType: Shape.CurveRenderer opacity: Appearance.transparency.enabled ? Appearance.transparency.base : 1 diff --git a/modules/launcher/Content.qml b/modules/launcher/Content.qml index 9759abb..315835e 100644 --- a/modules/launcher/Content.qml +++ b/modules/launcher/Content.qml @@ -33,7 +33,6 @@ Item { anchors.horizontalCenter: parent.horizontalCenter anchors.bottom: search.top anchors.bottomMargin: root.spacing - anchors.margins: root.padding ContentList { id: list diff --git a/modules/launcher/Launcher.qml b/modules/launcher/Launcher.qml index bbd2f91..34e592a 100644 --- a/modules/launcher/Launcher.qml +++ b/modules/launcher/Launcher.qml @@ -34,6 +34,7 @@ Scope { id: bg anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom wrapperWidth: wrapper.width realWrapperHeight: Math.min(wrapper.height, content.height) @@ -43,6 +44,7 @@ Scope { id: wrapper anchors.horizontalCenter: parent.horizontalCenter + anchors.bottom: parent.bottom implicitWidth: content.width + bg.rounding * 2 diff --git a/modules/launcher/Wrapper.qml b/modules/launcher/Wrapper.qml index 132a130..d221a0b 100644 --- a/modules/launcher/Wrapper.qml +++ b/modules/launcher/Wrapper.qml @@ -8,8 +8,6 @@ Item { required property real contentHeight property bool shouldBeVisible - anchors.bottom: parent.bottom - height: 0 clip: true diff --git a/modules/osd/Background.qml b/modules/osd/Background.qml new file mode 100644 index 0000000..e0383f5 --- /dev/null +++ b/modules/osd/Background.qml @@ -0,0 +1,61 @@ +import "root:/config" +import QtQuick +import QtQuick.Shapes + +Shape { + id: root + + required property real realWrapperWidth + required property real wrapperHeight + readonly property int rounding: Appearance.rounding.large + readonly property int roundingX: Math.min(rounding, realWrapperWidth / 2) + readonly property real wrapperWidth: realWrapperWidth - 1 // Pixel issues :sob: + + preferredRendererType: Shape.CurveRenderer + opacity: Appearance.transparency.enabled ? Appearance.transparency.base : 1 + + ShapePath { + strokeWidth: -1 + fillColor: Appearance.colours.m3surfaceContainer + + startX: root.wrapperWidth + + PathArc { + relativeX: -root.roundingX + relativeY: root.rounding + radiusX: root.roundingX + radiusY: root.rounding + } + PathLine { + x: root.roundingX + relativeY: 0 + } + PathArc { + relativeX: -root.roundingX + relativeY: root.rounding + radiusX: root.roundingX + radiusY: root.rounding + direction: PathArc.Counterclockwise + } + PathLine { + y: root.wrapperHeight - root.rounding * 2 + } + PathArc { + relativeX: root.roundingX + relativeY: root.rounding + radiusX: root.roundingX + radiusY: root.rounding + direction: PathArc.Counterclockwise + } + PathLine { + x: root.wrapperWidth - root.roundingX + relativeY: 0 + } + PathArc { + relativeX: root.roundingX + relativeY: root.rounding + radiusX: root.roundingX + radiusY: root.rounding + } + } +} diff --git a/modules/osd/Content.qml b/modules/osd/Content.qml new file mode 100644 index 0000000..daab4e2 --- /dev/null +++ b/modules/osd/Content.qml @@ -0,0 +1,42 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell +import QtQuick + +Column { + id: root + + required property ShellScreen screen + + padding: Appearance.padding.large + + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + + spacing: Appearance.spacing.normal + + VerticalSlider { + icon: { + if (Audio.muted) + return "no_sound"; + if (value >= 0.5) + return "volume_up"; + if (value > 0) + return "volume_down"; + return "volume_mute"; + } + value: Audio.volume + onMoved: Audio.setVolume(value) + + implicitWidth: OsdConfig.sizes.sliderWidth + implicitHeight: OsdConfig.sizes.sliderHeight + } + + VerticalSlider { + icon: "brightness_6" + + implicitWidth: OsdConfig.sizes.sliderWidth + implicitHeight: OsdConfig.sizes.sliderHeight + } +} diff --git a/modules/osd/Osd.qml b/modules/osd/Osd.qml new file mode 100644 index 0000000..4d744f6 --- /dev/null +++ b/modules/osd/Osd.qml @@ -0,0 +1,89 @@ +import "root:/widgets" +import "root:/services" +import "root:/config" +import Quickshell +import QtQuick + +Scope { + id: root + + property bool osdVisible + + function show(): void { + root.osdVisible = true; + timer.restart(); + } + + Connections { + target: Audio + + function onMutedChanged(): void { + root.show(); + } + + function onVolumeChanged(): void { + root.show(); + } + } + + Timer { + id: timer + + interval: OsdConfig.hideDelay + onTriggered: root.osdVisible = false + } + + Variants { + model: Quickshell.screens + + LazyLoader { + loading: true + + required property ShellScreen modelData + + StyledWindow { + id: win + + screen: parent.modelData + name: "osd" + visible: wrapper.shouldBeVisible + + mask: Region { + item: wrapper + } + + anchors.left: true + anchors.right: true + height: wrapper.height + + Background { + id: bg + + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + + wrapperHeight: wrapper.height + realWrapperWidth: Math.min(wrapper.width, content.width) + } + + 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 + + screen: parent.modelData + } + } + } + } + } +} diff --git a/modules/osd/Wrapper.qml b/modules/osd/Wrapper.qml new file mode 100644 index 0000000..92bd3c2 --- /dev/null +++ b/modules/osd/Wrapper.qml @@ -0,0 +1,62 @@ +import "root:/config" +import QtQuick + +Item { + id: root + + required property bool osdVisible + required property real contentWidth + property bool shouldBeVisible + + width: 0 + clip: true + + states: State { + name: "visible" + when: root.osdVisible + + PropertyChanges { + root.width: contentWidth + root.shouldBeVisible: true + } + } + + transitions: [ + Transition { + from: "" + to: "visible" + + SequentialAnimation { + PropertyAction { + target: root + property: "shouldBeVisible" + } + NumberAnimation { + target: root + property: "width" + duration: Appearance.anim.durations.large + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedDecel + } + } + }, + Transition { + from: "visible" + to: "" + + SequentialAnimation { + NumberAnimation { + target: root + property: "width" + duration: Appearance.anim.durations.normal + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.emphasizedAccel + } + PropertyAction { + target: root + property: "shouldBeVisible" + } + } + } + ] +} |