nix-community / dconf2nix

:feet: Convert dconf files (e.g. GNOME Shell) to Nix, as expected by Home Manager [maintainer=@jtojnar]
Apache License 2.0
229 stars 6 forks source link

Support almost arbitrary characters in dir names #101

Closed jtojnar closed 4 months ago

jtojnar commented 4 months ago

dconf itself places minimal restrictions on key paths. dconf_is_key and dconf_is_dir just stipulate the following:

So in theory, they can all contain special characters like []*#@. In practice, dconf dump will fail to print paths containing [ or ] due to limitations of GKeyFile enforced by g_key_file_is_group_name so those or control characters will not really appear in input of dconf2nix. But it can still contain all other kinds of characters including spaces at the start or end.

Since the spaces are now preserved as expected, we need to remove them from the test cases (not sure how they got there). Also clean up the duplicate dirs/groups.

Keys have slightly tighter restrictions introduced by g_key_file_is_key_name. Whitespace is only allowed in the middle of a key and = is not allowed at all. [ and ] are not allowed either, except at the end in a subkey suffix, which has further restrictions. But I doubt anyone will want special characters in keys so I am only extending it with an underscore.