Skip to content

Instantly share code, notes, and snippets.

@cat-in-136
Created April 26, 2017 12:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cat-in-136/fc035d093b02bac5a014e4b8ee52165c to your computer and use it in GitHub Desktop.
Save cat-in-136/fc035d093b02bac5a014e4b8ee52165c to your computer and use it in GitHub Desktop.
Nautilus Script of "Copy as Path"
#!/bin/sh
# Dependency check : zenity, xclip
if which zenity > /dev/null 2> /dev/null; then
:
else
xmessage -nearmouse zenity is required but not installed.
exit 1
fi
if which xclip > /dev/null 2> /dev/null; then
:
else
zenity --error --text="xclip is required but not installed."
fi
if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]; then
echo -n $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS | xclip -i -selection clipboard
elif [ -n "$NEMO_SCRIPT_SELECTED_FILE_PATHS" ]; then
echo -n $NEMO_SCRIPT_SELECTED_FILE_PATHS | xclip -i -selection clipboard
else
zenity --error --text="No path selected."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment