diff options
| author | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-06-10 18:58:52 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano.tronto@gmail.com> | 2021-06-10 18:58:52 +0200 |
| commit | b98e05ba63f2e108df634b4d9f9e5530769c6b80 (patch) | |
| tree | a1d3a7f20e826d264f2a6b2141b7b1bfa7debb6f /open-url | |
| parent | ed61c5f085cebb86d3d3a34ce01ec22069c1fc70 (diff) | |
| download | scripts-b98e05ba63f2e108df634b4d9f9e5530769c6b80.tar.gz scripts-b98e05ba63f2e108df634b4d9f9e5530769c6b80.zip | |
Added scripts and readme
Diffstat (limited to 'open-url')
| -rwxr-xr-x | open-url | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/open-url b/open-url new file mode 100755 index 0000000..700589e --- /dev/null +++ b/open-url | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # Open link in preferred application | ||
| 4 | # Requires: mail-compose, xsel (optional) | ||
| 5 | |||
| 6 | browser=${BROWSER:-firefox} | ||
| 7 | imageviewer=${IMAGEVIEWER:-imv} | ||
| 8 | |||
| 9 | [ -z "$1" ] && exit 0 | ||
| 10 | |||
| 11 | # Optional: copy url to clipboard | ||
| 12 | echo "$@" | xsel -ib | ||
| 13 | |||
| 14 | case "$@" in | ||
| 15 | mailto:*) | ||
| 16 | mail-compose $@ | ||
| 17 | ;; | ||
| 18 | *.jpg | *.jpeg | *.png) | ||
| 19 | spawn $imageviewer "$@" | ||
| 20 | ;; | ||
| 21 | *.gif) | ||
| 22 | spawn $imageviewer "$@" | ||
| 23 | ;; | ||
| 24 | # https://www.youtube.com/watch\?v=*) | ||
| 25 | # spawn $VIDEOPLAYER "$1" | ||
| 26 | # ;; | ||
| 27 | *) | ||
| 28 | spawn $browser "$@" | ||
| 29 | ;; | ||
| 30 | esac | ||
| 31 | |||
