Skip to content

feat(panel): dnd improvements for the app list#1343

Open
edfloreshz wants to merge 5 commits into
pop-os:masterfrom
edfloreshz:fix/duplicate-icon-dnd
Open

feat(panel): dnd improvements for the app list#1343
edfloreshz wants to merge 5 commits into
pop-os:masterfrom
edfloreshz:fix/duplicate-icon-dnd

Conversation

@edfloreshz
Copy link
Copy Markdown
Contributor

@edfloreshz edfloreshz commented Mar 8, 2026

This PR improves the app list drag and drop experience:

  • Dragged icon no longer appears three times while dragging
  • Icons can now be dragged all the way to the right
  • Icon preview is now aligned precisely to the position of the icon in the dock, the cursor's position is used to calculate the exact pickup offset when the drag starts
  • Fixed a bug that caused multiple insertions if an icon entered the dock multiple times.

Currently blocked by: pop-os/libcosmic#1161

Current behavior:

2026-03-08.15-13-44.mp4

New behavior:

2026-03-08.15-12-45.mp4
  • I have disclosed use of any AI generated code in my commit messages.
    • If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
    • In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
  • I understand these changes in full and will be able to respond to review comments.
  • My change is accurately described in the commit message.
  • My contribution is tested and working as described.
  • I have read the Developer Certificate of Origin and certify my contribution under its conditions.

@edfloreshz edfloreshz force-pushed the fix/duplicate-icon-dnd branch 2 times, most recently from 71cc9a1 to 98fcf7f Compare March 9, 2026 16:36
@mmstick mmstick requested review from a team March 9, 2026 16:38
@edfloreshz
Copy link
Copy Markdown
Contributor Author

I've noticed some inconsistencies, please hold on merging this until I fix them.

@jacobgkau jacobgkau marked this pull request as draft March 10, 2026 01:16
@jacobgkau
Copy link
Copy Markdown
Member

I've noticed some inconsistencies, please hold on merging this until I fix them.

I've marked as a draft for you. Just let us know when it's ready to look at.

@edfloreshz edfloreshz force-pushed the fix/duplicate-icon-dnd branch from 98fcf7f to e2937f3 Compare March 10, 2026 08:15
@edfloreshz edfloreshz marked this pull request as ready for review March 10, 2026 08:31
@edfloreshz
Copy link
Copy Markdown
Contributor Author

Reworked a few things to address some inconsistencies, also fixed a bug that caused multiple insertions if DndEnter fired repeatedly.

Would appreciate a second pair of eyes before we merge, happy to discuss any of the changes.

Copy link
Copy Markdown
Contributor

@wash2 wash2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to revisit this after the rebase updates are merged, and fix the libcosmic issue before merging the changes.

Comment thread cosmic-app-list/src/app.rs Outdated
Comment thread cosmic-app-list/src/app.rs Outdated
@edfloreshz
Copy link
Copy Markdown
Contributor Author

@wash2 Yesterday I bumped the applet to the latest libcosmic rev and I noticed some issues with how the app list was rendered, if you'd like I could push a branch for you to test.

@edfloreshz edfloreshz force-pushed the fix/duplicate-icon-dnd branch from 5800967 to 61d232f Compare May 12, 2026 20:32
@edfloreshz
Copy link
Copy Markdown
Contributor Author

@wash2 I bumped libcosmic to the latest rev and I can't replicate the issues I had last time, I think we're good to merge this unless you find any issues.

@edfloreshz edfloreshz requested a review from wash2 May 12, 2026 20:36
- hide the original icon and replace its position with an empty container while dragging
- reorder items only when the drag position crosses a defined threshold: center of the target +- 4px
- the cursor's position is used to calculate the exact pickup offset
- reduce the drag threshold to 0 to ensure no drag events are skipped
- track the dragged item so that if it is removed during a drag and was previously active, it is automatically added to the active list
@jacobgkau jacobgkau force-pushed the fix/duplicate-icon-dnd branch from 64fe174 to 2819771 Compare May 13, 2026 18:50
@wash2
Copy link
Copy Markdown
Contributor

wash2 commented May 13, 2026

The code looks fine, but when I tested it with the master branch for the panel, icons weren't drawn. It might be because of a panel bug though and it seems to be fixed when testing with pop-os/cosmic-panel#602 so I think it is fine if it is merged after the panel smithay update.

Copy link
Copy Markdown
Member

@jacobgkau jacobgkau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a few concerns with this.

  1. Sometimes, the tooltip icon doesn't show up. This was already a bug before, but together with this change, we now end up dragging something that we can't see what it is, since this removes the on-dock previews and leaves only the tooltip (when it works).
2026-05-13.14-44-27.mp4
  1. I'm seeing that if I drag an icon out of the dock, it's impossible to drag it back in (even if I haven't released the mouse button yet). This bug also occurred sometimes before, but before, it would result in the icon staying where it was before the drag started. Now, it results in the icon being removed from the dock, which takes more effort to recover from.
2026-05-13.14-43-23.mp4
  1. I also had one instance where the dock got stuck showing an app as running when I'd actually already quit it. I'm not sure if this was a regression or not (I haven't made it happen a second time yet, but it might've had something to do with pinning/unpinning the app).
2026-05-13.14-43-58.mp4

We'll want @pop-os/ux input on this kind of change. @pop-os/ux, if the tooltip was working 100% of the time, would it be the desired implementation to have the icon tooltip and a blank gap in the dock where the icon will go when dropped? Or would it be better to have a single dynamic instance of the icon in the dock where the icon's going to be placed, maybe without the tooltip (more similar to how the new DnD implementation in the App Library's going to work)? I guess if we had the icon draggable on the dock itself (like the app library folders), then we might still want the tooltip when the cursor leaves the dock, so the user knows they're still holding onto the icon when it's in the "drop off the dock to remove" state.

@edfloreshz
Copy link
Copy Markdown
Contributor Author

Now that you mention it, I also noticed some quirks while running inside the panel, including the inability to drag icons back in, but I can't replicate this while the applet runs standalone, which suggests the issue lies with the panel itself.

I'm not sure if the issue @wash2 mentions could improve this tho.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants