├── screenshots ├── bands.jpeg ├── hero.jpeg ├── spiral.jpeg ├── vortex.jpeg ├── masonry.jpeg ├── satellite.jpeg ├── smartgrid.jpeg └── staggered.jpeg ├── modules ├── qmldir ├── SearchBox.qml ├── WindowThumbnail.qml └── Hyprview.qml ├── shell.qml ├── layouts ├── qmldir ├── LayoutsManager.qml ├── StarggeredLayout.qml ├── ColumnarLayout.qml ├── VortexLayout.qml ├── SatelliteLayout.qml ├── JustifiedLayout.qml ├── SmartGridLayout.qml ├── MasonryLayout.qml ├── HeroLayout.qml ├── SpiralLayout.qml └── BandsLayout.qml ├── README.md └── LICENSE /screenshots/bands.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/bands.jpeg -------------------------------------------------------------------------------- /screenshots/hero.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/hero.jpeg -------------------------------------------------------------------------------- /screenshots/spiral.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/spiral.jpeg -------------------------------------------------------------------------------- /screenshots/vortex.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/vortex.jpeg -------------------------------------------------------------------------------- /screenshots/masonry.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/masonry.jpeg -------------------------------------------------------------------------------- /screenshots/satellite.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/satellite.jpeg -------------------------------------------------------------------------------- /screenshots/smartgrid.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/smartgrid.jpeg -------------------------------------------------------------------------------- /screenshots/staggered.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dom0/qs-hyprview/HEAD/screenshots/staggered.jpeg -------------------------------------------------------------------------------- /modules/qmldir: -------------------------------------------------------------------------------- 1 | Hyprview 1.0 Hyprview.qml 2 | WindowThumbnail 1.0 WindowThumbnail.qml 3 | SearchBox 1.0 SearchBox.qml 4 | -------------------------------------------------------------------------------- /shell.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import Quickshell 3 | import "./modules" 4 | 5 | ShellRoot { 6 | Hyprview { 7 | liveCapture: false 8 | moveCursorToActiveWindow: false 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /layouts/qmldir: -------------------------------------------------------------------------------- 1 | singleton HeroLayout 1.0 HeroLayout.qml 2 | singleton JustifiedLayout 1.0 JustifiedLayout.qml 3 | singleton MasonryLayout 1.0 MasonryLayout.qml 4 | singleton SmartGridLayout 1.0 SmartGridLayout.qml 5 | singleton SpiralLayout 1.0 SpiralLayout.qml 6 | singleton BandsLayout 1.0 BandsLayout.qml 7 | singleton SatelliteLayout 1.0 SatelliteLayout.qml 8 | singleton StarggeredLayout 1.0 StarggeredLayout.qml 9 | singleton ColumnarLayout 1.0 ColumnarLayout.qml 10 | singleton VortexLayout 1.0 VortexLayout.qml 11 | 12 | singleton LayoutsManager 1.0 LayoutsManager.qml 13 | -------------------------------------------------------------------------------- /modules/SearchBox.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import Quickshell 3 | 4 | Rectangle { 5 | id: searchBar 6 | width: Math.min(parent.width * 0.6, 480) 7 | height: 40 8 | radius: 20 9 | color: "#66000000" 10 | border.width: 1 11 | border.color: "#33ffffff" 12 | anchors.horizontalCenter: parent.horizontalCenter 13 | 14 | property var onTextChanged: null 15 | 16 | function reset() { 17 | searchInput.text = "" 18 | } 19 | 20 | TextInput { 21 | id: searchInput 22 | anchors.fill: parent 23 | anchors.leftMargin: 16 24 | anchors.rightMargin: 16 25 | verticalAlignment: TextInput.AlignVCenter 26 | color: "white" 27 | font.pixelSize: 16 28 | activeFocusOnTab: false 29 | selectByMouse: true 30 | focus: true 31 | 32 | onTextChanged: { 33 | searchBar.onTextChanged(text) 34 | } 35 | 36 | Text { 37 | anchors.fill: parent 38 | verticalAlignment: Text.AlignVCenter 39 | color: "#88ffffff" 40 | font.pixelSize: 14 41 | text: "Type to filter windows..." 42 | visible: !searchInput.text || searchInput.text.length === 0 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /layouts/LayoutsManager.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | import "." 4 | 5 | Singleton { 6 | id: root 7 | 8 | function doLayout( layoutAlgorithm, windowList, width, height) { 9 | var doLayout = null 10 | switch (layoutAlgorithm) { 11 | case 'smartgrid': 12 | doLayout = SmartGridLayout.doLayout 13 | break 14 | case 'justified': 15 | doLayout = JustifiedLayout.doLayout 16 | break 17 | case 'bands': 18 | doLayout = BandsLayout.doLayout 19 | break 20 | case 'masonry': 21 | doLayout = MasonryLayout.doLayout 22 | break 23 | case 'hero': 24 | doLayout = HeroLayout.doLayout 25 | break 26 | case 'spiral': 27 | doLayout = SpiralLayout.doLayout 28 | break 29 | case 'satellite': 30 | doLayout = SatelliteLayout.doLayout 31 | break 32 | case 'staggered': 33 | doLayout = StarggeredLayout.doLayout 34 | break 35 | case 'columnar': 36 | doLayout = ColumnarLayout.doLayout 37 | break 38 | case 'vortex': 39 | doLayout = VortexLayout.doLayout 40 | break 41 | default: 42 | doLayout = SmartGridLayout.doLayout 43 | } 44 | 45 | return doLayout( windowList, width, height) 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /layouts/StarggeredLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) return [] 10 | 11 | var gap = Math.max(10, outerWidth * 0.01) 12 | 13 | // Safe Area 14 | var useW = outerWidth * 0.9 15 | var useH = outerHeight * 0.9 16 | var offX = (outerWidth - useW) / 2 17 | var offY = (outerHeight - useH) / 2 18 | 19 | // Heuristic: roughly sqrt(N), but slightly weighted towards columns 20 | // to accommodate 16:9 screens better. 21 | var cols = Math.ceil(Math.sqrt(N * 1.5)) 22 | var rows = Math.ceil(N / cols) 23 | 24 | // Calculate cell width. 25 | // Note: In a staggered layout, the effective width needed is (cols + 0.5) 26 | // because alternate rows are shifted by half a cell. 27 | var cellW = (useW - (cols * gap)) / (cols + 0.5) 28 | var cellH = (useH - (rows * gap)) / rows 29 | 30 | // Vertical centering of the whole block 31 | var contentH = rows * cellH + (rows - 1) * gap 32 | var startY = offY + (useH - contentH) / 2 33 | 34 | var result = [] 35 | 36 | for (var i = 0; i < N; i++) { 37 | var item = windowList[i] 38 | 39 | var r = Math.floor(i / cols) 40 | var c = i % cols 41 | 42 | // Stagger offset: if row is odd, shift right by half cell width 43 | var staggerOffset = (r % 2 === 1) ? (cellW / 2) : 0 44 | 45 | var cellX = staggerOffset + c * (cellW + gap) 46 | var cellY = r * (cellH + gap) 47 | 48 | // Aspect Fit 49 | var w0 = (item.width > 0) ? item.width : 100 50 | var h0 = (item.height > 0) ? item.height : 100 51 | var sc = Math.min(cellW / w0, cellH / h0) 52 | 53 | // Center the thumbnail inside the calculated cell 54 | result.push({ 55 | win: item.win, 56 | x: offX + cellX + (cellW - w0 * sc)/2, 57 | y: startY + cellY + (cellH - h0 * sc)/2, 58 | width: w0 * sc, 59 | height: h0 * sc 60 | }) 61 | } 62 | return result 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /layouts/ColumnarLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) return [] 10 | 11 | var gap = Math.max(8, outerWidth * 0.005) 12 | 13 | // Safe Area: We use slightly more width here (95%) 14 | // as vertical strips look better when filling the screen horizontally. 15 | var useW = outerWidth * 0.95 16 | var useH = outerHeight * 0.90 17 | var offX = (outerWidth - useW) / 2 18 | var offY = (outerHeight - useH) / 2 19 | 20 | // Calculate width of a single column 21 | var colW = (useW - (gap * (N - 1))) / N 22 | 23 | // Safety: If columns become too narrow (e.g. < 200px), 24 | // we clamp the width to keep them readable. 25 | var minColW = 200 26 | if (colW < minColW) colW = minColW 27 | 28 | // Calculate the actual total width used 29 | var totalW = N * colW + (N - 1) * gap 30 | 31 | // Center the group horizontally. 32 | // If N is small, it centers. If N is large (clamped), it starts from left. 33 | var startX = offX 34 | if (totalW < useW) { 35 | startX = offX + (useW - totalW) / 2 36 | } 37 | 38 | var result = [] 39 | 40 | for (var i = 0; i < N; i++) { 41 | var item = windowList[i] 42 | 43 | var w0 = (item.width > 0) ? item.width : 100 44 | var h0 = (item.height > 0) ? item.height : 100 45 | 46 | // In this layout, vertical space is abundant (useH). 47 | // The constraining factor is usually the column width. 48 | var sc = Math.min(colW / w0, useH / h0) 49 | 50 | var thumbW = w0 * sc 51 | var thumbH = h0 * sc 52 | 53 | var xPos = startX + i * (colW + gap) 54 | 55 | // Center horizontally within the strip 56 | var xCentered = xPos + (colW - thumbW) / 2 57 | 58 | // Center vertically on screen 59 | var yCentered = offY + (useH - thumbH) / 2 60 | 61 | result.push({ 62 | win: item.win, 63 | x: xCentered, 64 | y: yCentered, 65 | width: thumbW, 66 | height: thumbH 67 | }) 68 | } 69 | 70 | return result 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /layouts/VortexLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) return [] 10 | 11 | // Safe Area (90%) 12 | var contentScale = 0.90 13 | var useW = outerWidth * contentScale 14 | var useH = outerHeight * contentScale 15 | var offX = (outerWidth - useW) / 2 16 | var offY = (outerHeight - useH) / 2 17 | 18 | var centerX = offX + useW / 2 19 | var centerY = offY + useH / 2 20 | 21 | // Maximum radius (distance from center to the furthest edge of safe area) 22 | var maxRadius = Math.min(useW, useH) / 2 23 | 24 | var result = [] 25 | 26 | // --- THE VORTEX CONFIGURATION --- 27 | 28 | var goldenAngle = Math.PI * (3 - Math.sqrt(5)) 29 | 30 | // PARAMETER TWEAK 1: from 0.3 to 0.5 to keep distant windows readable 31 | var minScale = 0.4 32 | 33 | // PARAMETER TWEAK 2: from 0.4 to 0.6 (60% of screen height) 34 | var baseSizeFactor = 0.5 35 | 36 | for (var i = 0; i < N; i++) { 37 | var item = windowList[i] 38 | 39 | var t = i / Math.max(1, N - 1) 40 | if (N === 1) t = 0 41 | 42 | // PARAMETER TWEAK 3: from 0.9 instead of 0.8 to accommodate larger thumbs 43 | var currentRadius = (maxRadius * 0.85) * Math.sqrt(t) 44 | var currentAngle = i * goldenAngle 45 | var scale = 1.0 - (t * (1.0 - minScale)) 46 | var tilt = (Math.cos(currentAngle) * 8) 47 | 48 | // Coordinates (Polar to Cartesian) 49 | var cx = centerX + currentRadius * Math.cos(currentAngle) 50 | var cy = centerY + currentRadius * Math.sin(currentAngle) 51 | 52 | // Dimensions (Aspect Fit) 53 | var w0 = (item.width > 0) ? item.width : 100 54 | var h0 = (item.height > 0) ? item.height : 100 55 | 56 | var baseBoxSize = Math.min(useW, useH) * baseSizeFactor 57 | 58 | var aspect = w0 / h0 59 | var thumbW, thumbH 60 | 61 | if (aspect > 1) { 62 | thumbW = baseBoxSize * scale 63 | thumbH = thumbW / aspect 64 | } else { 65 | thumbH = baseBoxSize * scale 66 | thumbW = thumbH * aspect 67 | } 68 | 69 | result.push({ 70 | win: item.win, 71 | x: cx - (thumbW / 2), 72 | y: cy - (thumbH / 2), 73 | width: thumbW, 74 | height: thumbH, 75 | rotation: tilt, 76 | zIndex: N - i 77 | }) 78 | } 79 | 80 | return result 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /layouts/SatelliteLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | import Quickshell.Hyprland 4 | 5 | Singleton { 6 | id: root 7 | 8 | function doLayout(windowList, outerWidth, outerHeight) { 9 | var N = windowList.length 10 | if (N === 0) return [] 11 | 12 | // Move active window to the start of the list (Center Item) 13 | var activeAddr = Hyprland.activeToplevel?.lastIpcObject?.address 14 | if (activeAddr) { 15 | var activeIdx = windowList.findIndex(it => it.lastIpcObject.address === activeAddr) 16 | if (activeIdx !== -1) { 17 | windowList = [windowList[activeIdx], ...windowList.filter(it => it !== windowList[activeIdx])] 18 | } 19 | } 20 | 21 | // Safe Area definition (90%) 22 | var useW = outerWidth * 0.90 23 | var useH = outerHeight * 0.90 24 | var offX = (outerWidth - useW) / 2 25 | var offY = (outerHeight - useH) / 2 26 | 27 | var result = [] 28 | 29 | // Center item (hero) 30 | var centerItem = windowList[0] 31 | 32 | // The center item takes up roughly 35% of the screen dimensions 33 | var centerW = useW * 0.35 34 | var centerH = useH * 0.35 35 | 36 | // Aspect Fit for the center item 37 | var w0 = (centerItem.width > 0) ? centerItem.width : 100 38 | var h0 = (centerItem.height > 0) ? centerItem.height : 100 39 | var sc0 = Math.min(centerW / w0, centerH / h0) 40 | var finalCenterW = w0 * sc0 41 | var finalCenterH = h0 * sc0 42 | 43 | result.push({ 44 | win: centerItem.win, 45 | x: offX + (useW - finalCenterW) / 2, 46 | y: offY + (useH - finalCenterH) / 2, 47 | width: finalCenterW, 48 | height: finalCenterH, 49 | isSatellite: false 50 | }) 51 | 52 | // Orbit items (satellites) 53 | var satellites = windowList.slice(1) 54 | var numSat = satellites.length 55 | 56 | if (numSat > 0) { 57 | // Orbit Radius (distance from center) 58 | var radiusX = useW * 0.4 59 | var radiusY = useH * 0.4 60 | 61 | // Max size for satellites. 62 | // As the number of satellites increases, we shrink them to avoid overlap. 63 | var maxSatW = (useW * 0.25) / Math.max(1, (numSat / 6)) 64 | var maxSatH = (useH * 0.25) / Math.max(1, (numSat / 6)) 65 | 66 | // Start angle (-90 degrees = Top) 67 | var startAngle = -Math.PI / 2 68 | var stepAngle = (2 * Math.PI) / numSat 69 | 70 | for (var i = 0; i < numSat; i++) { 71 | var item = satellites[i] 72 | var angle = startAngle + (i * stepAngle) 73 | 74 | // Calculate satellite center coordinates 75 | var cx = (useW / 2) + radiusX * Math.cos(angle) 76 | var cy = (useH / 2) + radiusY * Math.sin(angle) 77 | 78 | // Aspect Fit satellite 79 | var ws = (item.width > 0) ? item.width : 100 80 | var hs = (item.height > 0) ? item.height : 100 81 | var scS = Math.min(maxSatW / ws, maxSatH / hs) 82 | var finalSatW = ws * scS 83 | var finalSatH = hs * scS 84 | 85 | result.push({ 86 | win: item.win, 87 | x: offX + cx - (finalSatW / 2), 88 | y: offY + cy - (finalSatH / 2), 89 | width: finalSatW, 90 | height: finalSatH, 91 | isSatellite: true 92 | }) 93 | } 94 | } 95 | 96 | return result 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /layouts/JustifiedLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) 10 | return [] 11 | 12 | var containerWidth = outerWidth * 0.9 13 | var containerHeight = outerHeight * 0.9 14 | 15 | // Gap: 0.8% of screen, clamped between 12px and 32px 16 | var rawGap = Math.min(outerWidth * 0.08, outerHeight * 0.08) 17 | var gap = Math.max(12, Math.min(32, rawGap)) 18 | 19 | var maxThumbHeight = outerHeight * 0.3 20 | 21 | if (containerWidth <= 0 || containerHeight <= 0) { 22 | return windowList.map(function(item) { 23 | return { 24 | win: item.win, 25 | x: 0, 26 | y: 0, 27 | width: 0, 28 | height: 0 29 | } 30 | }) 31 | } 32 | 33 | var targetRowH = maxThumbHeight 34 | var rows = [] 35 | var currentRow = [] 36 | var sumAspect = 0 37 | 38 | function flushRow() { 39 | if (currentRow.length === 0) 40 | return 41 | 42 | var n = currentRow.length 43 | var rowHeight = maxThumbHeight 44 | if (sumAspect > 0) { 45 | var totalGapWidth = gap * (n - 1) 46 | var hFit = (containerWidth - totalGapWidth) / sumAspect 47 | if (hFit < rowHeight) 48 | rowHeight = hFit 49 | } 50 | 51 | if (rowHeight > maxThumbHeight) 52 | rowHeight = maxThumbHeight 53 | if (rowHeight <= 0) 54 | rowHeight = 1 55 | 56 | rows.push({ 57 | items: currentRow.slice(), 58 | height: rowHeight, 59 | sumAspect: sumAspect 60 | }) 61 | 62 | currentRow = [] 63 | sumAspect = 0 64 | } 65 | 66 | for (var i = 0; i < N; ++i) { 67 | var item = windowList[i] 68 | var w0 = item.width > 0 ? item.width : 1 69 | var h0 = item.height > 0 ? item.height : 1 70 | var a = w0 / h0 71 | item.aspect = a 72 | 73 | if (currentRow.length > 0 && 74 | ((sumAspect + a) * targetRowH + gap * currentRow.length) > containerWidth) { 75 | flushRow() 76 | } 77 | 78 | currentRow.push(item) 79 | sumAspect += a 80 | } 81 | 82 | if (currentRow.length > 0) { 83 | flushRow() 84 | } 85 | 86 | var totalRawHeight = 0 87 | for (var r = 0; r < rows.length; ++r) { 88 | totalRawHeight += rows[r].height 89 | } 90 | if (rows.length > 1) { 91 | totalRawHeight += gap * (rows.length - 1) 92 | } 93 | 94 | var sV = 1.0 95 | var availH = containerHeight 96 | if (totalRawHeight > 0 && totalRawHeight > availH) { 97 | sV = availH / totalRawHeight 98 | } 99 | if (sV <= 0) 100 | sV = 0.1 101 | if (sV > 1.0) 102 | sV = 1.0 103 | 104 | var gridTotalHeightScaled = totalRawHeight * sV 105 | var yAcc = (outerHeight - gridTotalHeightScaled) / 2 106 | if (!isFinite(yAcc) || yAcc < 0) 107 | yAcc = 0 108 | 109 | var result = [] 110 | 111 | for (var r2 = 0; r2 < rows.length; ++r2) { 112 | var row = rows[r2] 113 | var rowHeightScaled = row.height * sV 114 | 115 | var rowWidthNoGapsScaled = 0 116 | for (var j = 0; j < row.items.length; ++j) { 117 | rowWidthNoGapsScaled += row.items[j].aspect * rowHeightScaled 118 | } 119 | var totalRowWidthScaled = rowWidthNoGapsScaled + gap * (row.items.length - 1) 120 | 121 | var xAcc = (outerWidth - totalRowWidthScaled) / 2 122 | if (!isFinite(xAcc)) 123 | xAcc = 0 124 | 125 | for (var j2 = 0; j2 < row.items.length; ++j2) { 126 | var it2 = row.items[j2] 127 | var wScaled = it2.aspect * rowHeightScaled 128 | var hScaled = rowHeightScaled 129 | 130 | result.push({ 131 | win: it2.win, 132 | x: xAcc, 133 | y: yAcc, 134 | width: wScaled, 135 | height: hScaled 136 | }) 137 | 138 | xAcc += wScaled + gap 139 | } 140 | 141 | yAcc += rowHeightScaled 142 | if (r2 < rows.length - 1) { 143 | yAcc += gap * sV 144 | } 145 | } 146 | 147 | return result 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /layouts/SmartGridLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) return [] 10 | if (outerWidth <= 0 || outerHeight <= 0) return [] 11 | 12 | var gap = Math.min(outerWidth * 0.03, outerHeight * 0.03) 13 | 14 | // --- 0. DEFINIZIONE AREA SICURA (SCALATA) --- 15 | // Riduciamo l'area di calcolo al 90% per lasciare spazio alle animazioni hover 16 | var contentScale = 0.9 17 | var usableW = outerWidth * contentScale 18 | var usableH = outerHeight * contentScale 19 | 20 | // --- 1. TROVARE LA SCALA OTTIMALE --- 21 | // Usiamo usableW/H per decidere la dimensione delle finestre 22 | var TARGET_ASPECT = 16.0 / 9.0 23 | var bestCols = 1 24 | var bestRows = 1 25 | var bestScale = 0 26 | 27 | for (var cols = 1; cols <= N; cols++) { 28 | var rows = Math.ceil(N / cols) 29 | 30 | // Calcoliamo lo spazio basandoci sull'area ridotta 31 | var availW = usableW - gap * (cols - 1) 32 | var availH = usableH - gap * (rows - 1) 33 | 34 | if (availW <= 0 || availH <= 0) continue 35 | 36 | var cellW = availW / cols 37 | var cellH = availH / rows 38 | 39 | var scaleW = cellW / TARGET_ASPECT 40 | var scaleH = cellH / 1.0 41 | var currentScale = Math.min(scaleW, scaleH) 42 | 43 | if (currentScale > bestScale) { 44 | bestScale = currentScale 45 | bestCols = cols 46 | bestRows = rows 47 | } 48 | } 49 | 50 | // --- 2. CALCOLO DIMENSIONI REALI --- 51 | 52 | // Ricalcoliamo i limiti cella basati sull'area ridotta 53 | var finalAvailW = usableW - gap * (bestCols - 1) 54 | var finalAvailH = usableH - gap * (bestRows - 1) 55 | var maxCellW = finalAvailW / bestCols 56 | var maxCellH = finalAvailH / bestRows 57 | 58 | // --- 3. POSIZIONAMENTO (CENTRATO NELL'AREA TOTALE) --- 59 | 60 | // Calcoliamo l'altezza totale del blocco di contenuto 61 | var totalGridContentH = bestRows * maxCellH + (bestRows - 1) * gap 62 | 63 | // Per centrare verticalmente, usiamo l'outerHeight REALE (al 100%) 64 | // In questo modo il blocco ridotto (90%) finisce esattamente al centro dello schermo fisico 65 | var startOffsetY = (outerHeight - totalGridContentH) / 2 66 | 67 | var result = [] 68 | 69 | // Iteriamo per RIGA 70 | for (var r = 0; r < bestRows; r++) { 71 | var rowItems = [] 72 | var startIndex = r * bestCols 73 | var endIndex = Math.min(startIndex + bestCols, N) 74 | 75 | if (startIndex >= N) break 76 | 77 | var totalRowContentWidth = 0 78 | 79 | // Fase 3a: Calcolo dimensioni miniature (Packed) 80 | for (var i = startIndex; i < endIndex; i++) { 81 | var item = windowList[i] 82 | var w0 = (item.width && item.width > 0) ? item.width : 100 83 | var h0 = (item.height && item.height > 0) ? item.height : 100 84 | 85 | // Scala calcolata sui limiti "sicuri" (90%) 86 | var scale = Math.min(maxCellW / w0, maxCellH / h0) 87 | 88 | var thumbW = w0 * scale 89 | var thumbH = h0 * scale 90 | 91 | rowItems.push({ 92 | originalItem: item, 93 | width: thumbW, 94 | height: thumbH, 95 | index: i, 96 | col: i - startIndex 97 | }) 98 | 99 | totalRowContentWidth += thumbW 100 | } 101 | 102 | // Aggiungiamo i gap totali della riga 103 | if (rowItems.length > 1) { 104 | totalRowContentWidth += (rowItems.length - 1) * gap 105 | } 106 | 107 | // Fase 3b: Posizionamento X 108 | // Anche qui, usiamo outerWidth REALE per centrare il blocco riga nello schermo intero 109 | var currentX = (outerWidth - totalRowContentWidth) / 2 110 | var cellAbsY = startOffsetY + r * (maxCellH + gap) 111 | 112 | for (var k = 0; k < rowItems.length; k++) { 113 | var rItem = rowItems[k] 114 | 115 | // Centratura verticale nella fascia 116 | var currentY = cellAbsY + (maxCellH - rItem.height) / 2 117 | 118 | result.push({ 119 | win: rItem.originalItem.win, 120 | x: currentX, 121 | y: currentY, 122 | width: rItem.width, 123 | height: rItem.height, 124 | rowIndex: r, 125 | colIndex: rItem.col 126 | }) 127 | 128 | currentX += rItem.width + gap 129 | } 130 | } 131 | 132 | return result 133 | } 134 | } 135 | -------------------------------------------------------------------------------- /layouts/MasonryLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) return [] 10 | 11 | // Gap: 0.8% of screen, clamped between 12px and 32px 12 | var rawGap = Math.min(outerWidth * 0.08, outerHeight * 0.08) 13 | var gap = Math.max(12, Math.min(32, rawGap)) 14 | 15 | // Safe Area (90%) 16 | // Define the bounding box for the content. 17 | var contentScale = 0.90 18 | var useW = outerWidth * contentScale 19 | var useH = outerHeight * contentScale 20 | 21 | // Find Best Column Count 22 | // Standard logic: try to fit content in 1 col, then 2, etc. 23 | var bestCols = N 24 | 25 | for (var cols = 1; cols <= N; cols++) { 26 | var tryColWidth = (useW - (cols - 1) * gap) / cols 27 | var tryColHeights = new Array(cols).fill(0) 28 | 29 | for (var i = 0; i < N; i++) { 30 | var item = windowList[i] 31 | var minH = Math.min.apply(null, tryColHeights) 32 | var colIdx = tryColHeights.indexOf(minH) 33 | 34 | var w0 = (item.width && item.width > 0) ? item.width : 100 35 | var h0 = (item.height && item.height > 0) ? item.height : 100 36 | var scale = tryColWidth / w0 37 | 38 | tryColHeights[colIdx] += (h0 * scale) + gap 39 | } 40 | 41 | var currentMaxH = Math.max.apply(null, tryColHeights) 42 | if (currentMaxH > 0) currentMaxH -= gap 43 | 44 | // If it fits vertically, we stop. 45 | if (currentMaxH <= useH) { 46 | bestCols = cols 47 | break 48 | } 49 | } 50 | 51 | // Rigorous clamping 52 | // We have chosen 'bestCols'. Now we calculate the theoretical column width. 53 | // BUT, if N is small (e.g. 1), this width might produce a height > useH. 54 | // We must calculate a "Global Downscale Factor" to ensure NO item exceeds useH. 55 | 56 | var rawColWidth = (useW - (bestCols - 1) * gap) / bestCols 57 | var maxOverflowRatio = 1.0 // 1.0 means "fits perfectly" 58 | 59 | // Simulate again to find the worst offender (tallest item/column relative to screen) 60 | // Note: In masonry, we care about the total column height, not just single item. 61 | var clampHeights = new Array(bestCols).fill(0) 62 | 63 | for (var j = 0; j < N; j++) { 64 | var it = windowList[j] 65 | 66 | // Standard masonry placement logic 67 | var mH = Math.min.apply(null, clampHeights) 68 | var cId = clampHeights.indexOf(mH) 69 | 70 | var wRaw = (it.width && it.width > 0) ? it.width : 100 71 | var hRaw = (it.height && it.height > 0) ? it.height : 100 72 | var sc = rawColWidth / wRaw 73 | 74 | clampHeights[cId] += (hRaw * sc) + gap 75 | } 76 | 77 | // Find the tallest column produced by the raw width 78 | var tallestCol = Math.max.apply(null, clampHeights) 79 | if (tallestCol > 0) tallestCol -= gap 80 | 81 | // If the tallest column is taller than Safe Area, calculate reduction factor 82 | if (tallestCol > useH) { 83 | maxOverflowRatio = useH / tallestCol 84 | } 85 | 86 | // Apply the reduction factor to the column width. 87 | var finalColWidth = rawColWidth * maxOverflowRatio 88 | 89 | // Re-centering x 90 | var finalGridW = (finalColWidth * bestCols) + (gap * (bestCols - 1)) 91 | var finalOffX = (outerWidth - finalGridW) / 2 92 | 93 | 94 | // Final rendering 95 | var colHeights = new Array(bestCols).fill(0) 96 | var result = [] 97 | 98 | for (var k = 0; k < N; k++) { 99 | var itemK = windowList[k] 100 | 101 | // 1. Find shortest column 102 | var minH = Math.min.apply(null, colHeights) 103 | var cIdx = colHeights.indexOf(minH) 104 | 105 | // 2. Dimensions 106 | var wOrig = (itemK.width && itemK.width > 0) ? itemK.width : 100 107 | var hOrig = (itemK.height && itemK.height > 0) ? itemK.height : 100 108 | var s = finalColWidth / wOrig 109 | var tH = hOrig * s 110 | 111 | // 3. Position (using Recalculated OffX) 112 | var xPos = finalOffX + cIdx * (finalColWidth + gap) 113 | var yPos = colHeights[cIdx] 114 | 115 | result.push({ 116 | win: itemK.win, 117 | x: xPos, 118 | y: yPos, 119 | width: finalColWidth, 120 | height: tH, 121 | colIndex: cIdx 122 | }) 123 | 124 | colHeights[cIdx] += tH + gap 125 | } 126 | 127 | // Vertical centering 128 | var realGridH = Math.max.apply(null, colHeights) 129 | if (realGridH > 0) realGridH -= gap 130 | 131 | var finalOffY = (outerHeight - realGridH) / 2 132 | 133 | for (var m = 0; m < result.length; m++) { 134 | result[m].y += finalOffY 135 | } 136 | 137 | return result 138 | } 139 | } 140 | -------------------------------------------------------------------------------- /layouts/HeroLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | import Quickshell.Hyprland 4 | 5 | Singleton { 6 | id: root 7 | 8 | function doLayout(windowList, outerWidth, outerHeight) { 9 | if (windowList.length === 0) return [] 10 | 11 | // Gap: 0.8% of screen, clamped between 12px and 32px 12 | var rawGap = Math.min(outerWidth * 0.08, outerHeight * 0.08) 13 | var gap = Math.max(12, Math.min(32, rawGap)) 14 | 15 | // Move active window to the head of windowList 16 | var activeAddr = Hyprland.activeToplevel?.lastIpcObject?.address 17 | if (activeAddr) { 18 | var activeIdx = windowList.findIndex(it => it.lastIpcObject.address === activeAddr) 19 | if (activeIdx !== -1) { 20 | windowList = [windowList[activeIdx], ...windowList.filter(it => it !== windowList[activeIdx])] 21 | } 22 | } 23 | 24 | // Safe area definition (90%) 25 | var contentScale = 0.90 26 | var useW = outerWidth * contentScale 27 | var useH = outerHeight * contentScale 28 | 29 | // Global offset - center Safe area 30 | var offX = (outerWidth - useW) / 2 31 | var offY = (outerHeight - useH) / 2 32 | 33 | var result = [] 34 | 35 | // Screen zones (Hero/Stack) 36 | var heroRatio = 0.40 // 40% Hero 37 | var heroAreaW = useW * heroRatio 38 | var stackAreaW = useW - heroAreaW - gap // 60% Stack 39 | 40 | var heroItem = windowList[0] 41 | 42 | // Aspect Fit 43 | var hScale = Math.min(heroAreaW / heroItem.width, useH / heroItem.height) 44 | var hW = heroItem.width * hScale 45 | var hH = heroItem.height * hScale 46 | 47 | result.push({ 48 | win: heroItem.win, 49 | x: offX + (heroAreaW - hW) / 2, 50 | y: offY + (useH - hH) / 2, 51 | width: hW, 52 | height: hH, 53 | isHero: true 54 | }) 55 | 56 | var others = windowList.slice(1) 57 | var N = others.length 58 | 59 | if (N > 0) { 60 | var stackStartX = offX + heroAreaW + gap 61 | 62 | // Evaluate col number 63 | var bestCols = 1 64 | var bestRows = N 65 | 66 | // Windows height on a single column 67 | var oneColH = (useH - (gap * (N - 1))) / N 68 | 69 | // TOLERANCE THRESHOLD (0.15 = 15% of screen height) 70 | // If the windows are at least 15% of the screen height, we stay on 1 column. 71 | // With 4 windows we are at ~25% -> OK (1 Column) 72 | // With 7 windows we are at ~14% -> NO (Go to grid calculation) 73 | var useSingleCol = oneColH > (useH * 0.15) 74 | 75 | if (!useSingleCol) { 76 | // If space is limited, we look for the optimal grid starting with 2 columns. 77 | var bestScale = 0 78 | var TARGET_ASPECT = 16.0 / 9.0 79 | 80 | for (var cols = 2; cols <= N; cols++) { 81 | var rows = Math.ceil(N / cols) 82 | var availW = stackAreaW - (gap * (cols - 1)) 83 | var availH = useH - (gap * (rows - 1)) 84 | 85 | if (availW <= 0 || availH <= 0) continue 86 | 87 | var cellW = availW / cols 88 | var cellH = availH / rows 89 | 90 | // Size score 91 | var sW = cellW / TARGET_ASPECT 92 | var sH = cellH / 1.0 93 | var currentScale = Math.min(sW, sH) 94 | 95 | if (currentScale > bestScale) { 96 | bestScale = currentScale 97 | bestCols = cols 98 | bestRows = rows 99 | } 100 | } 101 | } 102 | 103 | // Evaluation of the final dimensions of the selected grid 104 | var finalAvailW = stackAreaW - (gap * (bestCols - 1)) 105 | var finalAvailH = useH - (gap * (bestRows - 1)) 106 | 107 | var finalCellW = finalAvailW / bestCols 108 | var finalCellH = finalAvailH / bestRows 109 | 110 | // Vertical centering of the total stack 111 | var totalGridH = bestRows * finalCellH + (bestRows - 1) * gap 112 | var stackStartY = offY + (useH - totalGridH) / 2 113 | 114 | // Items positioning 115 | for (var i = 0; i < N; ++i) { 116 | var item = others[i] 117 | 118 | var row = Math.floor(i / bestCols) 119 | var col = i % bestCols 120 | 121 | // Cell coords (Standard Grid Alignment) 122 | // No “rowOffsetX”, cell 0 always starts on the left 123 | var cellAbsX = stackStartX + col * (finalCellW + gap) 124 | var cellAbsY = stackStartY + row * (finalCellH + gap) 125 | 126 | // Thumb aspect Fit 127 | var sc = Math.min(finalCellW / item.width, finalCellH / item.height) 128 | var w = item.width * sc 129 | var h = item.height * sc 130 | 131 | result.push({ 132 | win: item.win, 133 | x: cellAbsX + (finalCellW - w) / 2, 134 | y: cellAbsY + (finalCellH - h) / 2, 135 | width: w, 136 | height: h, 137 | isHero: false 138 | }) 139 | } 140 | } 141 | 142 | return result 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /layouts/SpiralLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | import Quickshell.Hyprland 4 | 5 | Singleton { 6 | id: root 7 | 8 | function doLayout(windowList, outerWidth, outerHeight, maxSplits) { 9 | var N = windowList.length 10 | if (N === 0) return [] 11 | 12 | if (maxSplits === undefined) maxSplits = 3 13 | 14 | // Standard Gap: 0.8% of screen 15 | var rawGap = outerWidth * 0.008 16 | var gap = Math.max(8, Math.min(24, rawGap)) 17 | 18 | // Primary Gap: The space between the first Big Window and the rest. 19 | // We make it 3x larger than the standard gap for emphasis. 20 | var primaryGap = gap * 3 21 | 22 | // Safe Area (90%) 23 | var contentScale = 0.90 24 | var useW = outerWidth * contentScale 25 | var useH = outerHeight * contentScale 26 | var offX = (outerWidth - useW) / 2 27 | var offY = (outerHeight - useH) / 2 28 | 29 | // Move Active Window to start 30 | var activeAddr = Hyprland.activeToplevel?.lastIpcObject?.address 31 | if (activeAddr) { 32 | var activeIdx = windowList.findIndex(it => it.lastIpcObject.address === activeAddr) 33 | if (activeIdx !== -1) { 34 | windowList = [windowList[activeIdx], ...windowList.filter(it => it !== windowList[activeIdx])] 35 | } 36 | } 37 | 38 | var result = [] 39 | 40 | // Working area cursor 41 | var curX = offX 42 | var curY = offY 43 | var curW = useW 44 | var curH = useH 45 | 46 | // Items to process in Spiral mode 47 | var spiralCount = Math.min(N - 1, maxSplits) 48 | 49 | // Spiral cuts 50 | for (var k = 0; k < spiralCount; k++) { 51 | var sItem = windowList[k] 52 | var sBoxW, sBoxH 53 | var sBoxX = curX 54 | var sBoxY = curY 55 | 56 | // Logic change: Use 'primaryGap' only for the very first cut (k=0), 57 | // otherwise use standard 'gap'. 58 | var currentGap = (k === 0) ? primaryGap : gap 59 | 60 | if (curW > curH) { // Split Vertical 61 | // Calculate width subtracting the specific gap for this iteration 62 | sBoxW = (curW - currentGap) / 2 63 | sBoxH = curH 64 | 65 | // Shift working area for next items by the specific gap 66 | curX += sBoxW + currentGap 67 | curW -= (sBoxW + currentGap) 68 | } else { // Split Horizontal 69 | sBoxW = curW 70 | sBoxH = (curH - currentGap) / 2 71 | 72 | // Shift working area for next items by the specific gap 73 | curY += sBoxH + currentGap 74 | curH -= (sBoxH + currentGap) 75 | } 76 | 77 | // Aspect Fit 78 | var sw0 = (sItem.width > 0) ? sItem.width : 100 79 | var sh0 = (sItem.height > 0) ? sItem.height : 100 80 | var sScale = Math.min(sBoxW / sw0, sBoxH / sh0) 81 | 82 | result.push({ 83 | win: sItem.win, 84 | x: sBoxX + (sBoxW - (sw0 * sScale))/2, 85 | y: sBoxY + (sBoxH - (sh0 * sScale))/2, 86 | width: sw0 * sScale, 87 | height: sh0 * sScale, 88 | isSpiral: true, 89 | index: k 90 | }) 91 | } 92 | 93 | // Overflow grid 94 | var remainingItems = windowList.slice(spiralCount) 95 | var remN = remainingItems.length 96 | 97 | if (remN > 0) { 98 | // Standard Grid logic for the remaining box 99 | var bestCols = 1 100 | var bestScale = 0 101 | var TARGET_ASPECT = 16.0/9.0 102 | 103 | for (var c = 1; c <= remN; c++) { 104 | var r = Math.ceil(remN / c) 105 | var avW = curW - gap * (c - 1) 106 | var avH = curH - gap * (r - 1) 107 | if (avW <= 0 || avH <= 0) continue 108 | 109 | var cW = avW / c 110 | var cH = avH / r 111 | var sc = Math.min(cW / TARGET_ASPECT, cH) 112 | 113 | if (sc > bestScale) { 114 | bestScale = sc 115 | bestCols = c 116 | } 117 | } 118 | 119 | var remRows = Math.ceil(remN / bestCols) 120 | var finalCellW = (curW - gap * (bestCols - 1)) / bestCols 121 | var finalCellH = (curH - gap * (remRows - 1)) / remRows 122 | 123 | var gridContentH = remRows * finalCellH + (remRows - 1) * gap 124 | var gridStartY = curY + (curH - gridContentH) / 2 125 | 126 | for (var j = 0; j < remN; j++) { 127 | var rItem = remainingItems[j] 128 | var row = Math.floor(j / bestCols) 129 | var col = j % bestCols 130 | 131 | var itemsInRow = Math.min((row + 1) * bestCols, remN) - (row * bestCols) 132 | var rowW = itemsInRow * finalCellW + (itemsInRow - 1) * gap 133 | var rowStartX = curX + (curW - rowW) / 2 134 | 135 | var cellX = rowStartX + col * (finalCellW + gap) 136 | var cellY = gridStartY + row * (finalCellH + gap) 137 | 138 | var rw0 = (rItem.width > 0) ? rItem.width : 100 139 | var rh0 = (rItem.height > 0) ? rItem.height : 100 140 | var rSc = Math.min(finalCellW / rw0, finalCellH / rh0) 141 | 142 | result.push({ 143 | win: rItem.win, 144 | x: cellX + (finalCellW - (rw0 * rSc))/2, 145 | y: cellY + (finalCellH - (rh0 * rSc))/2, 146 | width: rw0 * rSc, 147 | height: rh0 * rSc, 148 | isSpiral: false 149 | }) 150 | } 151 | } 152 | 153 | return result 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /layouts/BandsLayout.qml: -------------------------------------------------------------------------------- 1 | pragma Singleton 2 | import Quickshell 3 | 4 | Singleton { 5 | id: root 6 | 7 | function doLayout(windowList, outerWidth, outerHeight) { 8 | var N = windowList.length 9 | if (N === 0) return [] 10 | 11 | // Gap: 0.8% of screen, clamped between 12px and 24px 12 | var rawGap = Math.min(outerWidth * 0.08, outerHeight * 0.08) 13 | var gap = Math.max(12, Math.min(24, rawGap)) 14 | 15 | // Safe Area: 90% of the screen 16 | var contentScale = 0.90 17 | var useW = outerWidth * contentScale 18 | var useH = outerHeight * contentScale 19 | 20 | // Global offsets to center everything 21 | var offX = (outerWidth - useW) / 2 22 | var offY = (outerHeight - useH) / 2 23 | 24 | // Group by workspace 25 | var groups = {} 26 | var wsOrder = [] 27 | 28 | for (var i = 0; i < N; i++) { 29 | var w = windowList[i] 30 | var wsId = w.workspaceId 31 | 32 | if (!groups[wsId]) { 33 | groups[wsId] = [] 34 | wsOrder.push(wsId) 35 | } 36 | groups[wsId].push(w) 37 | } 38 | 39 | var bandCount = wsOrder.length 40 | if (bandCount === 0) return [] 41 | 42 | // Band height & max thumb height 43 | 44 | // Calculate the height allocated for each workspace band 45 | var totalGapH = gap * (bandCount - 1) 46 | var bandHeight = (useH - totalGapH) / bandCount 47 | 48 | // Aesthetic Cap: Even if we have only 1 workspace, 49 | // windows shouldn't exceed 45% of screen height. 50 | var absoluteMaxH = useH * 0.45 51 | 52 | // The effective max height is the smaller of the two. 53 | // If we have 10 bands, bandHeight will be small (e.g. 100px), so that rules. 54 | // If we have 1 band, bandHeight is huge (1000px), so absoluteMaxH (450px) rules. 55 | var localMaxH = Math.min(bandHeight, absoluteMaxH) 56 | 57 | // Minimum safety height to avoid division by zero errors 58 | if (localMaxH < 10) localMaxH = 10 59 | 60 | var result = [] 61 | var currentY = offY 62 | 63 | // Process each band 64 | for (var b = 0; b < bandCount; b++) { 65 | var wsId = wsOrder[b] 66 | var items = groups[wsId] 67 | var itemCount = items.length 68 | 69 | // ROW LAYOUT CALCULATION (Justified) 70 | var rows = [] 71 | var currentRow = [] 72 | var currentAspectSum = 0 73 | 74 | for (var k = 0; k < itemCount; k++) { 75 | var item = items[k] 76 | var w0 = (item.width > 0) ? item.width : 100 77 | var h0 = (item.height > 0) ? item.height : 100 78 | var aspect = w0 / h0 79 | 80 | var wrapper = { win: item.win, aspect: aspect } 81 | 82 | // Check overflow: (SumAspects * MaxH) + Gaps > Width 83 | var hypotheticalWidth = (currentAspectSum + aspect) * localMaxH + (currentRow.length * gap) 84 | 85 | if (currentRow.length > 0 && hypotheticalWidth > useW) { 86 | rows.push({ items: currentRow, aspectSum: currentAspectSum }) 87 | currentRow = [] 88 | currentAspectSum = 0 89 | } 90 | 91 | currentRow.push(wrapper) 92 | currentAspectSum += aspect 93 | } 94 | if (currentRow.length > 0) { 95 | rows.push({ items: currentRow, aspectSum: currentAspectSum }) 96 | } 97 | 98 | // SCALE & FIT ROWS 99 | // Calculate how tall the content actually is 100 | var totalContentH = 0 101 | var finalRows = [] 102 | 103 | for (var r = 0; r < rows.length; r++) { 104 | var rowObj = rows[r] 105 | var rItems = rowObj.items 106 | 107 | // Optimal Height = (Available Width / Sum Aspects) 108 | var availRowW = useW - (gap * (rItems.length - 1)) 109 | var optimalH = availRowW / rowObj.aspectSum 110 | 111 | // Clamp to limits 112 | if (optimalH > localMaxH) optimalH = localMaxH 113 | 114 | finalRows.push({ items: rItems, h: optimalH }) 115 | totalContentH += optimalH 116 | } 117 | 118 | // Add vertical gaps between rows inside the band 119 | if (finalRows.length > 1) { 120 | totalContentH += gap * (finalRows.length - 1) 121 | } 122 | 123 | // If rows overflow the band height (rare, but possible with many windows), scale down 124 | var scaleFactor = 1.0 125 | if (totalContentH > bandHeight) { 126 | scaleFactor = bandHeight / totalContentH 127 | totalContentH = bandHeight // Cap for centering math 128 | } 129 | 130 | // GENERATE COORDINATES 131 | // Center the content vertically within the band slot 132 | // Note: If bandCount=1, bandHeight is huge (90% screen), but totalContentH is constrained by absoluteMaxH. 133 | // This ensures the single row floats nicely in the middle. 134 | var rowY = currentY + (bandHeight - totalContentH) / 2 135 | 136 | for (var r2 = 0; r2 < finalRows.length; r2++) { 137 | var fRow = finalRows[r2] 138 | var rHeight = fRow.h * scaleFactor 139 | var rItems2 = fRow.items 140 | 141 | // Calculate row width for horizontal centering 142 | var actualRowW = 0 143 | for (var j = 0; j < rItems2.length; j++) { 144 | actualRowW += (rItems2[j].aspect * rHeight) 145 | } 146 | actualRowW += gap * (rItems2.length - 1) 147 | 148 | var rowX = offX + (useW - actualRowW) / 2 149 | 150 | for (var j2 = 0; j2 < rItems2.length; j2++) { 151 | var it = rItems2[j2] 152 | var finalW = it.aspect * rHeight 153 | 154 | result.push({ 155 | win: it.win, 156 | x: rowX, 157 | y: rowY, 158 | width: finalW, 159 | height: rHeight 160 | }) 161 | 162 | rowX += finalW + gap 163 | } 164 | 165 | rowY += rHeight + (gap * scaleFactor) 166 | } 167 | 168 | // Advance Y to the next band slot 169 | currentY += bandHeight + gap 170 | } 171 | 172 | return result 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Quickshell Window Switcher 2 | 3 | ### The ultimate Hyprland Overview 4 | 5 | A modern, fluid, and highly customizable **Window Switcher (Exposé)** for **Hyprland**, built entirely in QML using the [Quickshell](https://github.com/outfoxxed/quickshell) framework. 6 | 7 | It provides a native Wayland experience similar to macOS Mission Control or GNOME Activities, featuring a suite of advanced mathematical layouts designed to visualize your windows beautifully on any screen size. 8 | 9 | ## 📸 Gallery 10 | 11 | See `qs-hyprview` in action with its different layout algorithms. 12 | 13 | | | | | 14 | | :---: | :---: | :---: | 15 | | ![Smart Grid](screenshots/smartgrid.jpeg)
**Smart Grid** | ![Bands](screenshots/bands.jpeg)
**Bands** | ![Masonry](screenshots/masonry.jpeg)
**Masonry** | 16 | | ![Hero](screenshots/hero.jpeg)
**Hero** | ![Spiral](screenshots/spiral.jpeg)
**Spiral** | ![Satellite](screenshots/satellite.jpeg)
**Satellite** | 17 | | ![Vortex](screenshots/vortex.jpeg)
**Vortex** | ![Staggered](screenshots/staggered.jpeg)
**Staggered** | **What's next?** | 18 | 19 | ## ✨ Features 20 | 21 | * **⚡ Native Performance:** Built on Qt6/QML and Wayland Layershell for zero latency and smooth 60fps animations. 22 | * **🧮 10 Layout Algorithms:** A collection of layouts ranging from productive grids to scenic orbital views. 23 | * **🔍 Instant Search:** Filter windows by title, class, or app name immediately upon typing. 24 | * **🎮 Full Navigation:** Supports both Keyboard (Arrows/Tab/Enter) and Mouse (Hover/Click). 25 | * **🎨 Smart Safe Area:** All layouts calculate a 90% "Safe Area" to ensure hover animations never clip against screen edges. 26 | * **⚙️ Live Thumbnails:** Live window contents via Hyprland screencopy. 27 | 28 | ## 🛠️ Dependencies 29 | 30 | * **Hyprland**: The Wayland compositor. 31 | * **Quickshell**: The QML shell framework. 32 | * **Qt6**: Core libraries (usually pulled in by Quickshell). 33 | 34 | ## 🚀 Installation 35 | 36 | 1. Clone this repository: 37 | ```bash 38 | git clone https://github.com/dom0/qs-hyprview.git 39 | ``` 40 | 41 | 2. Ensure `quickshell` is installed and in your PATH. 42 | 43 | ## ⚙️ Configuration & Usage 44 | 45 | ### Launching 46 | To start the daemon (add this to your `hyprland.conf` with `exec-once`): 47 | 48 | ```bash 49 | quickshell -p /path/to/cloned/repo 50 | 51 | # Or clone into $XDG_CONFIG_HOME/quickshell (usually ~/.config/quickshell) and run with -c flag: 52 | quickshell -c qs-hyprview 53 | ``` 54 | 55 | ### Toggle (Open/Close) 56 | The project exposes an IPC handler named `expose`. You can bind a key in Hyprland to toggle the view. 57 | 58 | **In `hyprland.conf`:** 59 | ```ini 60 | # "smartgrid", "justified", "masonry", "bands", "hero", "spiral" 61 | # "satellite", "staggered", "columnar", "vortex", "random" 62 | $layout = 'masonry' 63 | 64 | # Toggle overview visibility 65 | bind = $mainMod, TAB, exec, quickshell ipc -p /path/to/cloned/repo call expose toggle $layout 66 | 67 | # Open overview 68 | bind = $mainMod, TAB, exec, quickshell ipc -p /path/to/cloned/repo call expose open $layout 69 | 70 | # Close overview 71 | bind = $mainMod, TAB, exec, quickshell ipc -p /path/to/cloned/repo call expose close 72 | 73 | 74 | # Or, using XDG_CONFIG_HOME: 75 | #bind = $mainMod, TAB, exec, quickshell ipc -c qs-hyprview call expose toggle $layout 76 | #bind = $mainMod, TAB, exec, quickshell ipc -c qs-hyprview call expose open $layout 77 | #bind = $mainMod, TAB, exec, quickshell ipc -c qs-hyprview call expose close 78 | ``` 79 | ### Visual optimizations 80 | 81 | You can optimize your experience by adding an opaque/blurred background (dimming area) or pop-in animations using native Hyprland features. 82 | 83 | **In `hyprland.conf`:** 84 | ```ini 85 | # dimming area 86 | decoration { 87 | dim_around = 0.8 88 | } 89 | 90 | layerrule = dimaround, quickshell:expose 91 | ``` 92 | 93 | ```ini 94 | # blur area 95 | decoration { 96 | blur { 97 | enabled = true 98 | size = 3 99 | passes = 1 100 | } 101 | } 102 | 103 | layerrule = blur, quickshell:expose 104 | ``` 105 | 106 | ```ini 107 | # popin animation 108 | animations { 109 | enabled = yes 110 | animation = layersIn, 1, 1.5, default, popin 111 | } 112 | ``` 113 | 114 | ### Customization 115 | You can modify the core properties at the top of `shell.qml`: 116 | 117 | ```qml 118 | // Set to true for live window updates (monitor refresh rate, higher CPU usage), false for static snapshots (~8fps) 119 | property bool liveCapture: false 120 | 121 | // Automatically move mouse cursor to the center of selected window 122 | property bool moveCursorToActiveWindow: true 123 | ``` 124 | 125 | ## 📐 Layout Algorithms 126 | 127 | This project includes a sophisticated `LayoutsManager` offering **10 distinct algorithms**: 128 | 129 | ### 1. Smart Grid (`smartgrid`) 130 | The default layout. It uses an **Iterative Best-Fit** algorithm. It simulates every possible row/column combination to find the exact grid configuration that results in the largest possible thumbnails without overflowing the screen. 131 | 132 | ### 2. Justified (`justified`) 133 | A **Justified Layout** (similar to Google Images). It places windows in rows, maintaining fixed height and original aspect ratios, and scales the row to fit the screen width perfectly. 134 | 135 | ### 3. Masonry (`masonry`) 136 | A **Waterfall** layout (Pinterest-style). It optimizes vertical space by placing windows in dynamic columns. It automatically calculates the optimal number of columns based on the window count. 137 | 138 | ### 4. Bands (`bands`) 139 | Organizes windows by **Workspace**. Creates a horizontal "Band" for each active workspace, grouping relevant tasks together. Windows are justified within their workspace band. 140 | 141 | ### 5. Hero (`hero`) 142 | A focus-centric layout. 143 | * **Hero Area:** The active window takes up 40% of the screen (left side). 144 | * **Stack:** All other windows share the remaining 60% (right side) in a smart grid or column. 145 | 146 | ### 6. Spiral (`spiral`) 147 | A scenic layout based on the **Golden Ratio (BSP)**. 148 | * Windows split the screen in a spiral pattern (Left half, Top-Right half, etc.). 149 | * The first window is separated by a larger gap to emphasize focus. 150 | * If many windows are open, the spiral stops after 3 cuts and arranges the rest in a grid. 151 | 152 | ### 7. Satellite (`satellite`) 153 | An **Orbital** layout. 154 | * The active window sits in the center of the screen. 155 | * All other windows orbit around it in an ellipse. 156 | * Visually stunning and great for focusing on one task while keeping an eye on the surroundings. 157 | 158 | ### 8. Staggered (`staggered`) 159 | A **Honeycomb/Brick** layout. 160 | * Similar to a grid, but every odd row is shifted horizontally by half a cell width. 161 | * Creates a more organic, less rigid look compared to standard grids. 162 | 163 | ### 9. Columnar (`columnar`) 164 | Divides the screen into vertical strips. 165 | * Ignores rows completely and gives every window maximum vertical space. 166 | * Excellent for **Ultrawide** monitors (21:9 / 32:9). 167 | 168 | ### 10. Vortex (`vortex`) 169 | A depth-based Phyllotaxis layout (Sunflower pattern), designed for a scenographic and immersive experience. 170 | * Center Focus: The active window sits in the absolute center at maximum scale. 171 | * Depth Effect: Subsequent windows spiral outwards, gradually decreasing in size and z-index. This creates a 3D "tunnel" effect where older windows fade into the background. 172 | 173 | ### 🎲 Random (`random`) 174 | Feeling adventurous? This mode selects one of the above algorithms at random every time you open the dashboard. 175 | 176 | ## ⌨️ Controls 177 | 178 | | Input | Action | 179 | | :--- | :--- | 180 | | **Typing** | Instantly filters windows by Title, Class, or App ID | 181 | | **Arrows (↑ ↓ ← →)** | Spatial navigation between thumbnails | 182 | | **Tab / Shift+Tab** | Sequential navigation | 183 | | **Enter** | Activate selected window | 184 | | **Middle Click** | Close hovered window | 185 | | **Esc / Click BG** | Close dashboard | 186 | 187 | ## 🤝 Contributing 188 | 189 | Pull Requests are welcome! If you want to add a new layout algorithm or improve performance, please open an issue or submit a PR. 190 | 191 | ## 📄 License 192 | 193 | Distributed under the GNU General Public License v3.0. See `LICENSE` for more information. 194 | 195 | --- 196 | 197 |
198 | 199 | Made with ❤️ for the Hyprland community 200 | 201 |
202 | -------------------------------------------------------------------------------- /modules/WindowThumbnail.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Effects 3 | import Quickshell 4 | import Quickshell.Io 5 | import Quickshell.Widgets 6 | import Quickshell.Wayland 7 | import Quickshell.Hyprland 8 | import Qt5Compat.GraphicalEffects 9 | 10 | Item { 11 | id: thumbContainer 12 | 13 | property var hWin: null 14 | property var wHandle:null 15 | 16 | property string winKey: '' 17 | 18 | property real thumbW: -1 19 | property real thumbH: -1 20 | 21 | property var clientInfo: {} 22 | property bool hovered: false 23 | 24 | property real targetX: -1000 25 | property real targetY: -1000 26 | property real targetZ: 0 27 | property real targetRotation: 0 28 | 29 | property bool moveCursorToActiveWindow: false 30 | 31 | width: thumbW 32 | height: thumbH 33 | 34 | x: 0 35 | y: 0 36 | z: targetZ 37 | rotation: 0 38 | 39 | visible: !!wHandle 40 | 41 | NumberAnimation { 42 | id: animX 43 | target: thumbContainer 44 | property: "x" 45 | duration: root.animateWindows ? 100 : 0 46 | easing.type: Easing.OutQuad 47 | } 48 | NumberAnimation { 49 | id: animY 50 | target: thumbContainer 51 | property: "y" 52 | duration: root.animateWindows ? 100 : 0 53 | easing.type: Easing.OutQuad 54 | } 55 | NumberAnimation { 56 | id: animRotation 57 | target: thumbContainer 58 | property: "rotation" 59 | duration: 400 60 | easing.type: Easing.OutBack // Effetto rimbalzo/inerzia 61 | easing.overshoot: 1.2 62 | } 63 | 64 | function updateLastPos() { 65 | var lp = root.lastPositions || ({}) 66 | var prev = lp[winKey] || ({}) 67 | prev.x = x 68 | prev.y = y 69 | lp[winKey] = prev 70 | root.lastPositions = lp 71 | } 72 | 73 | onTargetXChanged: { 74 | if (!root.animateWindows) { 75 | x = targetX 76 | updateLastPos() 77 | return 78 | } 79 | 80 | var lp = root.lastPositions || ({}) 81 | var prev = lp[winKey] 82 | var startX = (prev && prev.x !== undefined) ? prev.x : targetX 83 | 84 | if (startX === targetX) { 85 | x = targetX 86 | updateLastPos() 87 | return 88 | } 89 | 90 | animX.stop() 91 | animX.from = startX 92 | animX.to = targetX 93 | animX.start() 94 | } 95 | 96 | onTargetYChanged: { 97 | if (!root.animateWindows) { 98 | y = targetY 99 | updateLastPos() 100 | return 101 | } 102 | 103 | var lp = root.lastPositions || ({}) 104 | var prev = lp[winKey] 105 | var startY = (prev && prev.y !== undefined) ? prev.y : targetY 106 | 107 | if (startY === targetY) { 108 | y = targetY 109 | updateLastPos() 110 | return 111 | } 112 | 113 | animY.stop() 114 | animY.from = startY 115 | animY.to = targetY 116 | animY.start() 117 | } 118 | 119 | onTargetRotationChanged: { 120 | rotation = targetRotation 121 | animRotation.stop() 122 | animRotation.from = 0 123 | animRotation.to = targetRotation 124 | animRotation.start() 125 | } 126 | 127 | onXChanged: updateLastPos() 128 | onYChanged: updateLastPos() 129 | 130 | Component.onCompleted: { 131 | rotation = targetRotation 132 | if (!root.animateWindows) { 133 | x = targetX 134 | y = targetY 135 | updateLastPos() 136 | } 137 | } 138 | 139 | function activateWindow() { 140 | if (!hWin) return 141 | 142 | var targetIsSpecial = (hWin?.workspace ?? 0) < 0 || (hWin?.workspace?.name ?? "").startsWith("special") 143 | 144 | if (root.specialActive && !targetIsSpecial) { 145 | Hyprland.dispatch("togglespecialworkspace") 146 | } 147 | 148 | if (hWin.workspace) { 149 | hWin.workspace.activate() 150 | } 151 | 152 | root.toggleExpose() 153 | Hyprland.dispatch("focuswindow address:0x" + hWin.address) 154 | Hyprland.dispatch("alterzorder top") 155 | if (thumbContainer.moveCursorToActiveWindow) { 156 | var cx = clientInfo.at[0] + (clientInfo.size[0]/2) 157 | var cy = clientInfo.at[1] + (clientInfo.size[1]/2) 158 | Hyprland.dispatch("movecursor " + cx + " " + cy) 159 | 160 | } 161 | } 162 | 163 | function closeWindow() { 164 | if (!hWin) return 165 | Hyprland.dispatch("closewindow address:0x" + hWin.address) 166 | } 167 | 168 | function refreshThumb() { 169 | if (thumbLoader.item) { 170 | thumbLoader.item.captureFrame() 171 | } 172 | } 173 | 174 | Item { 175 | id: card 176 | anchors.fill: parent 177 | 178 | scale: thumbContainer.hovered ? 1.05 : 0.95 179 | transformOrigin: Item.Center 180 | 181 | Behavior on scale { 182 | NumberAnimation { duration: 100; easing.type: Easing.OutQuad } 183 | } 184 | 185 | MouseArea { 186 | anchors.fill: parent 187 | hoverEnabled: true 188 | cursorShape: Qt.PointingHandCursor 189 | acceptedButtons: Qt.LeftButton | Qt.MiddleButton 190 | 191 | onEntered: { 192 | exposeArea.currentIndex = index 193 | } 194 | onClicked: event => { 195 | exposeArea.currentIndex = index 196 | 197 | if (event.button === Qt.LeftButton) { 198 | thumbContainer.activateWindow() 199 | } 200 | if (event.button === Qt.MiddleButton) { 201 | thumbContainer.closeWindow() 202 | } 203 | } 204 | onExited: { 205 | if (exposeArea.currentIndex === index) { 206 | exposeArea.currentIndex = -1 207 | } 208 | } 209 | } 210 | 211 | RectangularShadow { 212 | anchors.fill: parent 213 | radius: 16 214 | blur: 24 215 | spread: 10 216 | color: "#55000000" 217 | cached: true 218 | } 219 | 220 | Loader { 221 | id: thumbLoader 222 | anchors.fill: parent 223 | active: root.isActive && !!thumbContainer.wHandle 224 | sourceComponent: ScreencopyView { 225 | id: thumb 226 | anchors.fill: parent 227 | captureSource: thumbContainer.wHandle 228 | live: root.liveCapture && root.isActive 229 | paintCursor: false 230 | visible: root.isActive && thumbContainer.wHandle && hasContent 231 | 232 | layer.enabled: true 233 | layer.effect: OpacityMask { 234 | maskSource: Rectangle { 235 | width: thumb.width 236 | height: thumb.height 237 | radius: 16 238 | } 239 | } 240 | 241 | Rectangle { 242 | anchors.fill: parent 243 | color: thumbContainer.hovered ? "transparent": "#33000000" 244 | border.width : thumbContainer.hovered ? 3 : 1 245 | border.color : thumbContainer.hovered ? "#ff0088cc" : "#cc444444" 246 | radius: 16 247 | } 248 | } 249 | } 250 | 251 | Rectangle { 252 | id: badge 253 | z: 100 254 | width: Math.min(titleText.implicitWidth + 24, thumbContainer.thumbW * 0.75) 255 | height: titleText.implicitHeight + 12 256 | 257 | x: (card.width - width) / 2 258 | y: card.height - height - (card.height * 0.08) 259 | 260 | radius: 12 261 | color: thumbContainer.hovered ? "#FF000000" : "#CC000000" 262 | border.width : 1 263 | border.color : "#ff464646" 264 | 265 | Text { 266 | id: titleText 267 | anchors.centerIn: parent 268 | width: parent.width - 16 269 | text: hWin.title 270 | color: "white" 271 | font.pixelSize: thumbContainer.hovered ? 13 : 12 272 | elide: Text.ElideRight 273 | horizontalAlignment: Text.AlignHCenter 274 | verticalAlignment: Text.AlignVCenter 275 | } 276 | } 277 | } 278 | } 279 | -------------------------------------------------------------------------------- /modules/Hyprview.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2 | import QtQuick.Effects 3 | import Quickshell 4 | import Quickshell.Io 5 | import Quickshell.Widgets 6 | import Quickshell.Wayland 7 | import Quickshell.Hyprland 8 | import Qt5Compat.GraphicalEffects 9 | import "../layouts" 10 | import "." 11 | 12 | PanelWindow { 13 | id: root 14 | 15 | // --- SETTINGS --- 16 | property string layoutAlgorithm: "" 17 | property string lastLayoutAlgorithm: "" 18 | property bool liveCapture: false 19 | property bool moveCursorToActiveWindow: false 20 | 21 | // --- INTERNAL STATE --- 22 | property bool isActive: false 23 | property bool specialActive: false 24 | property bool animateWindows: false 25 | property var lastPositions: {} 26 | 27 | anchors { top: true; bottom: true; left: true; right: true } 28 | color: "transparent" 29 | visible: isActive 30 | 31 | // LayerShell Configs 32 | WlrLayershell.layer: WlrLayer.Overlay 33 | WlrLayershell.exclusiveZone: -1 34 | WlrLayershell.keyboardFocus: isActive ? 1 : 0 35 | WlrLayershell.namespace: "quickshell:expose" 36 | 37 | // --- IPC & EVENTS --- 38 | IpcHandler { 39 | target: "expose" 40 | function toggle(layout: string) { 41 | root.layoutAlgorithm = layout 42 | root.toggleExpose() 43 | } 44 | 45 | function open(layout: string) { 46 | root.layoutAlgorithm = layout 47 | if (root.isActive) return 48 | root.toggleExpose() 49 | } 50 | 51 | function close() { 52 | if (!root.isActive) return 53 | root.toggleExpose() 54 | } 55 | } 56 | 57 | Connections { 58 | target: Hyprland 59 | function onRawEvent(ev) { 60 | if (!root.isActive && ev.name !== "activespecial") return 61 | 62 | switch (ev.name) { 63 | case "openwindow": 64 | case "closewindow": 65 | case "changefloatingmode": 66 | case "movewindow": 67 | Hyprland.refreshToplevels() 68 | refreshThumbs() 69 | return 70 | 71 | case "activespecial": 72 | var dataStr = String(ev.data) 73 | var namePart = dataStr.split(",")[0] 74 | root.specialActive = (namePart.length > 0) 75 | return 76 | 77 | default: 78 | return 79 | } 80 | } 81 | } 82 | 83 | // Update thumbs every 125ms if liveCapture = false 84 | Timer { 85 | id: screencopyTimer 86 | interval: 125 87 | repeat: true 88 | running: !root.liveCapture && root.isActive 89 | onTriggered: root.refreshThumbs() 90 | } 91 | 92 | 93 | function toggleExpose() { 94 | root.isActive = !root.isActive 95 | if (root.isActive) { 96 | if (root.layoutAlgorithm === 'random') { 97 | var layouts = [ 98 | 'smartgrid', 99 | 'justified', 100 | 'bands', 101 | 'masonry', 102 | 'hero', 103 | 'spiral', 104 | 'satellite', 105 | 'staggered', 106 | 'columnar', 107 | 'vortex', 108 | ].filter((l) => l !== root.lastLayoutAlgorithm) 109 | var randomLayout = layouts[Math.floor(Math.random() * layouts.length)] 110 | root.lastLayoutAlgorithm = randomLayout 111 | } else { 112 | root.lastLayoutAlgorithm = root.layoutAlgorithm 113 | } 114 | 115 | exposeArea.currentIndex = -1 116 | searchBox.reset() 117 | Hyprland.refreshToplevels() 118 | refreshThumbs() 119 | } else { 120 | root.animateWindows = false 121 | root.lastPositions = {} 122 | } 123 | } 124 | 125 | function refreshThumbs() { 126 | if (!root.isActive) return 127 | for (var i = 0; i < winRepeater.count; ++i) { 128 | var it = winRepeater.itemAt(i) 129 | if (it && it.visible && it.refreshThumb) { 130 | it.refreshThumb() 131 | } 132 | } 133 | } 134 | 135 | // --- USER INTERFACE --- 136 | FocusScope { 137 | id: mainScope 138 | anchors.fill: parent 139 | focus: true 140 | 141 | Keys.onPressed: (event) => { 142 | if (!root.isActive) return 143 | 144 | if (event.key === Qt.Key_Escape) { 145 | root.toggleExpose() 146 | event.accepted = true 147 | return 148 | } 149 | 150 | const total = winRepeater.count 151 | if (total <= 0) return 152 | 153 | // Helper for horizontal navigation 154 | function moveSelectionHorizontal(delta) { 155 | var start = exposeArea.currentIndex 156 | for (var step = 1; step <= total; ++step) { 157 | var candidate = (start + delta * step + total) % total 158 | var it = winRepeater.itemAt(candidate) 159 | if (it && it.visible) { 160 | exposeArea.currentIndex = candidate 161 | return 162 | } 163 | } 164 | } 165 | 166 | // Helper for vertical navigation 167 | function moveSelectionVertical(dir) { 168 | var startIndex = exposeArea.currentIndex 169 | var currentItem = winRepeater.itemAt(startIndex) 170 | 171 | if (!currentItem || !currentItem.visible) { 172 | moveSelectionHorizontal(dir > 0 ? 1 : -1) 173 | return 174 | } 175 | 176 | var curCx = currentItem.x + currentItem.width / 2 177 | var curCy = currentItem.y + currentItem.height / 2 178 | 179 | var bestIndex = -1 180 | var bestDy = 99999999 181 | var bestDx = 99999999 182 | 183 | for (var i = 0; i < total; ++i) { 184 | var it = winRepeater.itemAt(i) 185 | if (!it || !it.visible || i === startIndex) continue 186 | 187 | var cx = it.x + it.width / 2 188 | var cy = it.y + it.height / 2 189 | var dy = cy - curCy 190 | 191 | // Direction filtering 192 | if (dir > 0 && dy <= 0) continue 193 | if (dir < 0 && dy >= 0) continue 194 | 195 | var absDy = Math.abs(dy) 196 | var absDx = Math.abs(cx - curCx) 197 | 198 | // Search for nearest thumb (first in vertical, then horizontal distance) 199 | if (absDy < bestDy || (absDy === bestDy && absDx < bestDx)) { 200 | bestDy = absDy 201 | bestDx = absDx 202 | bestIndex = i 203 | } 204 | } 205 | 206 | if (bestIndex >= 0) { 207 | exposeArea.currentIndex = bestIndex 208 | } 209 | } 210 | 211 | if (event.key === Qt.Key_Right || event.key === Qt.Key_Tab) { 212 | moveSelectionHorizontal(1) 213 | event.accepted = true 214 | } else if (event.key === Qt.Key_Left || event.key === Qt.Key_Backtab) { 215 | moveSelectionHorizontal(-1) 216 | event.accepted = true 217 | } else if (event.key === Qt.Key_Down) { 218 | moveSelectionVertical(1) 219 | event.accepted = true 220 | } else if (event.key === Qt.Key_Up) { 221 | moveSelectionVertical(-1) 222 | event.accepted = true 223 | } else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) { 224 | var item = winRepeater.itemAt(exposeArea.currentIndex) 225 | if (item && item.activateWindow) { 226 | item.activateWindow() 227 | event.accepted = true 228 | } 229 | } 230 | } 231 | 232 | MouseArea { 233 | anchors.fill: parent 234 | hoverEnabled: false 235 | z: -1 236 | onClicked: root.toggleExpose() 237 | } 238 | 239 | Item { 240 | id: layoutContainer 241 | anchors.fill: parent 242 | anchors.margins: 32 243 | 244 | Column { 245 | id: layoutRoot 246 | anchors.fill: parent 247 | anchors.margins: 48 248 | spacing: 20 249 | 250 | // thumbs area 251 | Item { 252 | id: exposeArea 253 | width: layoutRoot.width 254 | height: layoutRoot.height - searchBox.implicitHeight - layoutRoot.spacing 255 | 256 | property int currentIndex: 0 257 | property string searchText: "" 258 | 259 | // Reset active thumb on searchText change 260 | onSearchTextChanged: { 261 | currentIndex = (windowLayoutModel.count > 0) ? 0 : -1 262 | } 263 | 264 | ScriptModel { 265 | id: windowLayoutModel 266 | 267 | property int areaW: exposeArea.width 268 | property int areaH: exposeArea.height 269 | property string query: exposeArea.searchText 270 | property string algo: root.lastLayoutAlgorithm 271 | property var rawToplevels: Hyprland.toplevels.values 272 | 273 | values: { 274 | // Bailout on wrong screen size 275 | if (areaW <= 0 || areaH <= 0) return [] 276 | 277 | var q = (query || "").toLowerCase() 278 | var windowList = [] 279 | var idx = 0 280 | 281 | if (!rawToplevels) return [] 282 | 283 | for (var it of rawToplevels) { 284 | var w = it 285 | var clientInfo = w && w.lastIpcObject ? w.lastIpcObject : {} 286 | var workspace = clientInfo && clientInfo.workspace ? clientInfo.workspace : null 287 | var workspaceId = workspace && workspace.id !== undefined ? workspace.id : undefined 288 | 289 | // Filter invalid workspace or offscreen windows 290 | if (workspaceId === undefined || workspaceId === null) continue 291 | var size = clientInfo && clientInfo.size ? clientInfo.size : [0, 0] 292 | var at = clientInfo && clientInfo.at ? clientInfo.at : [-1000, -1000] 293 | if (at[1] + size[1] <= 0) continue 294 | 295 | // Text filtering 296 | var title = (w.title || clientInfo.title || "").toLowerCase() 297 | var clazz = (clientInfo["class"] || "").toLowerCase() 298 | var ic = (clientInfo.initialClass || "").toLowerCase() 299 | var app = (w.appId || clientInfo.initialClass || "").toLowerCase() 300 | 301 | if (q.length > 0) { 302 | var match = title.indexOf(q) !== -1 || clazz.indexOf(q) !== -1 || 303 | ic.indexOf(q) !== -1 || app.indexOf(q) !== -1 304 | if (!match) continue 305 | } 306 | 307 | windowList.push({ 308 | win: w, 309 | clientInfo: clientInfo, 310 | workspaceId: workspaceId, 311 | width: size[0], 312 | height: size[1], 313 | originalIndex: idx++, 314 | lastIpcObject: w.lastIpcObject 315 | }) 316 | } 317 | 318 | // Sort by workspaceId, then originalIndex 319 | windowList.sort(function(a, b) { 320 | if (a.workspaceId < b.workspaceId) return -1 321 | if (a.workspaceId > b.workspaceId) return 1 322 | if (a.originalIndex < b.originalIndex) return -1 323 | if (a.originalIndex > b.originalIndex) return 1 324 | return 0 325 | }) 326 | 327 | return LayoutsManager.doLayout(algo, windowList, areaW, areaH) 328 | } 329 | } 330 | 331 | Repeater { 332 | id: winRepeater 333 | model: windowLayoutModel 334 | 335 | delegate: WindowThumbnail { 336 | // Model data 337 | hWin: modelData.win 338 | wHandle: hWin.wayland 339 | winKey: String(hWin.address) 340 | thumbW: modelData.width 341 | thumbH: modelData.height 342 | clientInfo: hWin.lastIpcObject 343 | 344 | // Layout-generated coordinates 345 | targetX: modelData.x 346 | targetY: modelData.y 347 | targetZ: (visible && (exposeArea.currentIndex === index)) ? 1000: modelData.zIndex || 0 348 | targetRotation: modelData.rotation || 0 349 | 350 | hovered: visible && (exposeArea.currentIndex === index) 351 | moveCursorToActiveWindow: root.moveCursorToActiveWindow 352 | } 353 | } 354 | } 355 | 356 | SearchBox { 357 | id: searchBox 358 | onTextChanged: function(text) { 359 | root.animateWindows = true 360 | exposeArea.searchText = text 361 | } 362 | } 363 | } 364 | } 365 | } 366 | } 367 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------