use conf terminal first, add mimeopen
This commit is contained in:
parent
4587a6999b
commit
f317ec831e
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
set -euf
|
||||
|
||||
# wrapper to use mimix instead of the perl mimeopen thing
|
||||
# was made for wyeb but I then realized you can change it
|
||||
# so... don't think this is all that useful anymore
|
||||
|
||||
# strip args
|
||||
for w; do
|
||||
case $w in
|
||||
(--) shift; break ;;
|
||||
(-*) shift ;;
|
||||
(*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -n "${1:-}" ]; then
|
||||
xdg-open "$1"
|
||||
else
|
||||
echo "no argument provided!" >&2
|
||||
fi
|
7
xdg-open
7
xdg-open
|
@ -5,7 +5,7 @@ BN="${0##*/}"
|
|||
|
||||
### HELPER FUNCTIONS
|
||||
|
||||
exists() { type "$@" >/dev/null 2>&1; }
|
||||
exists() { type "$1" >/dev/null 2>&1; }
|
||||
errecho() { echo "$*" >&2 ; }
|
||||
die() {
|
||||
errecho "$*"
|
||||
|
@ -106,7 +106,8 @@ done
|
|||
[ -z "${CONFIG:-}" ] && usage && die 'Error: no config file found!'
|
||||
|
||||
# special variables (TERMINAL, MENU)
|
||||
TERMINAL="${TERMINAL:-$(config_search TERMINAL)}"
|
||||
conf_term="$(config_search TERMINAL)"
|
||||
[ -n "$conf_term" ] && TERMINAL="$conf_term"
|
||||
! exists "$TERMINAL" && die 'Error: $TERMINAL is not executable! Try setting it in the config.'
|
||||
export TERMINAL
|
||||
MENU="$(config_search MENU)" || MENU=dmenu
|
||||
|
@ -164,7 +165,7 @@ done
|
|||
|
||||
# ask
|
||||
if exists "$MENU"; then
|
||||
cmd="$(IFS=':'; set -- $PATH; find "$@" \( -type f -o -type l \) | awk -F '/' '{print $NF}' | sort | uniq | eval "$MENU"' -p "How open ${ARG##*/}?"')"
|
||||
cmd="$(IFS=':'; set -- $PATH; find "$@" \( -type f -o -type l \) | awk -F '/' '{print $NF}' | sort | uniq | eval "$MENU"' -p "How open ${ARG}?"')"
|
||||
if [ -n "$cmd" ]; then
|
||||
fork_run "$cmd $ARG"
|
||||
else die 'Blank command from menu, exiting...'
|
||||
|
|
Loading…
Reference in New Issue