dock: add drag-to-reorder for pinned apps alongside existing combine-into-stack
Dragging a pinned app now shows an insertion gap indicator when hovering over other pinned apps. Quick horizontal slide + release = reorder the pinned apps array. Dwell (500ms) on a target still = combine into stack (existing behavior). Both gestures share the same drag start and ghost. TaskbarApps: reorderPinned() splice-moves within Config.options.dock.pinnedApps. DockApps: shared dragSourceIndex/dragInsertIndex state, delegate passes parent.index as modelIndex to DockAppButton. DockAppButton: insertion indicator (2px primary-color line), DropArea onEntered computes gap position based on drag direction, release handler commits reorder when no dwell fired. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
9c27504009
commit
132d8134f2
4 changed files with 77 additions and 231 deletions
|
|
@ -156,6 +156,19 @@ Singleton {
|
|||
root.writeStacks(parsed);
|
||||
}
|
||||
|
||||
// Reorder a pinned app within the pinnedApps array. targetPinnedIndex
|
||||
// is the desired final index (0-based) in Config.options.dock.pinnedApps.
|
||||
// The app is removed from its current position and spliced in at the
|
||||
// target; other pins shift to fill / make room.
|
||||
function reorderPinned(appId, targetPinnedIndex) {
|
||||
const pinned = Config.options.dock.pinnedApps.slice();
|
||||
const srcIdx = pinned.findIndex(id => id.toLowerCase() === appId.toLowerCase());
|
||||
if (srcIdx < 0 || srcIdx === targetPinnedIndex) return;
|
||||
pinned.splice(srcIdx, 1);
|
||||
pinned.splice(targetPinnedIndex, 0, appId);
|
||||
Config.options.dock.pinnedApps = pinned;
|
||||
}
|
||||
|
||||
// Pull a member out of its stack back to a standalone pinned app.
|
||||
function unstackMember(stackId, appId) {
|
||||
root.removeFromStack(stackId, appId);
|
||||
|
|
|
|||
Loading…
Reference in a new issue