diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-07-13 15:58:40 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:40:34 -0700 |
| commit | 292b6daf5c56ff60a6263ff4945e74e5ca4372e7 (patch) | |
| tree | 0c01784cf05adc8deec5a8a50fa71e1db294c96e /config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml | |
| parent | 54b56290253719aa71d8ccfddff6fa0424e22804 (diff) | |
Creating an overview version that works with all branches
Signed-off-by: Don Williams <don.e.williams@gmail.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
new file: config/quickshell/overview-unified/README.md
new file: config/quickshell/overview-unified/assets/image.png
new file: config/quickshell/overview-unified/common/Appearance.qml
new file: config/quickshell/overview-unified/common/Config.qml
new file: config/quickshell/overview-unified/common/functions/ColorUtils.qml
new file: config/quickshell/overview-unified/common/functions/qmldir
new file: config/quickshell/overview-unified/common/qmldir
new file: config/quickshell/overview-unified/common/widgets/RectangularShadow.qml
new file: config/quickshell/overview-unified/common/widgets/StyledRectangularShadow.qml
new file: config/quickshell/overview-unified/common/widgets/StyledText.qml
new file: config/quickshell/overview-unified/common/widgets/StyledToolTip.qml
new file: config/quickshell/overview-unified/common/widgets/StyledToolTipContent.qml
new file: config/quickshell/overview-unified/common/widgets/qmldir
new file: config/quickshell/overview-unified/modules/overview/Overview.qml
new file: config/quickshell/overview-unified/modules/overview/OverviewWidget.qml
new file: config/quickshell/overview-unified/modules/overview/OverviewWindow.qml
new file: config/quickshell/overview-unified/modules/overview/qmldir
new file: config/quickshell/overview-unified/services/GlobalStates.qml
new file: config/quickshell/overview-unified/services/HyprlandData.qml
new file: config/quickshell/overview-unified/services/qmldir
new file: config/quickshell/overview-unified/shell.qml
new file: config/quickshell/qs-hyprview-trixie/LICENSE
new file: config/quickshell/qs-hyprview-trixie/README.md
new file: config/quickshell/qs-hyprview-trixie/common/Appearance.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/BandsLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/ColumnarLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/HeroLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/LayoutsManager.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/MasonryLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/SatelliteLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/SmartGridLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/SpiralLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/VortexLayout.qml
new file: config/quickshell/qs-hyprview-trixie/layouts/qmldir
new file: config/quickshell/qs-hyprview-trixie/modules/Hyprview.qml
new file: config/quickshell/qs-hyprview-trixie/modules/SearchBox.qml
new file: config/quickshell/qs-hyprview-trixie/modules/WindowThumbnail.qml
new file: config/quickshell/qs-hyprview-trixie/modules/qmldir
new file: config/quickshell/qs-hyprview-trixie/qs-hyprview-template.qml
new file: config/quickshell/qs-hyprview-trixie/screenshots/bands.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/hero.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/masonry.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/satellite.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/smartgrid.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/spiral.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/staggered.jpeg
new file: config/quickshell/qs-hyprview-trixie/screenshots/vortex.jpeg
new file: config/quickshell/qs-hyprview-trixie/shell.qml
Diffstat (limited to 'config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml')
| -rw-r--r-- | config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml b/config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml new file mode 100644 index 00000000..6a9deb3a --- /dev/null +++ b/config/quickshell/qs-hyprview-trixie/layouts/StarggeredLayout.qml @@ -0,0 +1,64 @@ +pragma Singleton +import Quickshell + +Singleton { + id: root + + function doLayout(windowList, outerWidth, outerHeight) { + var N = windowList.length + if (N === 0) return [] + + var gap = Math.max(10, outerWidth * 0.01) + + // Safe Area + var useW = outerWidth * 0.9 + var useH = outerHeight * 0.9 + var offX = (outerWidth - useW) / 2 + var offY = (outerHeight - useH) / 2 + + // Heuristic: roughly sqrt(N), but slightly weighted towards columns + // to accommodate 16:9 screens better. + var cols = Math.ceil(Math.sqrt(N * 1.5)) + var rows = Math.ceil(N / cols) + + // Calculate cell width. + // Note: In a staggered layout, the effective width needed is (cols + 0.5) + // because alternate rows are shifted by half a cell. + var cellW = (useW - (cols * gap)) / (cols + 0.5) + var cellH = (useH - (rows * gap)) / rows + + // Vertical centering of the whole block + var contentH = rows * cellH + (rows - 1) * gap + var startY = offY + (useH - contentH) / 2 + + var result = [] + + for (var i = 0; i < N; i++) { + var item = windowList[i] + + var r = Math.floor(i / cols) + var c = i % cols + + // Stagger offset: if row is odd, shift right by half cell width + var staggerOffset = (r % 2 === 1) ? (cellW / 2) : 0 + + var cellX = staggerOffset + c * (cellW + gap) + var cellY = r * (cellH + gap) + + // Aspect Fit + var w0 = (item.width > 0) ? item.width : 100 + var h0 = (item.height > 0) ? item.height : 100 + var sc = Math.min(cellW / w0, cellH / h0) + + // Center the thumbnail inside the calculated cell + result.push({ + win: item.win, + x: offX + cellX + (cellW - w0 * sc)/2, + y: startY + cellY + (cellH - h0 * sc)/2, + width: w0 * sc, + height: h0 * sc + }) + } + return result + } +} |
