summary refs log tree commit diff
path: root/bin/open
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2021-01-21 19:33:10 +0100
committerRobert Günzler <r@gnzler.io>2021-01-21 19:40:20 +0100
commit72c39240811f1def43fca71de51566d206f7728d (patch)
treea33aa1331fc55b587a243f64ef94d781df40a8ae /bin/open
parent0762801ed9627021e732cdeb225a737f44e3df42 (diff)
Update 2021-01-21T18:33:10Z
Diffstat (limited to 'bin/open')
-rwxr-xr-xbin/open32
1 files changed, 13 insertions, 19 deletions
diff --git a/bin/open b/bin/open
index 9a1eb3f..ba809bf 100755
--- a/bin/open
+++ b/bin/open
@@ -20,39 +20,33 @@ shift $((OPTIND-1))
 
 in="$1"
 
-mime=$(file --mime-type $in | awk -F': ' '{print $2}' )
-ext=$(basename $in | rev | cut -d'.' -f1 | rev)
+mime=$(file --mime-type "$in" | awk -F': ' '{print $2}' )
+ext=$(basename "$in" | rev | cut -d'.' -f1 | rev)
 opener=xdg-open
 
 fork() {
-    exec $@ 1>&2 2>/dev/null &
+    exec $@ >/dev/null 2>&1 &
 }
-
 term() {
     fork alacritty --title="$1" --command "$@"
 }
 
 case $mime in
-    inode/directory)    [ $termmode -eq 0 ] && vifm "$in" || fork nautilus -w "$in" ;;
-    # inode/file)         fork nautilus -w $in ;;
+    inode/directory)    [ $termmode -eq 0 ] && vifm "$in" ;;
+    inode/file)         [ $termmode -eq 0 ] && vifm "$in" ;;
 
-    image/*)            fork sxiv "$in" ;;
-    video/*)            fork mpv --force-widow=yes "$in" ;;
-    audio/*)            fork mpv --force-widow=yes "$in" ;;
+    image/*)            fork mvi "$in" ;;
+    video/*)            fork mpv --force-window=yes "$in" ;;
+    audio/*)            fork mpv --force-window=yes "$in" ;;
 
     application/pdf)    fork zathura "$in" ;;
-    application/vnd.ms-opentype|application/font-sfnt)
-                        fork gnome-font-viewer "$in" ;;
+    # application/vnd.ms-opentype|application/font-sfnt)
+                        # fork gnome-font-viewer "$in" ;;
 
     # now text...
-    text/*)
-        # echo $mime $ext
-        case $ext in
-            md|markdown) fork shiba "$(readlink -f "$in")" ;;
-            desktop) fork gtk-launch "$(basename "$in" | cut -d'.' -f1)" ;;
-            *)           fork term nvim "$in" ;;
-        esac
-        ;;
+    text/md|text/markdown)
+                        fork shiba "$(readlink -f "$in")" ;;
+    text/*)             fork term ${EDITOR} "$in" ;;
 
     # everything else...
     *) exec $opener "$in" ;;