Files
DankMaterialShell/quickshell/Modules/DankDash/utils/widgets.js
T
bbedward 014c69b09a settings: tile color restyle and re-org, use materials own shift for
them towards theme
controlCenter: make a real grid, add numerous more tile varieties, add
icon size option
surfaces: fix elevation levels in general, and shift them down
settings: restyles and re-org
sliders: scale down universally
2026-09-18 14:32:55 -04:00

38 lines
1.3 KiB
JavaScript

.import "../../../Common/GridLayout.js" as GridLayout
function resolve(definitions, saved) {
const source = Array.isArray(saved) ? saved : definitions.filter(d => d.enabled !== false);
const seen = Object.create(null);
return source.filter(item => {
if (!item || typeof item.id !== "string" || seen[item.id])
return false;
seen[item.id] = true;
return true;
}).map(item => {
const spec = definitions.find(d => d.id === item.id);
if (!spec)
return item;
return {
id: item.id,
w: GridLayout.dimension(item.w, spec.minW, spec.maxW, spec.w),
h: GridLayout.dimension(item.h, spec.minH, spec.maxH, spec.h),
graphics: typeof item.graphics === "boolean" ? item.graphics : true
};
});
}
function replace(items, index, changes) {
if (index < 0 || index >= items.length)
return items;
return items.map((item, i) => i === index ? Object.assign({}, item, changes) : item);
}
function move(items, index, delta) {
const target = index + delta;
if (index < 0 || index >= items.length || target < 0 || target >= items.length)
return items;
const result = items.slice();
result.splice(target, 0, result.splice(index, 1)[0]);
return result;
}