Open xsebek opened 2 weeks ago
I am open to adding something like this to brick
. If I did, it would be shaped something like this:
data INIGenerationConfig =
INIGenerationConfig { includeDescriptions :: Bool
, includeCustomizedBindings :: Bool
}
defaultINIGenerationConfig :: INIGenerationConfig
defaultINIGenerationConfig =
INIGenerationConfig { includeDescriptions = True
, includeCustomizedBindings = True
}
keybindingsToIni :: INIGenerationConfig -> KeyConfig k -> Text
and would produce a hunk of INI text compatible with keybindingsFromIni
.
Would that work for your purposes?
@jtdaugherty sounds good to me. I assume you meant includeNonCustomizableBindings
.
Should I create a PR or do you want to do it?
I assume you meant includeNonCustomizableBindings.
No, I meant includeCustomizedBindings
, as in, whether to include bindings that have been changed from their defaults. I don't think a setting to control whether non-customizable bindings are included would be useful, since this is about producing an INI, and the only purpose of that is to customize bindings so the only ones worth including are the ones that can indeed be customized. Does that make sense?
Should I create a PR or do you want to do it?
If you would like to do so, that would be great - I don't know when I'll have time to get to it, so if you are more motivated or have more time, please be my guest.
Thanks!
Also, a minor note that I didn't mention since I was going to change it in the implementation anyway: I'd rather use #
for comments in the generated INI than ;
.
Also, I realized I forgot an argument. The function signature should be
keybindingsToIni :: INIGenerationConfig -> Text -> KeyConfig k -> Text
to include the name of the INI section that should be generated in the output.
I want to show users the current/default keybindings configuration. The output should look like this:
In Swarm, I wrote
keyBindingINI
(which uses helperkeybindingEventINI
) by following the example ofkeybindingTextTable
. The code is essentially duplicated, though I opted to ignore non-customizable bindings for the INI output.It would be nice if this was provided by Brick, as an inverse to
keybindingsFromIni
.