nix-config/_/overlays/xdg-open-spawn-terminal.diff

21 lines
674 B
Diff
Raw Permalink Normal View History

diff --git a/scripts/xdg-open.in b/scripts/xdg-open.in
index 50e31e6..6f698dc 100644
--- a/scripts/xdg-open.in
+++ b/scripts/xdg-open.in
@@ -320,7 +320,14 @@ search_desktop_file()
args=$(( $args - 1 ))
done
[ $replaced -eq 1 ] || set -- "$@" "$target"
- env "$command" "$@"
+ if [ x"$(get_key "${file}" "Terminal")" = x"true" ] && ( [ ! -t 0 ] || [ ! -t 1 ] ); then
+ if [ -z "$TERMINAL" ]; then
+ TERMINAL="xterm -e"
+ fi
+ $TERMINAL env "$command" "$@" &
+ else
+ env "$command" "$@"
+ fi
if [ $? -eq 0 ]; then
exit_success