last 7 months of qs changes
This commit is contained in:
parent
2c64563ade
commit
4b90113a54
103 changed files with 3467 additions and 1415 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import Quickshell.Hyprland
|
||||
import "root:/"
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
|
@ -11,11 +12,14 @@ Scope {
|
|||
|
||||
readonly property TooltipItem activeItem: activeMenu ?? activeTooltip;
|
||||
property TooltipItem lastActiveItem: null;
|
||||
readonly property TooltipItem shownItem: activeItem ?? lastActiveItem;
|
||||
property real hangTime: lastActiveItem?.hangTime ?? 0;
|
||||
|
||||
property Item tooltipItem: null;
|
||||
|
||||
onActiveItemChanged: {
|
||||
if (activeItem != null) {
|
||||
hangTimer.stop();
|
||||
activeItem.targetVisible = true;
|
||||
|
||||
if (tooltipItem) {
|
||||
|
|
@ -24,10 +28,12 @@ Scope {
|
|||
}
|
||||
|
||||
if (lastActiveItem != null && lastActiveItem != activeItem) {
|
||||
lastActiveItem.targetVisible = false;
|
||||
if (activeItem != null) lastActiveItem.targetVisible = false;
|
||||
else if (root.hangTime == 0) doLastHide();
|
||||
else hangTimer.start();
|
||||
}
|
||||
|
||||
lastActiveItem = activeItem;
|
||||
if (activeItem != null) lastActiveItem = activeItem;
|
||||
}
|
||||
|
||||
function setItem(item: TooltipItem) {
|
||||
|
|
@ -46,28 +52,59 @@ Scope {
|
|||
}
|
||||
}
|
||||
|
||||
function doLastHide() {
|
||||
lastActiveItem.targetVisible = false;
|
||||
}
|
||||
|
||||
function onHidden(item: TooltipItem) {
|
||||
if (item == lastActiveItem) {
|
||||
lastActiveItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: hangTimer
|
||||
interval: root.hangTime
|
||||
onTriggered: doLastHide();
|
||||
}
|
||||
|
||||
property real scaleMul: lastActiveItem && lastActiveItem.targetVisible ? 1 : 0;
|
||||
Behavior on scaleMul { SmoothedAnimation { velocity: 5 } }
|
||||
|
||||
LazyLoader {
|
||||
id: popupLoader
|
||||
activeAsync: activeItem != null
|
||||
activeAsync: shownItem != null
|
||||
|
||||
PopupWindow {
|
||||
id: popup
|
||||
parentWindow: bar
|
||||
relativeX: bar.tooltipXOffset
|
||||
relativeY: 0
|
||||
height: bar.height
|
||||
width: 1000//Math.max(1, widthAnim.running ? Math.max(tooltipItem.targetWidth, tooltipItem.lastTargetWidth) : tooltipItem.targetWidth)
|
||||
|
||||
anchor {
|
||||
window: bar
|
||||
rect.x: bar.tooltipXOffset
|
||||
rect.y: tooltipItem.highestAnimY
|
||||
adjustment: PopupAdjustment.None
|
||||
}
|
||||
|
||||
HyprlandWindow.opacity: root.scaleMul
|
||||
|
||||
//height: bar.height
|
||||
width: Math.max(700, tooltipItem.largestAnimWidth) // max due to qtwayland glitches
|
||||
height: {
|
||||
const h = tooltipItem.lowestAnimY - tooltipItem.highestAnimY
|
||||
//console.log(`seth ${h} ${tooltipItem.highestAnimY} ${tooltipItem.lowestAnimY}; ${tooltipItem.y1} ${tooltipItem.y2}`)
|
||||
return h
|
||||
}
|
||||
visible: true
|
||||
color: "transparent"
|
||||
//color: "#20000000"
|
||||
|
||||
mask: Region {
|
||||
item: (activeItem?.hoverable ?? false) ? tooltipItem : null
|
||||
item: (shownItem?.hoverable ?? false) ? tooltipItem : null
|
||||
}
|
||||
|
||||
HyprlandFocusGrab {
|
||||
active: activeItem?.isMenu ?? false
|
||||
windows: [ popup, bar ]
|
||||
windows: [ popup, bar, ...(activeItem?.grabWindows ?? []) ]
|
||||
onActiveChanged: {
|
||||
if (!active && activeItem?.isMenu) {
|
||||
activeMenu.close()
|
||||
|
|
@ -75,30 +112,76 @@ Scope {
|
|||
}
|
||||
}
|
||||
|
||||
/*Rectangle {
|
||||
color: "#10ff0000"
|
||||
//y: tooltipItem.highestAnimY
|
||||
height: tooltipItem.lowestAnimY - tooltipItem.highestAnimY
|
||||
width: parent.width
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: "#1000ff00"
|
||||
//y: tooltipItem.highestAnimY
|
||||
height: popup.height
|
||||
width: parent.width
|
||||
}*/
|
||||
|
||||
Item {
|
||||
id: tooltipItem
|
||||
Component.onCompleted: {
|
||||
root.tooltipItem = this;
|
||||
if (root.activeItem) {
|
||||
root.activeItem.parent = this;
|
||||
if (root.shownItem) {
|
||||
root.shownItem.parent = this;
|
||||
}
|
||||
|
||||
//highestAnimY = targetY - targetHeight / 2;
|
||||
//lowestAnimY = targetY + targetHeight / 2;
|
||||
}
|
||||
|
||||
transform: Scale {
|
||||
origin.x: 0
|
||||
origin.y: tooltipItem.height / 2
|
||||
xScale: 0.9 + scaleMul * 0.1
|
||||
yScale: xScale
|
||||
}
|
||||
|
||||
clip: width != targetWidth || height != targetHeight
|
||||
|
||||
// bkg
|
||||
BarWidgetInner {
|
||||
anchors.fill: parent
|
||||
color: ShellGlobals.colors.bar
|
||||
}
|
||||
|
||||
readonly property var targetWidth: shownItem?.implicitWidth ?? 0;
|
||||
readonly property var targetHeight: shownItem?.implicitHeight ?? 0;
|
||||
|
||||
property var largestAnimWidth: 0;
|
||||
property var highestAnimY: 0; // unused due to reposition timing issues
|
||||
property var lowestAnimY: bar.height;
|
||||
|
||||
onTargetWidthChanged: {
|
||||
if (targetWidth > largestAnimWidth) {
|
||||
largestAnimWidth = targetWidth;
|
||||
}
|
||||
}
|
||||
|
||||
readonly property var targetWidth: activeItem?.implicitWidth ?? 0;
|
||||
readonly property var targetHeight: activeItem?.implicitHeight ?? 0;
|
||||
onTargetYChanged: updateYBounds();
|
||||
onTargetHeightChanged: updateYBounds();
|
||||
function updateYBounds() {
|
||||
if (targetY - targetHeight / 2 < highestAnimY) {
|
||||
//highestAnimY = targetY - targetHeight / 2
|
||||
}
|
||||
|
||||
property var lastTargetWidthTracker: 0;
|
||||
property var lastTargetWidth: 0;
|
||||
|
||||
onTargetWidthChanged: {
|
||||
lastTargetWidth = lastTargetWidthTracker;
|
||||
lastTargetWidthTracker = targetWidth;
|
||||
if (targetY + targetHeight / 2 > lowestAnimY) {
|
||||
//lowestAnimY = targetY + targetHeight / 2
|
||||
}
|
||||
}
|
||||
|
||||
readonly property real targetY: {
|
||||
if (activeItem == null) return 0;
|
||||
const target = bar.contentItem.mapFromItem(activeItem.owner, 0, activeItem.targetRelativeY).y;
|
||||
return bar.boundedY(target, activeItem.implicitHeight / 2);
|
||||
if (shownItem == null) return 0;
|
||||
const target = bar.contentItem.mapFromItem(shownItem.owner, 0, shownItem.targetRelativeY).y;
|
||||
return bar.boundedY(target, shownItem.implicitHeight / 2);
|
||||
}
|
||||
|
||||
property var w: -1
|
||||
|
|
@ -107,15 +190,24 @@ Scope {
|
|||
property var y1: -1
|
||||
property var y2: -1
|
||||
|
||||
y: y1
|
||||
y: y1 - popup.anchor.rect.y
|
||||
height: y2 - y1
|
||||
|
||||
SmoothedAnimation {
|
||||
target: tooltipItem;
|
||||
property: "y1";
|
||||
readonly property bool anyAnimsRunning: y1Anim.running || y2Anim.running || widthAnim.running
|
||||
|
||||
onAnyAnimsRunningChanged: {
|
||||
if (!anyAnimsRunning) {
|
||||
largestAnimWidth = targetWidth
|
||||
//highestAnimY = y1;
|
||||
//lowestAnimY = y2;
|
||||
}
|
||||
}
|
||||
|
||||
SmoothedAnimation on y1 {
|
||||
id: y1Anim
|
||||
to: tooltipItem.targetY - tooltipItem.targetHeight / 2;
|
||||
onToChanged: {
|
||||
if (tooltipItem.y1 == -1 || !(activeItem?.animateSize ?? true)) {
|
||||
if (tooltipItem.y1 == -1 || !(shownItem?.animateSize ?? true)) {
|
||||
stop();
|
||||
tooltipItem.y1 = to;
|
||||
} else {
|
||||
|
|
@ -125,12 +217,11 @@ Scope {
|
|||
}
|
||||
}
|
||||
|
||||
SmoothedAnimation {
|
||||
target: tooltipItem
|
||||
property: "y2"
|
||||
SmoothedAnimation on y2 {
|
||||
id: y2Anim
|
||||
to: tooltipItem.targetY + tooltipItem.targetHeight / 2;
|
||||
onToChanged: {
|
||||
if (tooltipItem.y2 == -1 || !(activeItem?.animateSize ?? true)) {
|
||||
if (tooltipItem.y2 == -1 || !(shownItem?.animateSize ?? true)) {
|
||||
stop();
|
||||
tooltipItem.y2 = to;
|
||||
} else {
|
||||
|
|
@ -140,13 +231,11 @@ Scope {
|
|||
}
|
||||
}
|
||||
|
||||
SmoothedAnimation {
|
||||
SmoothedAnimation on w {
|
||||
id: widthAnim
|
||||
target: tooltipItem
|
||||
property: "w"
|
||||
to: tooltipItem.targetWidth;
|
||||
onToChanged: {
|
||||
if (tooltipItem.w == -1) {
|
||||
if (tooltipItem.w == -1 || !(shownItem?.animateSize ?? true)) {
|
||||
stop();
|
||||
tooltipItem.w = to;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue