Skip to content

Conversation

bplaat
Copy link
Member

@bplaat bplaat commented Aug 31, 2025

As discussed in #26164 to have better multiple user desktop support we have to remove all prefilled config files from anon. But it is a nice feature to view all the available options in a text file and to edit them directly. But currently default config items are not synced to disk, because of the fallback value in code.

This pr update LibConfig to always write back reads with defaults when the keys don't exist yet. This results in that the complete default config from code is written back to the disk to be viewed and edited. I've changed the ipc interface a bit to suppress notifications of those writes to prevent a read write infinite loop.

I also found that DynamicWidgetContainer used a visual text string as config key which resulted in config keys with spaces so I now filter them out.

CC @spholz

Copy link
Member

@spholz spholz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The LibConfig change seems nice. I'm not really knowledgeable IPC and GUI stuff though, so I'd grateful if someone else could perhaps also take a look at this.

Comment on lines +16 to +19
write_string_value(ByteString domain, ByteString group, ByteString key, ByteString value, bool notify) => ()
write_i32_value(ByteString domain, ByteString group, ByteString key, i32 value, bool notify) => ()
write_u32_value(ByteString domain, ByteString group, ByteString key, u32 value, bool notify) => ()
write_bool_value(ByteString domain, ByteString group, ByteString key, bool value, bool notify) => ()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally prefer enum classes over bools as function parameters if callers are likely to pass constants (see https://github.com/SerenityOS/serenity/blob/master/Documentation/CodingStyle.md). Though I don't know if this is possible or clean to do with IPC.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible, but it results in a lot of extra code for just a Yes, No enum. So my preference is to let is a bool, maybe it needs a better name though.

@bplaat bplaat force-pushed the config-default-write-back branch from dacd8c3 to f828738 Compare September 1, 2025 19:31
Copy link
Member

@LucasChollet LucasChollet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you use the 72 columns line wrapping mentioned in the documentation rather than the smaller value you are using in the second commit?

The section_label prop is used as config key. But sometimes it
contains spaces. Spaces in config keys are quite ugly and not
following the .ini spec I think, so this commit filters them out.
@bplaat bplaat force-pushed the config-default-write-back branch from f828738 to 7e2e7e4 Compare September 3, 2025 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👀 pr-needs-review PR needs review from a maintainer or community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants