aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-08-09 19:37:43 +0200
committerVaxry <[email protected]>2024-08-09 19:37:43 +0200
commitb1e1196227ccc7696da738414939c6e079ef8947 (patch)
tree9ba9e1718049d1f75f4f99f474cc1fd8c0140744
parent1f27d52a53cf51621d82024b4a682a0d7986963e (diff)
downloadHyprland-b1e1196227ccc7696da738414939c6e079ef8947.tar.gz
Hyprland-b1e1196227ccc7696da738414939c6e079ef8947.zip
add choices
-rw-r--r--src/config/ConfigManager.cpp2
-rw-r--r--src/config/ConfigManager.hpp7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 4465fab0..9396179d 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -2625,6 +2625,8 @@ std::string SConfigOptionDescription::jsonify() const {
return std::format(R"#( "value": {})#", val.color.getAsHex());
} else if constexpr (std::is_same_v<T, SBoolData>) {
return std::format(R"#( "value": {})#", val.value);
+ } else if constexpr (std::is_same_v<T, SChoiceData>) {
+ return std::format(R"#( "value": {})#", val.choices);
}
return std::string{""};
},
diff --git a/src/config/ConfigManager.hpp b/src/config/ConfigManager.hpp
index 8a7df55e..a4f432e6 100644
--- a/src/config/ConfigManager.hpp
+++ b/src/config/ConfigManager.hpp
@@ -90,6 +90,7 @@ enum eConfigOptionType : uint16_t {
CONFIG_OPTION_STRING_SHORT = 3, /* e.g. "auto" */
CONFIG_OPTION_STRING_LONG = 4, /* e.g. a command */
CONFIG_OPTION_COLOR = 5,
+ CONFIG_OPTION_CHOICE = 6, /* e.g. "one", "two", "three" */
};
enum eConfigOptionFlags : uint32_t {
@@ -118,6 +119,10 @@ struct SConfigOptionDescription {
CColor color;
};
+ struct SChoiceData {
+ std::string choices; // comma-separated
+ };
+
std::string value; // e.g. general:gaps_in
std::string description;
std::string specialCategory; // if value is special (e.g. device:abc) value will be abc and special device
@@ -128,7 +133,7 @@ struct SConfigOptionDescription {
std::string jsonify() const;
//
- std::variant<SBoolData, SRangeData, SFloatData, SStringData, SColorData> data;
+ std::variant<SBoolData, SRangeData, SFloatData, SStringData, SColorData, SChoiceData> data;
};
class CConfigManager {