Huge quickshell progress dump

Was requested
This commit is contained in:
outfoxxed 2024-06-17 00:49:34 -07:00
parent 57d9f9a72e
commit 945793973e
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
42 changed files with 2140 additions and 142 deletions

View file

@ -1,19 +1,29 @@
import QtQuick
import Quickshell
import "root:/"
Item {
id: root
required property var tooltip;
required property Item owner;
property bool isMenu: false;
property bool hoverable: isMenu;
property bool animateSize: true;
property bool show: false;
property bool preloadBackground: root.visible;
property real targetRelativeY: owner.height / 2;
property real hangTime: isMenu ? 0 : 200;
signal close();
default property alias data: contentItem.data;
property Component backgroundComponent: BarWidgetInner {
color: ShellGlobals.colors.bar
anchors.fill: parent
}
onShowChanged: {
if (show) {
hangTimer.stop();
@ -28,4 +38,60 @@ Item {
interval: hangTime
onTriggered: tooltip.removeItem(root);
}
property bool targetVisible: false
property real targetOpacity: 0
opacity: targetOpacity / 1000
Behavior on targetOpacity {
id: opacityAnimation
SmoothedAnimation { velocity: 5000 }
}
function snapOpacity(opacity: real) {
opacityAnimation.enabled = false;
targetOpacity = opacity * 1000
opacityAnimation.enabled = true;
}
onTargetVisibleChanged: {
if (targetVisible) {
visible = true;
targetOpacity = 1000;
} else {
close()
targetOpacity = 0;
}
}
onTargetOpacityChanged: {
if (!targetVisible && targetOpacity == 0) {
visible = false;
this.parent = null;
}
}
anchors.fill: parent
visible: false
clip: true
implicitHeight: contentItem.implicitHeight + 10
implicitWidth: contentItem.implicitWidth + 10
readonly property Item item: contentItem;
Loader {
anchors.fill: parent
active: root.visible || root.preloadBackground
asynchronous: !root.visible && root.preloadBackground
sourceComponent: backgroundComponent
}
Item {
id: contentItem
anchors.fill: parent
anchors.margins: 5
implicitHeight: childrenRect.height
implicitWidth: childrenRect.width
}
}