From 650dba86b9b74cdfaffeb321a4a2499048824af1 Mon Sep 17 00:00:00 2001 From: Adrian Malacoda Date: Mon, 15 Mar 2021 02:16:55 -0500 Subject: [PATCH] improve download-youtube script to not assume zenity or xfce4-terminal --- download-youtube | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/download-youtube b/download-youtube index 4809570..0a1e784 100755 --- a/download-youtube +++ b/download-youtube @@ -1,4 +1,14 @@ #!/bin/sh cd ~/Downloads -YTDL_WD=$(zenity --file-selection --directory --filename=.) -xfce4-terminal --default-working-directory $YTDL_WD --execute youtube-dl $@ +YTDL_WD="." + +if [ $(command -v zenity) ]; then + YTDL_WD=$(zenity --file-selection --directory --filename=.) +fi + +if [ $(command -v xfce4-terminal) ]; then + xfce4-terminal --default-working-directory "$YTDL_WD" --execute youtube-dl $@ +else + cd "$YTDL_WD" + youtube-dl $@ +fi