#!/usr/bin/env nix-shell #!nix-shell -i bash -p sane-open-desktop -p xdg-utils # use: # rofi-run-command .desktop [cmd [args ...]] # if a non-empty desktop file is provided, we'll just launch that. # else, if the cmd is `xdg-open`, then we'll treat `args` as a URI and forward that to xdg-open. # nothing else is as-yet supported. desktop="$1" shift binary="$1" shift binArgs=("$@") if [ "$desktop" != .desktop ]; then exec sane-open-desktop "$desktop" elif [ "$binary" = "xdg-open" ]; then exec xdg-open "$@" fi printf "no .desktop file, and unexpected binary; not invoking: %s %s" "$binary" "${binArgs[*]}" > /dev/null exit 1