Last active
May 23, 2018 19:50
-
-
Save xabbu/88a17821ddccd4d65ee8ad631f726245 to your computer and use it in GitHub Desktop.
This file contains 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 | |
if [[ "$1" == *.desktop ]]; then | |
prog=`cat "$1" | grep -e ^Exec | head -n1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g'` | |
firejail $prog | |
else | |
filetype=`xdg-mime query filetype "$1"` | |
defaultapp=`xdg-mime query default "$filetype"` | |
if [ -f ~/.local/share/applications/"$defaultapp" ]; then | |
prog=`cat ~/.local/share/applications/"$defaultapp" | grep -e ^Exec | head -n1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g'` | |
else | |
prog=`cat /usr/share/applications/"$defaultapp" | grep -e ^Exec | head -n1 | sed 's/^Exec=//' | sed 's/%.//' | sed 's/^"//g' | sed 's/" *$//g'` | |
fi | |
firejail $prog "$1" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment