Skip to content

The copy link context menu item doesn't populate the clipboard #164

Open

Description

@entodoays

When you click on the copy link sub-menu item in the Dropbox menu in Files, a notification shows saying that the link has been copied but the clipboard remains empty. If I click on the notification, the Dropbox link opens in a browser tab.

This has been the case for a while now.

OS: Fedora 43
Desktop Environment: Gnome 49 on Wayland
Dropbox version: 242.4.5815

Image Image

Activity

  1. entodoays commented on Mar 8, 2026

    @entodoays
    Author

    I'm not using an ARM64 laptop but an x86_64 one.

  2. mblackshaw commented on Apr 1, 2026

    @mblackshaw

    I'm seeing this too on Arch Linux / Gnome 49

  3. jarthod commented on Apr 25, 2026

    @jarthod

    Thanks for reporting this ^^
    I have the same on Ubuntu for months/years: on 25.10 and also 24.04 LTS (I'm guessing since Wayland from what I read).
    Currently running dropbox 248.4.3576 on Gnome 49 (wayland)

  4. egemenk commented on Apr 26, 2026

    @egemenk

    Same on Kubuntu 25.10 with KDE on Wayland.

  5. Dave262 commented on Sep 16, 2026

    @Dave262

    Also seeing this same behavior on my system:
    Linux 7.2.5-200.fc44.x86_64,
    Fedora Linux 44
    Gnome 50.4

    dropbox 270.4.3312

    feels very much like a wayland clipboard handling issue

  6. shonie commented on Oct 31, 2026

    @shonie

    I looked into this. The extension only asks the Dropbox daemon to copy the link, and the daemon writes the clipboard itself. On Wayland, the daemon (a GTK3 app) uses GTK's Wayland backend. Wayland compositors ignore clipboard writes from apps without keyboard focus, and the daemon only has a tray icon. So the write is silently dropped, but the "link copied" notification still appears.

    Workaround: start Dropbox with GTK's X11 backend, so the clipboard write goes through XWayland, which forwards it to the Wayland clipboard:

    GDK_BACKEND=x11,wayland dropbox start
    

    To make it permanent, change the Exec= line in ~/.config/autostart/dropbox.desktop to start with env GDK_BACKEND=x11,wayland, for example Exec=env GDK_BACKEND=x11,wayland dropbox start -i. Then restart Dropbox. The ,wayland part lets GTK fall back if XWayland isn't available.

    This fixed it for me on Arch Linux with GNOME on Wayland (Dropbox 278.3.3901). I've opened #176 to make dropbox start do this automatically.

  7. shonie commented on Oct 31, 2026

    @shonie

    Correction to my workaround above: editing ~/.config/autostart/dropbox.desktop doesn't survive reboots, because Dropbox rewrites that file every time it starts, even after you delete it.

    What works for me is a small wrapper earlier in PATH, so the dropbox command that the autostart entry runs gets the variable:

    printf '%s\n' '#!/bin/sh' 'export GDK_BACKEND="${GDK_BACKEND:-x11,wayland}"' 'exec /usr/bin/dropbox "$@"' | sudo tee /usr/local/bin/dropbox >/dev/null && sudo chmod 755 /usr/local/bin/dropbox

    Adjust /usr/bin/dropbox if your dropbox lives elsewhere (check with command -v dropbox first). Survives reboots on Arch / GNOME Wayland.

  8. sorenhauberg commented on Nov 17, 2026

    @sorenhauberg

    I've got a fix for this that works differently from PR #176, and would
    appreciate feedback from the maintainers.

    Root cause (already diagnosed above, restating for context)

    On Wayland, the compositor ignores clipboard writes from clients without
    keyboard focus. The extension itself never touches the clipboard — it just
    forwards the verb to the daemon via icon_overlay_context_action, and the
    daemon (a GTK app with only a tray icon) does the clipboard write, which the
    compositor silently drops. The "link copied" notification comes from the
    daemon, so the user still sees it.

    The fix

    Since the extension runs inside Nautilus (which does have keyboard focus),
    it can set the clipboard itself:

    1. When the daemon-supplied context menu is built, tag any item whose verb or
      label matches "copy…link".
    2. When such an item is activated, still send icon_overlay_context_action
      as usual, so the daemon creates the link and shows its notification.
    3. In the command response handler, ask the daemon for the link via its
      existing get_shared_link command (the same one the dropbox sharelink
      CLI uses), for the selected path.
    4. Set the resulting URL on the GDK clipboard from the main thread via
      g_idle_add — Nautilus has keyboard focus, so Wayland accepts the write.

    This fixes the issue without forcing the whole daemon onto the GTK X11 backend
    (as #176 does), so no XWayland dependency is introduced. Note that the daemon
    only offers its context menu for single selections, so the patch handles a
    single path. One caveat: the exact verb string sent by the daemon isn't
    statically extractable (the daemon bytecode is obfuscated), so step 1 uses a
    heuristic matching "copy" + "link" in the verb or the item label. The verb is
    locale-independent, so this should hold in all locales, but it would be nice
    if the daemon team could confirm the canonical verb.

    Visual feedback

    Since the daemon's own "link copied" feedback doesn't appear on all setups,
    I also added a desktop notification so the user gets feedback that the link
    actually made it to the clipboard. It talks to the standard
    org.freedesktop.Notifications D-Bus interface directly via GDBus, so it adds
    no new build dependency (no libnotify). On success it shows a
    "Dropbox link copied" notification containing the URL; if the daemon fails to
    return a usable link, it shows a "Dropbox link not copied" notification instead
    (that failure case used to be silent).

    Attachments

    I'm attaching two patch files, to be applied in order on current master:

    1. nautilus-dropbox-wayland-copy-link-v2.patch — the clipboard fix itself
      (git apply or patch -p1).
    2. nautilus-dropbox-copy-link-notification.patch — adds the notification
      feedback on top of the first patch.

    I've tested both on Fedora (GNOME on Wayland): with a file selected,
    "Copy Dropbox link" now actually populates the clipboard, and a notification
    confirms it.

    Attribution note: the code in these patches was written with the
    assistance of Vibe (an AI agent built by Mistral AI), based on my problem
    description and test feedback. I reviewed and tested it, but I am not the
    original author of the code itself.

    nautilus-dropbox-wayland-copy-link-v2.patch

    nautilus-dropbox-copy-link-notification.patch

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions