#!/usr/bin/env nix-shell #!nix-shell -i bash -p sane-open # 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 --auto-keyboard --application "$desktop" elif [ "$binary" = "xdg-open" ]; then exec sane-open --auto-keyboard --file "${binArgs[@]}" fi printf "no .desktop file, and unexpected binary; not invoking: %s %s\n" "$binary" "${binArgs[*]}" >&2 exit 1