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,14 +1,13 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import ".."
import "root:."
import "root:lock" as Lock
PanelWindow {
id: root
default property list<QtObject> widgetSurfaceData;
readonly property var widgetSurface: widgetSurface;
property list<var> overlays: [];
default property alias barItems: containment.data;
anchors {
left: true
@ -17,9 +16,25 @@ PanelWindow {
}
width: 70
margins.left: Lock.Controller.locked ? -width : 0
exclusiveZone: width - margins.left
color: "transparent"
WlrLayershell.namespace: "shell:bar"
readonly property var tooltip: tooltip;
Tooltip {
id: tooltip
bar: root
}
readonly property real tooltipXOffset: root.width + 2;
function boundedY(targetY: real, height: real): real {
return Math.max(barRect.anchors.topMargin + height, Math.min(barRect.height + barRect.anchors.topMargin - height, targetY))
}
Rectangle {
id: barRect
@ -43,72 +58,4 @@ PanelWindow {
}
}
}
// note: must be above the widgetSurface due to reload order
PersistentProperties {
id: persist
reloadableId: "persist"
property bool visible: false
}
onBackingWindowVisibleChanged: {
persist.visible = Qt.binding(() => backingWindowVisible);
}
PanelWindow {
id: widgetSurface
reloadableId: "widgetSurface"
visible: persist.visible
anchors: root.anchors
screen: root.screen
exclusionMode: ExclusionMode.Ignore
WlrLayershell.namespace: "shell:bar"
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
color: "transparent"
width: {
const extents = overlays
.filter(overlay => !overlay.fullyCollapsed)
.map(overlay => overlayXOffset + overlay.expandedWidth);
return Math.max(root.width, ...extents);
}
readonly property real overlayXOffset: root.width + 10;
readonly property real tooltipXOffset: root.width + 2;
function overlayRect(targetY: real, size: rect): rect {
const y = Math.max(barRect.y, Math.min((barRect.y + barRect.height) - size.height, targetY));
return Qt.rect(overlayXOffset, y, size.width, size.height);
}
function boundedY(targetY: real, height: real): real {
return Math.max(0, Math.min(barRect.height - height, targetY))
}
Item {
id: contentArea
data: widgetSurfaceData
}
readonly property var tooltip: tooltip;
Tooltip {
id: tooltip
bar: root
}
function repositionContentArea() {
// abusing the knowledge that both bars are in the same position onscreen
const contentRect = containment.mapToItem(root.contentItem, 0, 0, containment.width, containment.height)
contentArea.x = contentRect.x
contentArea.y = contentRect.y
contentArea.width = contentRect.width
contentArea.height = contentRect.height
}
}
onWindowTransformChanged: widgetSurface.repositionContentArea()
}