omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

Bar widgets cannot be dragged into an empty section (e.g. empty left section)

Open aronnaxlin opened this issue 3 months ago • 3 comments

System details

Intel Core Ultra 9 185H, NVIDIA GeForce RTX 4060 Mobile, Omarchy 4.0.2-1, Hyprland 0.56.2

What's wrong?

When a bar layout section (such as left) becomes completely empty ("left": [] in ~/.config/omarchy/shell.json), widgets from center or right cannot be moved into that section via mouse drag-and-drop.

Steps to reproduce

  1. Empty the left section of the bar, for example:
    omarchy bar move omarchy.menu --section center
    omarchy bar move omarchy.workspaces --section center
    
    Now ~/.config/omarchy/shell.json has "left": [].
  2. Attempt to drag any widget (such as omarchy.workspaces) from the center section to the far left side of the bar.
  3. Release the mouse.

Observed behavior

The widget cannot be dropped into the left section. It always snaps to the nearest widget in the center section (or right). It is impossible to restore widgets to the empty section via GUI drag-and-drop. The only workaround is using CLI (omarchy bar move <widget> --section left) or manually editing shell.json.

Root cause analysis

In shell/plugins/bar/Bar.qml:

  • moduleDropAtScene() iterates over moduleSlots to find drop target candidates:
    var candidates = []
    for (var i = 0; i < moduleSlots.length; i++) {
      var slot = moduleSlots[i]
      if (!slot || slot === sourceSlot || !slot.visible || slot.width <= 0 || slot.height <= 0) continue
      ...
      candidates.push({ slot: slot, ... })
    }
    return BarModel.nearestDropTarget(candidates, scenePoint, root.vertical)
    
  • BarModel.nearestDropTarget() selects the closest existing slot among candidates and drops before/after that slot's section.
  • When left has 0 widgets, there are no ModuleSlot items in region: "left".
  • Consequently, all candidates belong to center or right. Any cursor position (even at x=0) resolves to a slot in center or right, so the drop target region is never "left".

Empty layout regions should have drop target bounds (or fallback to empty section bounds) so widgets can be dropped into an empty section.

aronnaxlin avatar Sep 02 '26 16:09 aronnaxlin

Checked against the current quattro (98301428), and the bug is still there. In shell/plugins/bar/Bar.qml, a section with no widgets has its module list hidden, so it creates no slots (ModuleList, line 1846). moduleDropAtScene (line 982) only offers visible widgets with a non-zero size as drop targets. BarModel.nearestDropTarget then picks the nearest of those, so a drag can never resolve to an empty section. The function that moves the widget in the config already handles an empty destination. The missing piece is a drop target for an empty section.

#10002 fixes exactly this: when a section has no widgets, it adds a drop target for that section at the start, middle or end of the bar, horizontal or vertical. It already says it closes this issue. omabot reviewed it separately and tested it on a worker built from the Omarchy ISO, using real pointer drags into empty left, centre and right sections. #11279 reports the same bug.

The second opinion was Codex Medium. It agreed with the diagnosis and with #10002 covering it, though its independence is not guaranteed. It also checked the targeting logic on its own, in memory: the drop failed for all three empty sections on quattro and succeeded with #10002. Nothing was run for this issue itself.

This now waits on the maintainer's decision on #10002.

omarchybot avatar Oct 11 '26 02:10 omarchybot

Confirmed on a stock x86_64 desktop: Omarchy 4.5.0-3, Hyprland 0.56.2-4, Quickshell 0.3.2.r7.g2b4501a-1, AMD Ryzen 7 5800X3D, single 1920x1080 output at scale 1, bar at the top, no camera cutout. This reproduces the same failure as #18533 without Apple hardware.

Minimal reproduction:

  1. Empty the left section: omarchy bar move omarchy.menu --section right --index 0 omarchy bar move omarchy.workspaces --section centerBegin --index 0 shell.json now has "left": [].
  2. Drag omarchy.menu from the right section to the empty left end of the bar and release.

Expected: omarchy.menu goes into left. Actual: it lands in centerBegin[0], immediately left of the workspaces, and left stays []. The drag cannot put the widget back into the empty left section.

Workaround that works: omarchy bar move omarchy.menu --section left --index 0

The drop-target code is unchanged between 4.5.0-3 and quattro HEAD. moduleDropAtScene() in Bar.qml builds candidates only from visible widget slots, and BarModel.centerDropTarget() synthesises edges only for centerBegin and centerEnd. An empty left or right section has no position on the bar to aim at.

kennaidoo avatar Nov 16 '26 18:11 kennaidoo

Rechecked the new stock-desktop report against quattro 419a5a709. The current source still has no drop target for an empty left or right section: moduleDropAtScene in shell/plugins/bar/Bar.qml supplies widget slots, and BarModel.centerDropTarget adds targets for the center group only. The reported drop into centerBegin[0] follows that path without requiring a camera cutout or a particular GPU.

#10002 is now closed. #16753 supplies the missing bar-end targets for the reported empty-left case and already links this issue. #18587 is another open fix for empty side sections; draft #19185 covers an overlapping empty-left case. This issue waits on the maintainer's decision on the existing fixes. Nothing further is needed from the reporter.

Codex High reviewed the current source and those diffs. Opus 5.5 High and muse-wonder via pi, thinking high, gave second opinions and agreed with the diagnosis and #16753 covering the ordinary case; their independence is not guaranteed. This session was source review only: no tests or live reproduction were run.

omarchybot avatar Nov 18 '26 03:11 omarchybot