Generating all xdg-mime commands: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 10: | Line 10: | ||
Suggested on https://unix.stackexchange.com/a/361705 | Suggested on https://unix.stackexchange.com/a/361705 | ||
For example to make <pre>geeqie | For example to make | ||
* geeqie | |||
* mpv | |||
* onlyoffice-desktopeditors | |||
* qutebrowser | |||
* vifm | |||
* zathura | |||
preferred applications, run<pre> | |||
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 | grep "geeqie\|mpv\|onlyoffice-desktopeditors\|qutebrowser\|vifm\|zathura" \ | |||
| grep -v "zathura-pdf-poppler" | |||
</pre> | |||
[[Category: Linux]] | [[Category: Linux]] | ||
Revision as of 21:45, 3 September 2020
This generates the xdg-mime commands for each .desktop files and all 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
For example to make
- geeqie
- mpv
- onlyoffice-desktopeditors
- qutebrowser
- vifm
- zathura
preferred applications, run
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 | grep "geeqie\|mpv\|onlyoffice-desktopeditors\|qutebrowser\|vifm\|zathura" \
| grep -v "zathura-pdf-poppler"