diff options
| author | Don Williams <Don.e.williams@gmail.com> | 2026-07-11 04:31:59 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:40:34 -0700 |
| commit | 1ee78be8453f86ef366fe7a73e4e8cf245d2d336 (patch) | |
| tree | 72fbbfa17e61299f3eb400b6fd5a27ec52f9b291 /config/quickshell/qs-hyprview/layouts/StarggeredLayout.qml | |
| parent | 4d39fc9670d5cb0b3e0624ead386d30db3b8110f (diff) | |
Added qs-hyprview as alternative overview
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:
deleted: ./
new file: LICENSE
new file: README.md
new file: common/Appearance.qml
new file: layouts/BandsLayout.qml
new file: layouts/ColumnarLayout.qml
new file: layouts/HeroLayout.qml
new file: layouts/JustifiedLayout.qml
new file: layouts/LayoutsManager.qml
new file: layouts/MasonryLayout.qml
new file: layouts/SatelliteLayout.qml
new file: layouts/SmartGridLayout.qml
new file: layouts/SpiralLayout.qml
new file: layouts/StarggeredLayout.qml
new file: layouts/VortexLayout.qml
new file: layouts/qmldir
new file: modules/Hyprview.qml
new file: modules/SearchBox.qml
new file: modules/WindowThumbnail.qml
new file: modules/qmldir
new file: qs-hyprview-template.qml
new file: screenshots/bands.jpeg
new file: screenshots/hero.jpeg
new file: screenshots/masonry.jpeg
new file: screenshots/satellite.jpeg
new file: screenshots/smartgrid.jpeg
new file: screenshots/spiral.jpeg
new file: screenshots/staggered.jpeg
new file: screenshots/vortex.jpeg
new file: shell.qml
Diffstat (limited to 'config/quickshell/qs-hyprview/layouts/StarggeredLayout.qml')
| -rw-r--r-- | config/quickshell/qs-hyprview/layouts/StarggeredLayout.qml | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/config/quickshell/qs-hyprview/layouts/StarggeredLayout.qml b/config/quickshell/qs-hyprview/layouts/StarggeredLayout.qml new file mode 100644 index 00000000..6a9deb3a --- /dev/null +++ b/config/quickshell/qs-hyprview/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 + } +} |
