]> arthur.barton.de Git - ax-zsh.git/commitdiff
std_functions: Make open_command() work on Linux without X11 running
authorAlexander Barton <alex@barton.de>
Fri, 4 Feb 2022 22:06:56 +0000 (23:06 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 4 Feb 2022 22:06:56 +0000 (23:06 +0100)
default_plugins/std_functions/std_functions.zshrc

index e20122ac80520675f0f1dfeb2c7e53de4349f055..373ac11b30b278ab2aa553b629f315471279bac8 100644 (file)
@@ -10,7 +10,12 @@ function open_command() {
                        cygstart "$@" || return 1
                        ;;
                linux*)
-                       nohup xdg-open "$@" &>/dev/null || return 1
+                       if [[ -n "$DISPLAY" ]]; then
+                               # X11
+                               nohup xdg-open "$@" &>/dev/null || return 1
+                       else
+                               xdg-open "$@" || return 1
+                       fi
                        ;;
                *)
                        return 2