sh: Add default open script
Simple wrapper for xdg-open functionality. Simply refers to xdg-open except if there exists mimeo on the system which it will refer to instead. So, a simple preference modificator for mimeo over xdg-open since that is my preference too. Also gave it a short name so I can do open whenever I want and don't have to tax my left hand with tying xdg.
This commit is contained in:
parent
dfaed8c9dd
commit
4cc03a611a
8 changed files with 34 additions and 28 deletions
|
@ -4,14 +4,14 @@ taskbin = task
|
|||
path_ext = /usr/share/taskopen/scripts
|
||||
|
||||
[Actions]
|
||||
note_custom_ext.regex = "^Note\\.(.*)"
|
||||
note_custom_ext.regex = "^Note\\.?(.*)?"
|
||||
note_custom_ext.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.$LAST_MATCH"
|
||||
|
||||
notes.regex = "^Note"
|
||||
notes.command = "$EDITOR ${XDG_DATA_HOME:-$HOME/.local/share}/task/notes/$UUID.md"
|
||||
|
||||
links.regex = "^https?://"
|
||||
links.command = "xdg-open $FILE"
|
||||
links.command = "open $FILE"
|
||||
|
||||
mail.regex = "^<.*@.*>$"
|
||||
mail.command = "notmuch show mid:${FILE:1:-1}"
|
||||
|
|
|
@ -1 +1 @@
|
|||
COMMAND xdg-open
|
||||
COMMAND open
|
||||
|
|
|
@ -93,9 +93,9 @@ if [ "${#entries[@]}" -eq 0 ]; then
|
|||
die "Download directory »${DOWNLOAD_DIR}« empty"
|
||||
fi
|
||||
|
||||
line=$(printf '%s\n' "${entries[@]}" \
|
||||
| crop-first-column \
|
||||
| $ROFI_CMD "${ROFI_ARGS[@]}") || true
|
||||
line=$(printf '%s\n' "${entries[@]}" |
|
||||
crop-first-column |
|
||||
$ROFI_CMD "${ROFI_ARGS[@]}") || true
|
||||
if [ -z "$line" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
@ -111,4 +111,8 @@ fi
|
|||
|
||||
msg info "Opening »$line« (of type $filetype) with ${application%.desktop}"
|
||||
|
||||
xdg-open "$path" &
|
||||
if type open >/dev/null 2>&1; then
|
||||
open "$path" &
|
||||
else
|
||||
xdg-open "$path" &
|
||||
fi
|
||||
|
|
|
@ -57,31 +57,15 @@ alias myip="curl -s icanhazip.com"
|
|||
if exist fzf; then
|
||||
# Display fuzzy-searchable history
|
||||
alias fzfhistory="history -l -E -D 0 | fzf --tac --height 20"
|
||||
fzfman() {
|
||||
fzman() {
|
||||
man "$(apropos --long "$1" | fzf | awk '{print $2, $1}' | tr -d '()')"
|
||||
}
|
||||
|
||||
# Fuzzy search packages to install
|
||||
if exist yay; then
|
||||
fzf_pkg_tool=yay
|
||||
elif exist paru; then
|
||||
fzf_pkg_tool=paru
|
||||
elif exist pacman; then
|
||||
fzf_pkg_tool=pacman
|
||||
fi
|
||||
# shellcheck disable=2139 # we *want* this to be done at shell startup instead of dynamically
|
||||
if [ -n "$fzf_pkg_tool" ]; then
|
||||
alias fzfyay="$fzf_pkg_tool -Slq | fzf -m --preview '$fzf_pkg_tool -Si {1}' | xargs -ro $fzf_pkg_tool -S"
|
||||
# Fuzzy uninstall packages
|
||||
alias fzfyayrns="$fzf_pkg_tool -Qeq | fzf -m --preview '$fzf_pkg_tool -Qi {1}' | xargs -ro $fzf_pkg_tool -Rns"
|
||||
fi
|
||||
unset fzf_pkg_tool
|
||||
|
||||
# ripgrep-all to fzf search through any documents
|
||||
if exist rga; then
|
||||
fzfrga() {
|
||||
fzrga() {
|
||||
RG_PREFIX="rga --files-with-matches"
|
||||
xdg-open "$(
|
||||
open "$(
|
||||
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
|
||||
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
|
||||
--phony -q "$1" \
|
||||
|
@ -90,6 +74,13 @@ if exist fzf; then
|
|||
)"
|
||||
}
|
||||
fi
|
||||
|
||||
# quickly fzy search a sqlite database result
|
||||
if exist sqlite3; then
|
||||
fzql() {
|
||||
sqlite3 -header "$1" "$2" | fzf --header-lines=1 --layout=reverse --multi --prompt='fzql> '
|
||||
}
|
||||
fi
|
||||
fi
|
||||
|
||||
# vifm
|
||||
|
|
8
sh/.local/bin/open
Executable file
8
sh/.local/bin/open
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env sh
|
||||
# file opener using your preferred applications
|
||||
|
||||
if exist mimeo; then
|
||||
mimeo "$1"
|
||||
elif exist xdg-open; then
|
||||
xdg-open "$1"
|
||||
fi
|
|
@ -576,6 +576,9 @@ fileviewer *.md
|
|||
" use custom viewer script for rest
|
||||
fileviewer * vifm-default-viewer %c
|
||||
|
||||
" use our own custom opener
|
||||
filetype * open
|
||||
|
||||
" Syntax highlighting in preview
|
||||
"
|
||||
" Explicitly set highlight type for some extensions
|
||||
|
|
|
@ -12,7 +12,7 @@ docsdir = ~/documents/library/doc
|
|||
doc_add = copy
|
||||
|
||||
# the command to use when opening document files
|
||||
open_cmd = xdg-open
|
||||
open_cmd = open
|
||||
|
||||
# which editor to use when editing bibtex files.
|
||||
# if using a graphical editor, use the --wait or --block option, i.e.:
|
||||
|
|
|
@ -26,4 +26,4 @@ key=$(echo "$choice" | sed -E 's/.*\((\w+)\)$/\1/')
|
|||
library="$(dirname "$(realpath "$BIBFILE")")/pdf"
|
||||
|
||||
# find and open the key-associated pdf file
|
||||
${FILEREADER:-xdg-open} "$(find "$library" -type f -name "$key *.pdf")"
|
||||
${FILEREADER:-open} "$(find "$library" -type f -name "$key *.pdf")"
|
||||
|
|
Loading…
Reference in a new issue