This commit is contained in:
Damocles 2026-04-12 18:44:27 +02:00
parent 21f96dc68e
commit b06e3582ff
23 changed files with 597 additions and 197 deletions

View file

@ -16,7 +16,8 @@ M.BarSection {
property bool _osdActive: false
readonly property bool _showPanel: root._hovered || _panelHovered || _osdActive
onPercentChanged: if (percent > 0) _flashPanel()
onPercentChanged: if (percent > 0)
_flashPanel()
function _flashPanel() {
_osdActive = true;
@ -56,7 +57,8 @@ M.BarSection {
stdout: StdioCollector {
onStreamFinished: {
const dev = text.trim();
if (dev) root._blDev = "/sys/class/backlight/" + dev;
if (dev)
root._blDev = "/sys/class/backlight/" + dev;
}
}
}
@ -114,10 +116,7 @@ M.BarSection {
anchors.left: true
margins.top: 0
margins.left: Math.max(0, Math.min(
Math.round(root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) - implicitWidth / 2),
(panel.screen?.width ?? 1920) - implicitWidth
))
margins.left: Math.max(0, Math.min(Math.round(root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0) - implicitWidth / 2), (panel.screen?.width ?? 1920) - implicitWidth))
implicitWidth: panelContent.width
implicitHeight: panelContent.height
@ -138,14 +137,38 @@ M.BarSection {
ParallelAnimation {
id: showAnim
NumberAnimation { target: panelContent; property: "opacity"; to: 1; duration: 120; easing.type: Easing.OutCubic }
NumberAnimation { target: panelContent; property: "y"; to: 0; duration: 150; easing.type: Easing.OutCubic }
NumberAnimation {
target: panelContent
property: "opacity"
to: 1
duration: 120
easing.type: Easing.OutCubic
}
NumberAnimation {
target: panelContent
property: "y"
to: 0
duration: 150
easing.type: Easing.OutCubic
}
}
ParallelAnimation {
id: hideAnim
NumberAnimation { target: panelContent; property: "opacity"; to: 0; duration: 150; easing.type: Easing.InCubic }
NumberAnimation { target: panelContent; property: "y"; to: -panelContent.height; duration: 150; easing.type: Easing.InCubic }
NumberAnimation {
target: panelContent
property: "opacity"
to: 0
duration: 150
easing.type: Easing.InCubic
}
NumberAnimation {
target: panelContent
property: "y"
to: -panelContent.height
duration: 150
easing.type: Easing.InCubic
}
onFinished: panel._winVisible = false
}
@ -210,7 +233,11 @@ M.BarSection {
color: M.Theme.base0A
radius: 3
Behavior on width { NumberAnimation { duration: 80 } }
Behavior on width {
NumberAnimation {
duration: 80
}
}
}
MouseArea {
@ -218,7 +245,10 @@ M.BarSection {
anchors.margins: -6
cursorShape: Qt.PointingHandCursor
onPressed: mouse => _set(mouse)
onPositionChanged: mouse => { if (pressed) _set(mouse); }
onPositionChanged: mouse => {
if (pressed)
_set(mouse);
}
function _set(mouse) {
root.setPercent(mouse.x / slider.width * 100);
}