• wvstolzing@lemmy.ml
    link
    fedilink
    arrow-up
    20
    ·
    edit-2
    5 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.)