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

Add support for hexadecimal and octal numbers #102

Closed jtojnar closed 4 months ago

jtojnar commented 4 months ago

I switched from read to our custom parsing because read expects the 0o prefix instead of C-style 0. We only handle integers for now, as read for Double does not support decimal numbers with 0x prefix and I did not want to implement decimals myself.

Additionally, add support for + sign.

Also merge negative.settings test file into dconf.settings since that one aggregates configuration keys from real dconf dumps. Instead create numbers.settings that tests all possible numeric values.

Currently unhandled cases:

zero-trailing=0.
zero-leading=.0
hex-float=0x10.1

GLib’s GVariant parses octal decimals a base 10. This is probably expected, as the docs only mention hex floats.

oct-float=010.1
oct-sci=010e10

GLib’s GVariant parses the following as a double, probably confusing it with scientific notation:

hex-neg-e=-0x1e