Last active
September 7, 2023 12:12
-
-
Save salman-abedin/6f52c52e465d89d489f9ea8d891c7332 to your computer and use it in GitHub Desktop.
XDG Alternative
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Launches files based on their mimetypes | |
# Usage: launch [FILE...] | |
# Dependencies: file | |
case $(file --mime-type "$@" -bL) in | |
# Check for the mimetype of your file (This is POSIX regex) | |
video/* | audio/* | image/gif) | |
# Launch using your favorite application | |
devour mpv "$@" | |
;; | |
# So on and so forth... | |
application/pdf | application/postscript) | |
devour zathura "$@" | |
;; | |
*) exit 1 ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment