Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
22 lines
1.2 KiB
JavaScript
22 lines
1.2 KiB
JavaScript
function editModule(modules,id,key,value) {return modules.map(m=>m.id===id?Object.assign({},m,{[key]:value}):m);}
|
|
function moveModule(modules,id,direction) {
|
|
const result=modules.slice(),item=result.find(m=>m.id===id);
|
|
if(!item)return result;
|
|
const lane=result.filter(m=>m.position===item.position),from=lane.findIndex(m=>m.id===id),target=lane[from+direction];
|
|
if(!target)return result;
|
|
const a=result.findIndex(m=>m.id===id),b=result.findIndex(m=>m.id===target.id);
|
|
[result[a],result[b]]=[result[b],result[a]];return result;
|
|
}
|
|
function removeModule(modules,id) {return modules.filter(m=>m.id!==id);}
|
|
// Move one stable module ID into a lane before another ID, or append to that lane.
|
|
function dropModule(modules,id,position,before) {
|
|
if (!["left","center","right"].includes(position) || before === id) return modules.slice();
|
|
const item=modules.find(m=>m.id===id);
|
|
if(!item)return modules.slice();
|
|
const result=modules.filter(m=>m.id!==id);
|
|
let index=result.findIndex(m=>m.id===before && m.position===position);
|
|
if(index<0) {index=result.length;for(let i=result.length-1;i>=0;i--)if(result[i].position===position){index=i+1;break;}}
|
|
result.splice(index,0,Object.assign({},item,{position:position}));
|
|
return result;
|
|
}
|