diff options
| author | nippy <you@example.com> | 2026-04-18 13:49:56 +0200 |
|---|---|---|
| committer | nippy <you@example.com> | 2026-04-18 13:49:56 +0200 |
| commit | 5d94c0a7d44a2255b81815a52a7056a94a39842d (patch) | |
| tree | 759bdea9645c6a62f9e1e4c001f7d81cccd120d2 /raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/utils/layout.js | |
| parent | e79cdf210b267f21a186255ce1a4d50029439d54 (diff) | |
| download | RaveOS-PKGBUILD-5d94c0a7d44a2255b81815a52a7056a94a39842d.tar.gz RaveOS-PKGBUILD-5d94c0a7d44a2255b81815a52a7056a94a39842d.zip | |
update Raveos themes
Diffstat (limited to 'raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/utils/layout.js')
| -rw-r--r-- | raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/utils/layout.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/utils/layout.js b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/utils/layout.js new file mode 100644 index 0000000..b8e5651 --- /dev/null +++ b/raveos-theme/hyprland/theme-data/DankMaterialShell/quickshell/Modules/ControlCenter/utils/layout.js @@ -0,0 +1,45 @@ +function calculateRowsAndWidgets(controlCenterColumn, expandedSection, expandedWidgetIndex) { + var rows = [] + var currentRow = [] + var currentWidth = 0 + var expandedRow = -1 + + const widgets = SettingsData.controlCenterWidgets || [] + const baseWidth = controlCenterColumn.width + const spacing = Theme.spacingS + + for (var i = 0; i < widgets.length; i++) { + const widget = widgets[i] + const widgetWidth = widget.width || 50 + + var itemWidth + if (widgetWidth <= 25) { + itemWidth = (baseWidth - spacing * 3) / 4 + } else if (widgetWidth <= 50) { + itemWidth = (baseWidth - spacing) / 2 + } else if (widgetWidth <= 75) { + itemWidth = (baseWidth - spacing * 2) * 0.75 + } else { + itemWidth = baseWidth + } + + if (currentRow.length > 0 && (currentWidth + spacing + itemWidth > baseWidth)) { + rows.push([...currentRow]) + currentRow = [widget] + currentWidth = itemWidth + } else { + currentRow.push(widget) + currentWidth += (currentRow.length > 1 ? spacing : 0) + itemWidth + } + + if (expandedWidgetIndex === i) { + expandedRow = rows.length + } + } + + if (currentRow.length > 0) { + rows.push(currentRow) + } + + return { rows: rows, expandedRowIndex: expandedRow } +} |