• wvstolzing@lemmy.ml
      link
      fedilink
      arrow-up
      20
      ·
      edit-2
      10 months ago

      Putting the following with executable permissions inside ~/.local/share/nautilus/scripts/SCRIPTNAME adds a right click menu to Nautilus that serves the same purpose:

      #!/bin/bash
      
      CLIPBD=''
      [[ "${XDG_SESSION_TYPE}" == "x11" ]] && CLIPBD='xsel -ib'
      [[ "${XDG_SESSION_TYPE}" == "wayland" ]] && CLIPBD='wl-copy --trim-newline' && wl-copy --clear
      
      echo -n "${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}" \
        | tee >(xargs -I {} notify-send "Path Copied:" "{}") \
        | ${CLIPBD}
      

      The ‘notify-send’ bit isn’t necessary; it just puts up a notification.

      Mentioning only because it’s a simple demonstration of a pretty easy way to extend Nautilus for all kinds of purposes; w/o messing around with the pygobject interface. (There’s supposed to be an xdg standard for file manager extensions like this, but managers use their own custom folders, syntax, etc. for such extensions. I think pcmanfm adheres to the standard; Dolphin requires a .desktop file somewhere; Thunar, Caja, & Nemo work similar to Nautilus.)

    • infeeeee@lemm.ee
      link
      fedilink
      arrow-up
      9
      ·
      edit-2
      10 months ago

      Yes, Gnome is context aware if you ctrl+c a an image file, and you paste it to a text editor it will paste it as a path, if you paste it in an image editor it will be pasted as an image, if the program supports it (e.g. it works in Krita, but not in Pinta)

      Drag and drop is not working because of Wayland. Between 2 windows of the same app, e.g. Nautilus it’s working.

        • infeeeee@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          9 months ago

          Which apps? Are you sure they are not xwayland? I cannot dnd anything from FileRoller or from Xarchiver

          • AProfessional@lemmy.world
            link
            fedilink
            English
            arrow-up
            1
            ·
            edit-2
            9 months ago

            I never drag anything into Nautilus, but Nautilus -> gnome-text-editor works as expected. Nautilus -> My terminal, and my video player works too.

      • Fushuan [he/him]@lemm.ee
        link
        fedilink
        English
        arrow-up
        1
        ·
        9 months ago

        Cool, it pastes it as an image in telegram, I would need to use a text editor as a proxy. Gnome is not context aware enough to read my brain to know the intent, having the choice to be explicit (copy path) is just better.