diff options
author | Saumit Dinesan <justsaumit@protonmail.com> | 2023-12-15 15:11:12 +0530 |
---|---|---|
committer | Saumit Dinesan <justsaumit@protonmail.com> | 2023-12-15 15:11:12 +0530 |
commit | b0b955d8517b349132f6eb7bdb5a85ae9199f67e (patch) | |
tree | bf0ef04afd0e907c26b001391c3aeecd7335d78a /.scripts | |
parent | ded2e2c86a19a5376734de9521c9dad808293440 (diff) |
.scripts: 4chgettofi - notify if folder already exists and dont allow empty vals for folder
Diffstat (limited to '.scripts')
-rwxr-xr-x | .scripts/4chgettofi | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/.scripts/4chgettofi b/.scripts/4chgettofi index 61fb2b0..ee88553 100755 --- a/.scripts/4chgettofi +++ b/.scripts/4chgettofi @@ -7,8 +7,16 @@ done [[ $option == "w" ]] && parentdir="$rootpapesdir/w" && nel="nel" || parentdir="$rootpapesdir/wg" -while [[ -d "$parentdir/$dir" ]]; do +while true; do dir=$(tofi --prompt-text "Enter folder name: " --require-match=false </dev/null) + + if [[ -z "$dir" ]]; then + notify-send "Folder name cannot be empty." "Please enter a valid folder name." + elif [[ -d "$parentdir/$dir" ]]; then + notify-send "Folder '$dir' already exists." "Please choose a different folder name." + else + break + fi done endir="$parentdir/$dir" mkdir -p "$endir" @@ -19,5 +27,6 @@ threadopt=$(echo -e "Yes\nNo" | tofi --prompt-text "Do you have the thread link wget -P "$endir" -nd -r -l 1 -H -D i.4cdn.org,is2.4chan.org -A png,jpg,jpeg -R '*s.*' "https://boards.4chan$nel.org/$option/thread/$thread" +notify-send "Folder '$dir' has completed downloading" "You may view the wallpapers :)" viewopt=$(echo -e "Yes\nNo" | tofi --prompt-text "Do you wish to view the downloaded papes now?") [[ $viewopt == Yes ]] && imv -fr $endir |