I have been using Linux & Gnome & Nautilus for almost decades new but somehow I have only recently gotten to know it’s intricacies.

Today I leaned you can place convenient shortcuts akin to the Windows SendTo Menu (but way more powerful) into Nautilus. All you have to do is to place a script under ~/.local/share/nautilus/scripts and make it executable.

Taking it for a spin

There’s a shared function called flip_h in my bash/zsh config that will take files of various types and try to mirror it horizontally, which is something that would be quite handy to have available in the GUI:

flip_h() {
    # Filename extraction https://stackoverflow.com/a/965069
    TMPFILE="${1%%.*}.tmp.${1##*.}"

    case "${1##*.}" in
    mp4|avi)
        ffmpeg -i "$1" -vf hflip -c:a copy $TMPFILE && rm "$1" && mv $TMPFILE "$1"
        ;;

    jpg|jpeg|png)
        mogrify -flop "$1"
        ;;
    esac
}

for FILE in "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS"; do
    flip_h "$FILE"
done

A quick chmod +x Flip\ Horizontally later this automatically shows up in the menu:

Screenshot with the newly added Script available in Nautilus Context Menu