This commit is contained in:
pika 2025-06-10 15:34:15 +02:00
parent 32edcff102
commit 0296117901
110 changed files with 9713 additions and 5 deletions

View file

@ -0,0 +1,63 @@
import "root:/services"
import "root:/config"
import QtQuick
import QtQuick.Shapes
ShapePath {
id: root
required property Wrapper wrapper
readonly property real rounding: BorderConfig.rounding
readonly property bool flatten: wrapper.width < rounding * 2
readonly property real roundingX: flatten ? wrapper.width / 2 : rounding
strokeWidth: -1
fillColor: BorderConfig.colour
PathArc {
relativeX: -root.roundingX
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 * 2
}
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
}
Behavior on fillColor {
ColorAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}

43
modules/osd/Content.qml Normal file
View file

@ -0,0 +1,43 @@
import "root:/widgets"
import "root:/services"
import "root:/config"
import QtQuick
Column {
id: root
required property Brightness.Monitor monitor
padding: Appearance.padding.large
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
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_${(Math.round(value * 6) + 1)}`
value: root.monitor?.brightness ?? 0
onMoved: root.monitor?.setBrightness(value)
implicitWidth: OsdConfig.sizes.sliderWidth
implicitHeight: OsdConfig.sizes.sliderHeight
}
}

View file

@ -0,0 +1,48 @@
import "root:/services"
import "root:/config"
import Quickshell
import QtQuick
Scope {
id: root
required property ShellScreen screen
required property PersistentProperties visibilities
required property bool hovered
readonly property Brightness.Monitor monitor: Brightness.getMonitorForScreen(screen)
function show(): void {
root.visibilities.osd = true;
timer.restart();
}
Connections {
target: Audio
function onMutedChanged(): void {
root.show();
}
function onVolumeChanged(): void {
root.show();
}
}
Connections {
target: root.monitor
function onBrightnessChanged(): void {
root.show();
}
}
Timer {
id: timer
interval: OsdConfig.hideDelay
onTriggered: {
if (!root.hovered)
root.visibilities.osd = false;
}
}
}

57
modules/osd/Wrapper.qml Normal file
View file

@ -0,0 +1,57 @@
import "root:/services"
import "root:/config"
import Quickshell
import QtQuick
Item {
id: root
required property ShellScreen screen
required property bool visibility
visible: width > 0
implicitWidth: 0
implicitHeight: content.implicitHeight
states: State {
name: "visible"
when: root.visibility
PropertyChanges {
root.implicitWidth: content.implicitWidth
}
}
transitions: [
Transition {
from: ""
to: "visible"
NumberAnimation {
target: root
property: "implicitWidth"
duration: Appearance.anim.durations.expressiveFastSpatial
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
}
},
Transition {
from: "visible"
to: ""
NumberAnimation {
target: root
property: "implicitWidth"
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.emphasized
}
}
]
Content {
id: content
monitor: Brightness.getMonitorForScreen(root.screen)
}
}