diff options
author | Yigit Sever | 2021-11-07 23:42:15 +0300 |
---|---|---|
committer | Yigit Sever | 2021-11-07 23:42:15 +0300 |
commit | 9fa9973c2d2f91cef7bdd26cb52064c13f4d682e (patch) | |
tree | 13aa64b09bc91e16f3dd3217bf3d647559af2cf9 /.local/bin/openfile | |
parent | 9382166b5522a5d9e2d62e93e702b4d0886cedb4 (diff) | |
parent | fcb2237c01bcd2b7982bb844cea4cf9447f20d03 (diff) | |
download | dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.gz dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.tar.bz2 dotfiles-9fa9973c2d2f91cef7bdd26cb52064c13f4d682e.zip |
Merge remote-tracking branch 'origin/main'
Diffstat (limited to '.local/bin/openfile')
-rwxr-xr-x | .local/bin/openfile | 4 |
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. |
4 | tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files" | 4 | tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt/files" |
5 | file="$tempdir/$(basename "$1")" | 5 | file="$tempdir/$(basename "$1")" |
6 | [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" | 6 | [ "$(uname)" = "Darwin" ] && opener="open" || opener="setsid -f xdg-open" |
7 | mkdir -p "$tempdir" | 7 | mkdir -p "$tempdir" |
8 | cp -f "$1" "$file" | 8 | cp -f "$1" "$file" |
9 | $opener "$file" >/dev/null 2>&1 | 9 | $opener "$file" > /dev/null 2>&1 |
10 | find "${tempdir:?}" -mtime +1 -type f -delete | 10 | find "${tempdir:?}" -mtime +1 -type f -delete |