Last active
January 4, 2016 18:59
-
-
Save coderofsalvation/8664647 to your computer and use it in GitHub Desktop.
attempt for universal way of opening a filetype with default application (regardless of windowmanager)
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/bash | |
| # attempt for universal way of opening a filetype with default application (regardless of windowmanager) | |
| # usage: open my.pdf (HINT: put this in your .bashrc: alias o='launch' ) | |
| # @param string (arguments) | |
| function launch(){ | |
| if which xdg-open &>/dev/null; | |
| then xdg-open "$@" | |
| elif which gnome-open &>/dev/null; | |
| then gnome-open "$@"; | |
| elif which kde-open &>/dev/null; | |
| then kde-open "$@"; | |
| elif which open &>/dev/null; | |
| then open "$@" | |
| fi | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment