2022-05-31 23:01:54 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
# Use xdg-mime with a file's mime type
|
2022-08-28 20:36:34 +00:00
|
|
|
# ARGS: file [application]
|
2022-05-31 23:01:54 +00:00
|
|
|
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
2022-06-27 11:03:11 +00:00
|
|
|
if test $# -gt 1; then
|
2023-08-07 15:45:59 +00:00
|
|
|
desktop="$(find /usr/share/applications $XDG_DATA_HOME/applications | fzf -0 -1 --query="$2")" &&
|
2022-05-31 23:01:54 +00:00
|
|
|
xdg-mime default "$desktop" "$(xdg-mime query filetype "$1")" &&
|
|
|
|
echo -n "Updated to: " &&
|
|
|
|
xdg-mime query default "$(xdg-mime query filetype "$1")"
|
2022-06-27 11:03:11 +00:00
|
|
|
fi
|
2022-05-31 23:01:54 +00:00
|
|
|
# || echo "Cannot find application $2 in /usr/share/applications!"
|