Lots of uncommitted changes

This commit is contained in:
outfoxxed 2024-05-08 14:18:44 -07:00
parent daace49bfc
commit 497ca48ada
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
27 changed files with 909 additions and 134 deletions

View file

@ -0,0 +1,114 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
import ".."
PanelWindow {
id: root
default property list<QtObject> widgetSurfaceData;
readonly property var widgetSurface: widgetSurface;
property list<var> overlays: [];
anchors {
left: true
top: true
bottom: true
}
width: 70
color: "transparent"
WlrLayershell.namespace: "shell:bar"
Rectangle {
id: barRect
anchors {
fill: parent
margins: 10
rightMargin: 5
}
color: ShellGlobals.colors.bar
radius: 5
border.color: ShellGlobals.colors.barOutline
border.width: 1
Item {
id: containment
anchors {
fill: parent
margins: 5
}
}
}
// 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()
}