Updates, fix bar, add walker

This commit is contained in:
outfoxxed 2024-03-27 06:11:42 -07:00
parent 3b587f3e15
commit 2bfdda55d4
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
12 changed files with 284 additions and 161 deletions

View file

@ -6,15 +6,24 @@ import Quickshell.Wayland
PanelWindow {
id: root
PopupSurface {
id: popupSurface
screen: root.screen
bar: barRect
visible: false
PersistentProperties {
id: persist
reloadableId: "persist"
property bool barVisible: false
}
onWindowConnected: {
popupSurface.visible = true
PopupSurface {
id: popupSurface
reloadableId: "popupSurface"
screen: root.screen
bar: barRect
visible: persist.barVisible
}
onBackingWindowVisibleChanged: {
persist.barVisible = Qt.binding(() => backingWindowVisible);
}
anchors {
@ -52,9 +61,11 @@ PanelWindow {
left: parent.left
right: parent.right
}
ClockWidget {
Layout.fillWidth: true
popupSurface: popupSurface
barWindow: root
}
}
}

View file

@ -2,8 +2,8 @@ import QtQuick
import QtQuick.Layouts
OverlayWidget {
expandedWidth: 100
expandedHeight: 100
expandedWidth: 600
expandedHeight: 600
BarWidgetInner {
implicitHeight: layout.implicitHeight

View file

@ -7,6 +7,8 @@ Item {
required property real expandedHeight;
required default property Item widget;
required property var barWindow;
property bool expanded: false;
onExpandedChanged: {
@ -23,20 +25,22 @@ Item {
}
readonly property rect collapsedLayerRect: {
//console.log(`schrodinger's coordinate space: ${popupSurface.width} ${popupSurface.height}`);
const w = popupSurface.width;
const h = popupSurface.height;
void [barWindow.windowTransform, popupSurface.windowTransform];
return this.mapToItem(popupSurface.contentItem, 0, 0, width, height);
}
readonly property rect expandedLayerRect: popupSurface.expandedPosition(this)
readonly property rect layerRect: {
const [p, xCurve, yCurve] = [animationProgress, ShellGlobals.popoutXCurve, ShellGlobals.popoutYCurve];
return Qt.rect(
ShellGlobals.popoutXCurve.interpolate(animationProgress, collapsedLayerRect.x, expandedLayerRect.x),
ShellGlobals.popoutYCurve.interpolate(animationProgress, collapsedLayerRect.y, expandedLayerRect.y),
ShellGlobals.popoutXCurve.interpolate(animationProgress, collapsedLayerRect.width, expandedLayerRect.width),
ShellGlobals.popoutYCurve.interpolate(animationProgress, collapsedLayerRect.height, expandedLayerRect.height),
xCurve.interpolate(p, collapsedLayerRect.x, expandedLayerRect.x),
yCurve.interpolate(p, collapsedLayerRect.y, expandedLayerRect.y),
xCurve.interpolate(p, collapsedLayerRect.width, expandedLayerRect.width),
yCurve.interpolate(p, collapsedLayerRect.height, expandedLayerRect.height),
);
}
@ -50,6 +54,7 @@ Item {
widget.width = Qt.binding(() => layerRect.width);
widget.height = Qt.binding(() => layerRect.height);
}
Component.onDestruction: {
popupSurface.disconnectOverlay(this)
}

View file

@ -1,3 +1,4 @@
import QtQuick
import Quickshell
import Quickshell.Wayland
@ -18,11 +19,16 @@ WlrLayershell {
lastActiveOverlay = activeOverlay;
}
readonly property rect barRect: this.contentItem.mapFromItem(bar, 0, 0, bar.width, bar.height)
readonly property rect barRect: {
void [width, height];
this.contentItem.mapFromItem(bar, 0, 0, bar.width, bar.height)
}
readonly property real overlayXOffset: barRect.x + barRect.width + 10
exclusionMode: ExclusionMode.Ignore
color: "transparent"
namespace: "shell:bar"
Variants {
@ -31,7 +37,7 @@ WlrLayershell {
Region {
required property var modelData;
item: modelData == undefined ? null : modelData.widget
item: modelData.widget
}
}
@ -47,7 +53,7 @@ WlrLayershell {
width: {
const extents = overlays
.filter(overlay => overlay != undefined && !overlay.fullyCollapsed)
.filter(overlay => !overlay.fullyCollapsed)
.map(overlay => overlayXOffset + overlay.expandedWidth);
return Math.max(barRect.x + barRect.width, ...extents);
@ -59,8 +65,9 @@ WlrLayershell {
}
function disconnectOverlay(overlay: variant) {
const index = overlays.indexOf(overlay);
if (index != -1) overlays.splice(index, 1);
// Splice seems to make it undefined as an intermediary step
// which breaks bindings.
overlays = overlays.filter(o => o != overlay);
}
function expandedPosition(overlay: variant): rect {

View file

@ -5,9 +5,9 @@ import Quickshell
Singleton {
readonly property var colors: QtObject {
readonly property var bar: "#30e0ffff";
readonly property var bar: "#30c0ffff";
readonly property var barOutline: "#50ffffff";
readonly property var widget: "#40e0ffff";
readonly property var widget: "#40ceffff";
readonly property var widgetOutline: "#60ffffff";
}

View file

@ -21,6 +21,7 @@ ShellRoot {
screen: modelData
WlrLayershell.layer: WlrLayer.Background
WlrLayershell.namespace: "shell:background"
anchors {
top: true