From 71f9c391290263bfa1d2ed986765c5eb49f25dbe Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Mon, 31 Jul 2023 23:00:25 -0700 Subject: [PATCH] Clean up config option definitions --- src/main.cpp | 82 ++++++++++++++++------------------------------------ 1 file changed, 25 insertions(+), 57 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3bacbc7..f493eb5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -14,63 +14,31 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { selection_hook::init(); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:no_gaps_when_only", - SConfigValue {.intValue = 0} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:node_collapse_policy", - SConfigValue {.intValue = 2} - ); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:group_inset", SConfigValue {.intValue = 10}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:height", SConfigValue {.intValue = 15}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:padding", SConfigValue {.intValue = 5}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:from_top", SConfigValue {.intValue = 0}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:rounding", SConfigValue {.intValue = 3}); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:render_text", SConfigValue {.intValue = 1}); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:text_font", - SConfigValue {.strValue = "Sans"} - ); - HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:text_height", SConfigValue {.intValue = 8}); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:text_padding", - SConfigValue {.intValue = 3} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:col.active", - SConfigValue {.intValue = 0xff32b4ff} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:col.urgent", - SConfigValue {.intValue = 0xffff4f4f} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:col.inactive", - SConfigValue {.intValue = 0x80808080} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:col.text.active", - SConfigValue {.intValue = 0xff000000} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:col.text.urgent", - SConfigValue {.intValue = 0xff000000} - ); - HyprlandAPI::addConfigValue( - PHANDLE, - "plugin:hy3:tabs:col.text.inactive", - SConfigValue {.intValue = 0xff000000} - ); +#define CONF(NAME, TYPE, VALUE) \ + HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:" NAME, SConfigValue {.TYPE##Value = VALUE}) + + // general + CONF("no_gaps_when_only", int, 0); + CONF("node_collapse_policy", int, 2); + CONF("group_inset", int, 10); + + // tabs + CONF("tabs:height", int, 15); + CONF("tabs:padding", int, 5); + CONF("tabs:from_top", int, 0); + CONF("tabs:rounding", int, 3); + CONF("tabs:render_text", int, 1); + CONF("tabs:text_font", str, "Sans"); + CONF("tabs:text_height", int, 8); + CONF("tabs:text_padding", int, 3); + CONF("tabs:col.active", int, 0xff32b4ff); + CONF("tabs:col.urgent", int, 0xffff4f4f); + CONF("tabs:col.inactive", int, 0x80808080); + CONF("tabs:col.text.active", int, 0xff000000); + CONF("tabs:col.text.urgent", int, 0xff000000); + CONF("tabs:col.text.inactive", int, 0xff000000); + +#undef CONF g_Hy3Layout = std::make_unique(); HyprlandAPI::addLayout(PHANDLE, "hy3", g_Hy3Layout.get());