summaryrefslogtreecommitdiffstats
path: root/.local/bin/openfile
diff options
context:
space:
mode:
authorYigit Sever2021-11-04 12:25:04 +0300
committerYigit Sever2021-11-04 12:25:04 +0300
commita0bb023d782dd2d8703670d560b5ccd8d25d640e (patch)
tree1c11a649e2201e1458c4011894086f49da5ded15 /.local/bin/openfile
parent93cdb13eada4e803fb4db71fb581d9e4a03d2119 (diff)
downloaddotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.tar.gz
dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.tar.bz2
dotfiles-a0bb023d782dd2d8703670d560b5ccd8d25d640e.zip
bins: shfmt, weasel suite, spark
Diffstat (limited to '.local/bin/openfile')
-rwxr-xr-x.local/bin/openfile4
1 files changed, 2 insertions, 2 deletions
diff --git a/.local/bin/openfile b/.local/bin/openfile
index cf3c6c3..742b9c0 100755
--- a/.local/bin/openfile
+++ b/.local/bin/openfile
@@ -1,10 +1,10 @@
1#!/bin/sh 1#!/bin/sh
2 2
3# Helps open a file with xdg-open from mutt in a external program without weird side effects. 3# Helps open a file with xdg-open from mutt in a external program without weird side effects.
4tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" 4tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt/files"
5file="$tempdir/$(basename "$1")" 5file="$tempdir/$(basename "$1")"
6[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" 6[ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open"
7mkdir -p "$tempdir" 7mkdir -p "$tempdir"
8cp -f "$1" "$file" 8cp -f "$1" "$file"
9$opener "$file" >/dev/null 2>&1 9$opener "$file" > /dev/null 2>&1
10find "${tempdir:?}" -mtime +1 -type f -delete 10find "${tempdir:?}" -mtime +1 -type f -delete