Skip to content

Commit f08a9aa

Browse files
Extend wayfire/get-config-option to return compound options (#2642)
* Extend wayfire/get-config-option to return compound options * Remove unnecessary debug messages * Do not send defaults for compound options
1 parent e486488 commit f08a9aa

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

plugins/ipc-rules/ipc-utility-methods.hpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,32 @@ class ipc_rules_utility_methods_t
127127
}
128128

129129
auto response = wf::ipc::json_ok();
130+
131+
std::shared_ptr<wf::config::compound_option_t> compound_option =
132+
std::dynamic_pointer_cast<wf::config::compound_option_t>(option);
133+
134+
if (compound_option)
135+
{
136+
wf::config::compound_option_t::stored_type_t values = compound_option->get_value_untyped();
137+
138+
auto values_json = wf::json_t::array();
139+
for (size_t i = 0; i < values.size(); i++)
140+
{
141+
auto values_json_ith = wf::json_t::array();
142+
for (size_t j = 0; j < values[i].size(); j++)
143+
{
144+
values_json_ith.append(values[i][j]);
145+
}
146+
147+
values_json.append(values_json_ith);
148+
}
149+
150+
response["value"] = values_json;
151+
152+
return response;
153+
}
154+
155+
// Normal option - can be converted into a string
130156
response["value"] = option->get_value_str();
131157
response["default"] = option->get_default_value_str();
132158
return response;

0 commit comments

Comments
 (0)