From e1d03e2fe607c5e1643be186c4ce4031ae1004e0 Mon Sep 17 00:00:00 2001 From: ensa Date: Mon, 29 Jun 2020 19:45:18 -0700 Subject: bin/fl added, lh reworked, opener renamed, data/applications removed bin/ fl: finds links, sends list to dmenu so user can choose one to copy to the clipboard lh: replaced sed invocations with lstrip() invocations redir handling changed to function findredir(), which loops over curl's output, only outputting location urls changed case statement to look for .extensions instead of the end of the url local files are now sent to bin/op for processing mpv given --no-terminal flag for no output instead of redirection shit similarly, sxiv is given -q (and -p to not cache) op: formerly opener changed error message to be more portable prompt: removed help text pw: doesn't need to be in a variable rsschk: redesigned after an eternity uses a modified re_urls, looking for .rss and .xml urls generally smaller shenv: uses ${var:=val} specifies /bin/sh xbg: removed .fehbg handling config/ aliasrc: e and v set TERM to xterm-256color, otherwise vis freaks out cwmrc: urgencyborder color added (with color1) ungroupborder changed to color5 program list removed 4-Return set to $TERMINAL 4S-r rebound to restart 4-X set to $LOCK prompt binds fixed dunst/dunstrc: icons disabled ksh/functions/l.: changed to ksh function for non-current directories, changes there in a subshell and uses that current directory, sending an error message if the directory doesn't exist lf/lfrc: cmd open removed cmd ttmsh fixed shrc: removed ALTSCR added OPENER=op IRC_SERVERS_FILE removed TODO changed to correct path GOCACHE and GOBIN added, self-explanatory data/ applications/: removed mailcap: changed to relegate most of its functionality to bin/op --- bin/op | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100755 bin/op (limited to 'bin/op') diff --git a/bin/op b/bin/op new file mode 100755 index 0000000..688912b --- /dev/null +++ b/bin/op @@ -0,0 +1,33 @@ +#!/bin/sh +# op: file OPener +# takes one path as its argument, launches the appropriate program for it +if ! [ -f "$1" ]; then + printf 'file %s does not exist!\n' "$1" >/dev/stderr + return 1 +fi +FILEPATH="$1" +FILEMIME="$(file -ib "$FILEPATH")" +echo() { + printf '%s\n' "$*" +} +case "$FILEMIME" in + #ebooks + application/epub*|application/pdf|application/postscript|image/vnd.djvu) + ${READER:-zathura} "$FILEPATH">/dev/null 2>&1 & ;; + #videos + video/*) + mpv --quiet "$FILEPATH" >/dev/null 2>&1 & ;; + #images + image/*) + sxiv -a "$FILEPATH">/dev/null 2>&1 & ;; + #audio + audio/*) + mpv "$FILEPATH" >/dev/null 2>&1 & ;; + #text + text/*) + ${EDITOR:-vi} "$FILEPATH">/dev/null 2>&1 & ;; + #catchall + *) + echo "file $(basename "$FILEPATH") could not be opened. its type is $FILEMIME, go tell ensa that $(basename $0) didn't work" >/dev/stderr + return 1 ;; +esac -- cgit 1.4.1-2-gfad0