• Skull giver@popplesburger.hilciferous.nl
    link
    fedilink
    arrow-up
    0
    ·
    8 months ago

    What do you mean with “copy path to file”? Do you mean “copy to clipboard”, as in, store the absolute path of a file to the clipboard?

    Last time I needed this, all I needed to to was copy a file/folder and paste it in a text editor. Drag and drop also worked for most programs, though some tools weren’t d&d aware and don’t accept input that way.

    I don’t use this feature often, though, so it may have changed since I last tried. It also tended to prepend protocols like dav:// or smb:// when copying files from shares rather than copying the path to the place these shares were mounted.

    • wvstolzing@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      8 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
      0
      ·
      8 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 Wajland. Between 2 windows of the same app, e.g. Nautilus it’s working.