New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update xdg-mime helper #4333
Update xdg-mime helper #4333
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
function __fish_print_xdg_applications_directories --description 'Print directories where desktop files are stored' | ||
set -l search_path ~/.local/share/applications /usr/share/applications | ||
if test -d /usr/local/share/applications | ||
set search_path $search_path /usr/local/share/applications | ||
end | ||
|
||
for p in $search_path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, the fishy way to do this is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I now use the loop to check that the directories exist. So I kept it. |
||
echo $p | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
function __fish_print_xdg_mimeapps --description 'Print xdg mime applications' | ||
find ~/.local/share/applications/ /usr/share/applications/ -name \*.desktop \( -type f -or -type l \) -printf '%P\n' | sort -u | ||
find (__fish_print_xdg_applications_directories) -name \*.desktop \( -type f -or -type l \) -printf '%P\n' | sort -u | ||
|
||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
function __fish_print_xdg_mimetypes --description 'Print XDG mime types' | ||
cat ~/.local/share/applications/mimeinfo.cache /usr/share/applications/mimeinfo.cache ^/dev/null | string match -v '[MIME Cache]' | string replace = \t | ||
cat {__fish_print_xdg_applications_directories}/mimeinfo.cache ^/dev/null | string match -v '[MIME Cache]' | string replace = \t | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you test this? Because it won't work now 😄 "Braces" (sometimes called "curly brackets") are the curly variant. Parentheses are the round variant. You need the parentheses to indicate a subcommand should be run and its output captured. So you removed the wrong pair of punctuation marks. I'll fix it when I merge it. Just a reminder to always double-check that a seemingly trivial change doesn't introduce a problem. |
||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this directory need an explicit check for existence but not the other two? For example, my ubuntu system has /usr/share/applications but does not have a ~/.local/share/applications directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True this should probably be done for all paths.
__fish_print_xdg_mimetypes
redirects finds stderr to/dev/null
but__fish_print_xdg_mimeapps
doesn't. This could course error massages in the output.