Just tried creating ~/.local/share/nautilus/scripts/foo.sh
with the following contents and making it executable and it works:
#!/usr/bin/env bash
for f in "$@"; do
echo "- $f" >> test.log
done
Make sure the interpreter exists and all dependencies are available. Notably, NixOS does not have anything in /usr/bin
other than env
, and /bin
only contains sh
.
And if it depends on more than just programs on PATH
, you might need to package the script similarly as described in How is XDG_DATA_DIRS set for some apps? - #6 by jtojnar.