aboutsummaryrefslogtreecommitdiffstats
path: root/config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml
diff options
context:
space:
mode:
authorDon Williams <don.e.williams@gmail.com>2026-07-13 15:58:40 -0400
committerPinapelz <yukais@pinapelz.com>2026-08-29 21:40:34 -0700
commit292b6daf5c56ff60a6263ff4945e74e5ca4372e7 (patch)
tree0c01784cf05adc8deec5a8a50fa71e1db294c96e /config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml
parent54b56290253719aa71d8ccfddff6fa0424e22804 (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/JustifiedLayout.qml')
-rw-r--r--config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml149
1 files changed, 149 insertions, 0 deletions
diff --git a/config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml b/config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml
new file mode 100644
index 00000000..655147b5
--- /dev/null
+++ b/config/quickshell/qs-hyprview-trixie/layouts/JustifiedLayout.qml
@@ -0,0 +1,149 @@
+pragma Singleton
+import Quickshell
+
+Singleton {
+ id: root
+
+ function doLayout(windowList, outerWidth, outerHeight) {
+ var N = windowList.length
+ if (N === 0)
+ return []
+
+ var containerWidth = outerWidth * 0.9
+ var containerHeight = outerHeight * 0.9
+
+ // Gap: 0.8% of screen, clamped between 12px and 32px
+ var rawGap = Math.min(outerWidth * 0.08, outerHeight * 0.08)
+ var gap = Math.max(12, Math.min(32, rawGap))
+
+ var maxThumbHeight = outerHeight * 0.3
+
+ if (containerWidth <= 0 || containerHeight <= 0) {
+ return windowList.map(function(item) {
+ return {
+ win: item.win,
+ x: 0,
+ y: 0,
+ width: 0,
+ height: 0
+ }
+ })
+ }
+
+ var targetRowH = maxThumbHeight
+ var rows = []
+ var currentRow = []
+ var sumAspect = 0
+
+ function flushRow() {
+ if (currentRow.length === 0)
+ return
+
+ var n = currentRow.length
+ var rowHeight = maxThumbHeight
+ if (sumAspect > 0) {
+ var totalGapWidth = gap * (n - 1)
+ var hFit = (containerWidth - totalGapWidth) / sumAspect
+ if (hFit < rowHeight)
+ rowHeight = hFit
+ }
+
+ if (rowHeight > maxThumbHeight)
+ rowHeight = maxThumbHeight
+ if (rowHeight <= 0)
+ rowHeight = 1
+
+ rows.push({
+ items: currentRow.slice(),
+ height: rowHeight,
+ sumAspect: sumAspect
+ })
+
+ currentRow = []
+ sumAspect = 0
+ }
+
+ for (var i = 0; i < N; ++i) {
+ var item = windowList[i]
+ var w0 = item.width > 0 ? item.width : 1
+ var h0 = item.height > 0 ? item.height : 1
+ var a = w0 / h0
+ item.aspect = a
+
+ if (currentRow.length > 0 &&
+ ((sumAspect + a) * targetRowH + gap * currentRow.length) > containerWidth) {
+ flushRow()
+ }
+
+ currentRow.push(item)
+ sumAspect += a
+ }
+
+ if (currentRow.length > 0) {
+ flushRow()
+ }
+
+ var totalRawHeight = 0
+ for (var r = 0; r < rows.length; ++r) {
+ totalRawHeight += rows[r].height
+ }
+ if (rows.length > 1) {
+ totalRawHeight += gap * (rows.length - 1)
+ }
+
+ var sV = 1.0
+ var availH = containerHeight
+ if (totalRawHeight > 0 && totalRawHeight > availH) {
+ sV = availH / totalRawHeight
+ }
+ if (sV <= 0)
+ sV = 0.1
+ if (sV > 1.0)
+ sV = 1.0
+
+ var gridTotalHeightScaled = totalRawHeight * sV
+ var yAcc = (outerHeight - gridTotalHeightScaled) / 2
+ if (!isFinite(yAcc) || yAcc < 0)
+ yAcc = 0
+
+ var result = []
+
+ for (var r2 = 0; r2 < rows.length; ++r2) {
+ var row = rows[r2]
+ var rowHeightScaled = row.height * sV
+
+ var rowWidthNoGapsScaled = 0
+ for (var j = 0; j < row.items.length; ++j) {
+ rowWidthNoGapsScaled += row.items[j].aspect * rowHeightScaled
+ }
+ var totalRowWidthScaled = rowWidthNoGapsScaled + gap * (row.items.length - 1)
+
+ var xAcc = (outerWidth - totalRowWidthScaled) / 2
+ if (!isFinite(xAcc))
+ xAcc = 0
+
+ for (var j2 = 0; j2 < row.items.length; ++j2) {
+ var it2 = row.items[j2]
+ var wScaled = it2.aspect * rowHeightScaled
+ var hScaled = rowHeightScaled
+
+ result.push({
+ win: it2.win,
+ x: xAcc,
+ y: yAcc,
+ width: wScaled,
+ height: hScaled
+ })
+
+ xAcc += wScaled + gap
+ }
+
+ yAcc += rowHeightScaled
+ if (r2 < rows.length - 1) {
+ yAcc += gap * sV
+ }
+ }
+
+ return result
+ }
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage