darkmode: Added an else branch that finds the const auto& s declaration at either indent level and inserts the darkModeState/smallerFontsMode checks immediately after it.

locksreen: Same fix — the elif branch now tries both indent variants instead of hardcoding 6-space indent.
This commit is contained in:
justin committed 2026-04-22 18:37:54 -07:00
1 parent 34898ccfcf
commit 796684367f
2 files changed
+27 -6

No files matched your search

+16
View File
@@ -219,6 +219,22 @@ def patch_settings_cpp(repo_dir):
' return std::string(I18N.get(settings[index].nameId));\n'
' },'
)
else:
for s_decl in [
' const auto& s = settings[index];\n',
' const auto& s = settings[index];\n',
]:
if s_decl in content and '"darkModeState") return "Dark Mode"' not in content:
content = content.replace(
s_decl,
s_decl +
s_decl[:len(s_decl) - len(s_decl.lstrip())] +
'if (s.key && std::string(s.key) == "darkModeState") return "Dark Mode";\n' +
s_decl[:len(s_decl) - len(s_decl.lstrip())] +
'if (s.key && std::string(s.key) == "smallerFontsMode") return "Smaller Fonts";\n',
1
)
break
both_present = 'DarkModePlugin::stateName' in content and 'SmallerFontsPlugin::modeName' in content
only_dark = 'DarkModePlugin::stateName' in content and 'SmallerFontsPlugin::modeName' not in content