Last active
August 1, 2022 18:50
-
-
Save williamd1k0/aa267c777ff8f18535e663ee336cde4b to your computer and use it in GitHub Desktop.
Simple shell script to download a file using zenity as GUI (useful for file manager integration).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zenity | |
xclip | |
aria2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<action> | |
<icon>downline</icon> | |
<name>Download File...</name> | |
<unique-id>1633819767686351-2</unique-id> | |
<command>zenity-dl</command> | |
<description>Download a file to the current directory</description> | |
<patterns>*</patterns> | |
<directories/> | |
</action> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/sh | |
URL_CB="$(xclip -o -sel clip)" | |
if [ -n "$URL_CB" ]; then | |
if ! echo "$URL_CB" | rg -q '^https?://'; then | |
URL_CB='' | |
fi | |
fi | |
URL=$(zenity --entry --title="Download File" --text="Enter an URL to download:" --entry-text="$URL_CB" --ok-label="Download" --width 400) | |
if [ -n "$URL" ]; then | |
aria2c "$URL" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment