Generating all xdg-mime commands: Difference between revisions
Jump to navigation
Jump to search
Created page with "This generates the xdg-mime commands for each .desktop files and the mimetypes they contain:<pre> find /usr/share/applications ~/.local/share/applications -iname '*.desktop' -..." |
No edit summary |
||
| Line 1: | Line 1: | ||
This generates the xdg-mime commands for each .desktop files and the mimetypes they contain:<pre> | This generates the xdg-mime commands for each .desktop files and the mimetypes they contain:<pre> | ||
find /usr/share/applications ~/.local/share/applications -iname '*.desktop' -print0 | while IFS= read -r -d $'\0' d; do | find /usr/share/applications ~/.local/share/applications \ | ||
-iname '*.desktop' -print0 | while IFS= read -r -d $'\0' d; do | |||
for m in $(grep MimeType "$d" | cut -d= -f2 | tr ";" " "); do | for m in $(grep MimeType "$d" | cut -d= -f2 | tr ";" " "); do | ||
echo xdg-mime default "'$d'" "'$m'" | echo xdg-mime default "'$d'" "'$m'" | ||
Revision as of 18:04, 29 April 2018
This generates the xdg-mime commands for each .desktop files and the mimetypes they contain:
find /usr/share/applications ~/.local/share/applications \
-iname '*.desktop' -print0 | while IFS= read -r -d $'\0' d; do
for m in $(grep MimeType "$d" | cut -d= -f2 | tr ";" " "); do
echo xdg-mime default "'$d'" "'$m'"
done
done
Suggested on https://unix.stackexchange.com/a/361705