auroraa718c55
aurora: animate the overview
+14 −2
1 file changed
| @@ -7,12 +7,17 @@ import Quickshell.Hyprland | |||
| 7 | 7 | // Window overview for one monitor: its 10 workspaces as scaled boxes with live window previews. | |
| 8 | 8 | // Click a window = focus, click a workspace = switch, drag a window onto another box = move. | |
| 9 | 9 | // Type to filter by title/class, Enter focuses the first match, Esc closes. | |
| 10 | + | // Opens like zooming out of the desktop: the scrim fades in, the filter drops in and the workspaces settle into | |
| 11 | + | // place in a short wave (all driven by `t`, reversed on close; instant with animations off). | |
| 10 | 12 | PanelWindow { | |
| 11 | 13 | id: win | |
| 12 | 14 | property bool opened: false | |
| 13 | 15 | signal closeRequested() | |
| 14 | 16 | ||
| 15 | − | visible: opened | |
| 17 | + | property real t: opened ? 1 : 0 | |
| 18 | + | Behavior on t { NumberAnimation { duration: Theme.t * 1.4; easing.type: Easing.BezierSpline; easing.bezierCurve: Theme.glide } } | |
| 19 | + | ||
| 20 | + | visible: t > 0 | |
| 16 | 21 | anchors { top: true; bottom: true; left: true; right: true } | |
| 17 | 22 | exclusionMode: ExclusionMode.Ignore | |
| 18 | 23 | color: "transparent" | |
| @@ -74,6 +79,7 @@ PanelWindow { | |||
| 74 | 79 | Rectangle { | |
| 75 | 80 | anchors.fill: parent | |
| 76 | 81 | color: Theme.scrim | |
| 82 | + | opacity: win.t | |
| 77 | 83 | MouseArea { anchors.fill: parent; onClicked: win.closeRequested() } | |
| 78 | 84 | } | |
| 79 | 85 | ||
| @@ -87,6 +93,8 @@ PanelWindow { | |||
| 87 | 93 | RowLayout { | |
| 88 | 94 | Layout.alignment: Qt.AlignHCenter | |
| 89 | 95 | spacing: 8 | |
| 96 | + | opacity: win.t | |
| 97 | + | transform: Translate { y: -20 * (1 - win.t) } | |
| 90 | 98 | Rectangle { | |
| 91 | 99 | implicitWidth: 520 | |
| 92 | 100 | implicitHeight: 56 | |
| @@ -162,6 +170,10 @@ PanelWindow { | |||
| 162 | 170 | id: box | |
| 163 | 171 | required property int index | |
| 164 | 172 | readonly property int wsId: win.offset + index + 1 | |
| 173 | + | // this box's share of the open animation: each starts a little after the one before | |
| 174 | + | readonly property real p: Math.max(0, Math.min(1, (win.t - index * 0.03) / 0.73)) | |
| 175 | + | opacity: p | |
| 176 | + | scale: 1.08 - 0.08 * p | |
| 165 | 177 | readonly property bool current: win.activeWs !== null && win.activeWs.id === wsId | |
| 166 | 178 | readonly property real originX: (grid.width - (grid.boxW * grid.cols + grid.gap * (grid.cols - 1))) / 2 | |
| 167 | 179 | x: originX + (index % grid.cols) * (grid.boxW + grid.gap) | |
| @@ -229,7 +241,7 @@ PanelWindow { | |||
| 229 | 241 | id: shot | |
| 230 | 242 | anchors.fill: parent | |
| 231 | 243 | anchors.margins: 1 | |
| 232 | − | captureSource: win.opened && tile.modelData.wayland ? tile.modelData.wayland : null | |
| 244 | + | captureSource: win.visible && tile.modelData.wayland ? tile.modelData.wayland : null | |
| 233 | 245 | live: true | |
| 234 | 246 | } | |
| 235 | 247 | Image { // big centred icon until the preview arrives, then a corner badge | |