nix-config/overlays/xdg-open-spawn-terminal.diff
Greg Burd f3fd89af54
A fork of Misterio77 and his standard template.
Many thangs to the hard work and generous availability of:
git@github.com:Misterio77/nix-config.git
2023-09-15 10:53:38 -04:00

21 lines
674 B
Diff

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