dot

packages and services management
Log | Files | Refs | README

commit 7f6e89c47d4b9425eae7c2bb086f6258a1589b51
parent 0dc1890bf54317d2b7442e8773041eeeca041a57
Author: Josuah Demangeon <mail@josuah.net>
Date:   Mon, 12 Feb 2018 03:16:18 +0100

[add] xdg-open use variable-defined paths rather than hardcoded

Diffstat:
Mbin/io | 1+
Mbin/xdg-open | 43++++++++++++++++++++++---------------------
2 files changed, 23 insertions(+), 21 deletions(-)

diff --git a/bin/io b/bin/io @@ -43,6 +43,7 @@ put sunglasses on (•_•) / ( •_•)>⌐■-■ / (⌐■_■) shrug ¯\_(ツ)_/¯ rose --{@ magic (∩`-´)⊃━☆゚.*・。゚ +:p :þ EOF ;; (m|mail) diff --git a/bin/xdg-open b/bin/xdg-open @@ -8,7 +8,6 @@ exec st -f terminus:pixelsize=16 -e "${0}" "${@}" printf '\033]0;%s\a' "${1}" #--- parse uri ----------------------------------------------------------------- - # scheme://[user[:pass]@]host[:port][/path] IFS=' ' read scheme user pass host port path << EOF $(printf %s "${1}" | awk '{ @@ -84,17 +83,18 @@ case "${scheme}" in (http|https) case "${host}" in (vimeo.com|*youtube.com|*youtu.be|*openload.co*) - mkdir -p "${HOME}/lib/http/video/${host}" - cd "${HOME}/lib/http/video/${host}" + mkdir -p "${LIB}/video/${host}" + cd "${LIB}/video/${host}" youtube-dl "${1}" - exec "${0}" "${HOME}/lib/http/video/${host}"/*${1##*[=/]}* + exec "${0}" "${LIB}/video/${host}"/*"${1##*[=/]}"* ;; (*bandcamp.com) - mkdir -p "${HOME}/lib/music/${host}" - cd "${HOME}/lib/music/${host}" + mkdir -p "${LIB}/music/${host}" + cd "${LIB}/music/${host}" exec youtube-dl "${1}" ;; esac + case "${path}" in (*.torrent) mkdir -p "${VAR}/torrent" @@ -102,29 +102,29 @@ case "${scheme}" in exec "${0}" "${VAR}/torrent/${path##*/}" ;; (*.jpg|*.JPG|*.jpeg|*.JPEG|*.png|*.PNG|*.gif) - mkdir -p "${HOME}/lib/http/image/${host}/" - curl -Lo "${HOME}/lib/http/image/${host}/${path##*/}" "${1}" - exec "${0}" "${HOME}/lib/http/image/${host}/${path##*/}" + mkdir -p "${LIB}/image/${host}/" + curl -Lo "${LIB}/image/${host}/${path##*/}" "${1}" + exec "${0}" "${LIB}/image/${host}/${path##*/}" ;; (*.opus|*.ogg|*.mp3|*.flac) - mkdir -p "${HOME}/lib/http/music/${host}" - curl -Lo "${HOME}/lib/http/music/${host}/${path##*/}" "${1}" - exec "${0}" "${HOME}/lib/http/music/${host}/${path##*/}" + mkdir -p "${LIB}/music/${host}" + curl -Lo "${LIB}/music/${host}/${path##*/}" "${1}" + exec "${0}" "${LIB}/music/${host}/${path##*/}" ;; (*.webm|*.mp4|*.mkv|*.ogv|*.avi) - mkdir -p "${HOME}/lib/http/video/${host}" - curl -Lo "${HOME}/lib/http/video/${host}/${path##*/}" "${1}" - exec "${0}" "${HOME}/lib/http/video/${host}/${path##*/}" + mkdir -p "${LIB}/video/${host}" + curl -Lo "${LIB}/video/${host}/${path##*/}" "${1}" + exec "${0}" "${LIB}/video/${host}/${path##*/}" ;; (*.pdf|*.ps) - mkdir -p "${HOME}/lib/http/doc" - curl -Lo "${HOME}/lib/http/doc/${path##*/}" "${1}" - exec "${0}" "${HOME}/lib/http/doc/${path##*/}" + mkdir -p "${LIB}/doc/${host}" + curl -Lo "${LIB}/doc/${host}"/${path##*/}" "${1}" + exec "${0}" "${LIB}/doc/${host}"/${path##*/}" ;; (*.txt) - mkdir -p "${HOME}/lib/http/text/${host}" - curl -Lo "${HOME}/lib/http/text/${host}/${path##*/}" "${1}" - exec "${0}" "${HOME}/lib/http/text/${host}/${path##*/}" + mkdir -p "${LIB}/text/${host}" + curl -Lo "${LIB}/text/${host}/${path##*/}" "${1}" + exec "${0}" "${LIB}/text/${host}/${path##*/}" ;; (*.gz|*.bz2|*.xz|*.tgz|*.tgz|*.tbz2|*.txz) mkdir -p "${HOME}/tmp" @@ -135,6 +135,7 @@ case "${scheme}" in exec firefox "${1}" ;; esac + ;; (irc) [ "${port}" = . ] && port='6667'