dots

git clone git://mattcarlson.org/repos/dots.git
Log | Files | Refs

commit 635fe7113405700061a5b10dd1b9355a7f3999da
parent d417bc7dc2a0fe4d3a476924c50ce6c99567955f
Author: Matthew Carlson <matt@mcarlson.xyz>
Date:   Wed, 28 Jul 2021 20:31:04 -0400

using opener script instead of xdg-open

Diffstat:
M.config/sh/aliasrc | 2+-
M.config/sh/functionrc | 2+-
M.config/sh/profile | 2+-
M.local/bin/open.sh | 21++++++++++++---------
4 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/.config/sh/aliasrc b/.config/sh/aliasrc @@ -24,7 +24,7 @@ alias \ alias \ free='free -m' \ ft='grep -nwIR' \ - o='xdg-open' + o='open.sh' # startx [ -f "${XINITRC}" ] && alias startx='startx ${XINITRC}' diff --git a/.config/sh/functionrc b/.config/sh/functionrc @@ -3,6 +3,6 @@ # functionrc f() { fff "${@}" && cd "$(cat "${XDG_CACHE_HOME:-${HOME}/.cache}/fff/.fff_d")" || exit ; } -s() { du -a "${HOME}" | awk '{ $1="" } { gsub("^ ", "", $0); print "\"" $0 "\"" }' | fzf | xargs -or xdg-open ; } +s() { du -a "${HOME}" | awk '{ $1="" } { gsub("^ ", "", $0); print "\"" $0 "\"" }' | fzf | tr -d '[="=]' | open.sh ; } rands() { </dev/urandom tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' | head -c "${1}" ; printf '%s\n'; } rp() { for f in *; do mv "${f}" "$(printf '%s\n' "${f}" | sed "s/${1}/${2}/g")"; done ; } diff --git a/.config/sh/profile b/.config/sh/profile @@ -82,7 +82,7 @@ export FFF_COL4=2 export FFF_COL5=0 export FFF_HIDDEN=1 export FFF_LS_COLORS=1 -export FFF_OPENER="xdg-open" +export FFF_OPENER="${HOME}/.local/bin/open.sh" export FFF_STAT_CMD="stat" # pash diff --git a/.local/bin/open.sh b/.local/bin/open.sh @@ -2,7 +2,11 @@ # # open -case "${1}" in +if [ ${#} -eq 0 ]; then opt="$(tee -i)" +else opt="${*}" +fi + +case "${opt}" in # audio *.flac \ | *.m4a \ @@ -10,26 +14,25 @@ case "${1}" in | *.ogg \ | *.opus \ | *.wav) - "${MEDIA_PLAYER}" --no-video "${1}" + "${MEDIA_PLAYER}" --no-video "${opt}" ;; # document *.djvu \ | *.epub \ | *.pdf) - "${READER}" "${1}" + "${READER}" "${opt}" ;; # gif *.gif) - "${MEDIA_PLAYER}" --loop "${1}" + "${MEDIA_PLAYER}" --loop "${opt}" ;; # image *.bmp \ | *.dib \ | *.ff \ - | *.gif \ | *.ico \ | *.iff \ | *.jfi \ @@ -46,7 +49,7 @@ case "${1}" in | *.tiff \ | *.webp \ | *.xpm) - "${IMG_VIEWER}" "${1}" + "${IMG_VIEWER}" "${opt}" ;; # video @@ -54,7 +57,7 @@ case "${1}" in | *.mkv \ | *.mp4 \ | *.webm) - "${MEDIA_PLAYER}" "${1}" + "${MEDIA_PLAYER}" "${opt}" ;; # web/vector @@ -63,11 +66,11 @@ case "${1}" in | *.php \ | *.svg \ | *.xhtml) - "${BROWSER}" "${1}" + "${BROWSER}" "${opt}" ;; # everything else *) - "${EDITOR:-vi}" "${1}" + exec "${EDITOR:-vi}" "${opt}" </dev/tty ;; esac