C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 20s
JS/TS / lint (pull_request) Successful in 22s
Python / static (pull_request) Successful in 57s
Rust / fmt (pull_request) Successful in 1m2s
C++ / build (pull_request) Successful in 2m10s
Rust / build (pull_request) Successful in 1m50s
Rust / clippy (pull_request) Successful in 1m25s
Python / verify (pull_request) Successful in 2m58s
C++ / clang-tidy (pull_request) Successful in 7m8s
89 lines
2.4 KiB
QML
89 lines
2.4 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import qs.Components
|
|
import ZShell.Config
|
|
|
|
Item {
|
|
id: root
|
|
|
|
required property real borderThickness
|
|
readonly property alias content: content
|
|
readonly property bool horizontal: position !== "left"
|
|
// property real offsetScale: y > 0 || content.hasCurrent ? 0 : 1
|
|
property real offsetScale: {
|
|
if (content.hasCurrent)
|
|
return 0;
|
|
if (position === "top")
|
|
return y > 0 ? 0 : 1;
|
|
if (position === "bottom")
|
|
return 1;
|
|
return x > 0 ? 0 : 1;
|
|
}
|
|
required property string position
|
|
required property ShellScreen screen
|
|
|
|
anchors.bottom: position === "bottom" ? parent.bottom : undefined
|
|
clip: true
|
|
implicitHeight: horizontal ? content.implicitHeight * (1 - offsetScale) : content.implicitHeight
|
|
implicitWidth: horizontal ? content.implicitWidth : content.implicitWidth * (1 - offsetScale)
|
|
visible: width > 0 && height > 0
|
|
x: {
|
|
if (!horizontal)
|
|
return 0;
|
|
const off = content.currentCenter - borderThickness - content.nonAnimWidth / 2;
|
|
const diff = parent.width - Math.floor(off + content.nonAnimWidth);
|
|
if (diff < 0)
|
|
return off + diff;
|
|
return Math.floor(Math.max(off, 0));
|
|
}
|
|
y: {
|
|
if (horizontal)
|
|
return 0;
|
|
|
|
const off = content.currentCenter - borderThickness - content.nonAnimHeight / 2;
|
|
const diff = parent.height - Math.floor(off + content.nonAnimHeight);
|
|
if (diff < 0)
|
|
return off + diff;
|
|
return Math.max(off, 0);
|
|
}
|
|
|
|
Behavior on offsetScale {
|
|
Anim {
|
|
}
|
|
}
|
|
Behavior on x {
|
|
enabled: !root.horizontal || root.offsetScale < 1
|
|
|
|
Anim {
|
|
duration: content.animLength
|
|
easing: content.animCurve
|
|
}
|
|
}
|
|
Behavior on y {
|
|
enabled: root.horizontal || root.offsetScale < 1
|
|
|
|
Anim {
|
|
duration: content.animLength
|
|
easing: content.animCurve
|
|
}
|
|
}
|
|
|
|
Wrapper {
|
|
id: content
|
|
|
|
anchors.bottom: root.position === "bottom" ? parent.bottom : undefined
|
|
anchors.bottomMargin: (-implicitHeight - 5) * root.offsetScale
|
|
anchors.horizontalCenter: root.horizontal ? parent.horizontalCenter : undefined
|
|
anchors.left: root.horizontal ? undefined : parent.left
|
|
anchors.leftMargin: (-implicitWidth - 5) * root.offsetScale
|
|
anchors.top: root.position === "top" ? parent.top : undefined
|
|
anchors.topMargin: (-implicitHeight - 5) * root.offsetScale
|
|
anchors.verticalCenter: root.horizontal ? undefined : parent.verticalCenter
|
|
horizontal: root.horizontal
|
|
offsetScale: root.offsetScale
|
|
screen: root.screen
|
|
}
|
|
}
|