Skip to content

Instantly share code, notes, and snippets.

@ar4s-eth
Forked from salman-abedin/launch.sh
Created January 21, 2023 18:24
Show Gist options
  • Save ar4s-eth/f0604c6c9cf4e6fd183c5079e5c5c5eb to your computer and use it in GitHub Desktop.
Save ar4s-eth/f0604c6c9cf4e6fd183c5079e5c5c5eb to your computer and use it in GitHub Desktop.
XDG Alternative
#!/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