dmenu-scripts/dmenu-dl-manager

35 lines
868 B
Plaintext
Raw Normal View History

2022-04-05 16:59:13 +02:00
#!/bin/sh
# script to download a file from that has it's link in clipboard
2022-07-17 11:03:13 +02:00
source $HOME/.config/dmenu/config
2022-04-05 16:59:13 +02:00
# a functions that list all everything in a directory and gives back the chosen one
choice (){
2022-07-17 11:03:13 +02:00
(ls -1 -a | $DMENU -l 30 -p "Choose where to download")
2022-04-05 16:59:13 +02:00
}
# first choice
dir=$(choice)
# while the coice is not a file do what is inside
while [ "$dir" != "Here" ]
do
# first we check if it is a single dot and if it we download there
[ "$dir" = "." ] && break
# if dir is empty we exit
[ -z "$dir" ] && exit
# if all checks are negative we change into the directory
cd "$dir"
# doing a new check
dir=$(choice)
done
# download the file
quick-notify "Dmenu downloader" "Started downloading a file"
aria2c -j 16 -s 16 -x 16 -k 5M --file-allocation=none "$(xclip -o)"
quick-notify "Dmenu downloader" "Downloading finished"