diff options
| author | M Matthew Hydock <mhydock@yahoo.com> | 2025-04-24 14:48:08 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-24 20:48:08 +0200 |
| commit | be6268a7ecea2ad50cdb78fb661884811a8a28e8 (patch) | |
| tree | ac5846bc109796f84c1d0abe095286de96a5967d /src/config/ConfigManager.cpp | |
| parent | a9549dbca060b65ae6ec50f9bc68cdf1823d6cbe (diff) | |
groupbar: Add options for setting group bar title font weight (and indicator gap) (#9617)
Diffstat (limited to 'src/config/ConfigManager.cpp')
| -rw-r--r-- | src/config/ConfigManager.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 4bd00c99..f609eeb4 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -147,6 +147,28 @@ static void configHandleGapDestroy(void** data) { delete reinterpret_cast<CCssGapData*>(*data); } +static Hyprlang::CParseResult configHandleFontWeightSet(const char* VALUE, void** data) { + if (!*data) + *data = new CFontWeightConfigValueData(); + + const auto DATA = reinterpret_cast<CFontWeightConfigValueData*>(*data); + Hyprlang::CParseResult result; + + try { + DATA->parseWeight(VALUE); + } catch (...) { + std::string parseError = std::format("{} is not a valid font weight", VALUE); + result.setError(parseError.c_str()); + } + + return result; +} + +static void configHandleFontWeightDestroy(void** data) { + if (*data) + delete reinterpret_cast<CFontWeightConfigValueData*>(*data); +} + static Hyprlang::CParseResult handleExec(const char* c, const char* v) { const std::string VALUE = v; const std::string COMMAND = c; @@ -485,9 +507,12 @@ CConfigManager::CConfigManager() { registerConfigVar("group:group_on_movetoworkspace", Hyprlang::INT{0}); registerConfigVar("group:groupbar:enabled", Hyprlang::INT{1}); registerConfigVar("group:groupbar:font_family", {STRVAL_EMPTY}); + registerConfigVar("group:groupbar:font_weight_active", Hyprlang::CConfigCustomValueType{&configHandleFontWeightSet, configHandleFontWeightDestroy, "normal"}); + registerConfigVar("group:groupbar:font_weight_inactive", Hyprlang::CConfigCustomValueType{&configHandleFontWeightSet, configHandleFontWeightDestroy, "normal"}); registerConfigVar("group:groupbar:font_size", Hyprlang::INT{8}); registerConfigVar("group:groupbar:gradients", Hyprlang::INT{0}); registerConfigVar("group:groupbar:height", Hyprlang::INT{14}); + registerConfigVar("group:groupbar:indicator_gap", Hyprlang::INT{0}); registerConfigVar("group:groupbar:indicator_height", Hyprlang::INT{3}); registerConfigVar("group:groupbar:priority", Hyprlang::INT{3}); registerConfigVar("group:groupbar:render_titles", Hyprlang::INT{1}); |
