Linux: Allow case-insensitive filters and make that the default #158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On Linux (both GTK and Portal), file filters are case-sensitive. While Linux uses a case-sensitive filesystem by default and file filters may have been intentionally made case-sensitive, most users expect file filters to be case-insensitive. This was reported to be an issue for GTK3 (https://gitlab.gnome.org/GNOME/gtk/-/issues/3705), and in GTK4 a new API was added for explicitly case-insensitive filtering. Native File Dialog Extended uses GTK3 so we cannot use the new API, but the linked issue notes that we can do case-insensitive filtering in GTK3 by transforming something like
"pdf"
to"*.[Pp][Dd][Ff]"
. This is also the recommended way to implement case-insensitive filtering on xdg-desktop-portal (https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.FileChooser.html).This PR adds a new compile option named
NFD_LINUX_CASE_SENSITIVE_FILTER
, which is disabled by default (i.e. we get case-insensitive filtering).While this is in principle a breaking change, I think most users would regard case-sensitive filtering as a bug, and therefore this as a bugfix.
Fixes #157.