71f9c391290263bfa1d2ed986765c5eb49f25dbe

Author
outfoxxed <outfoxxed@outfoxxed.me>
Committer
outfoxxed <outfoxxed@outfoxxed.me>
Date

Message

Clean up config option definitions

Diff

 1diff --git a/src/main.cpp b/src/main.cpp
 2index 3bacbc79200db4ce4586586381d58a3f217950a8..f493eb54636b6cd087f6d1b493e28d4c62470024 100644
 3--- a/src/main.cpp
 4+++ b/src/main.cpp
 5@@ -14,63 +14,31 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
 6 
 7 	selection_hook::init();
 8 
 9-	HyprlandAPI::addConfigValue(
10-	    PHANDLE,
11-	    "plugin:hy3:no_gaps_when_only",
12-	    SConfigValue {.intValue = 0}
13-	);
14-	HyprlandAPI::addConfigValue(
15-	    PHANDLE,
16-	    "plugin:hy3:node_collapse_policy",
17-	    SConfigValue {.intValue = 2}
18-	);
19-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:group_inset", SConfigValue {.intValue = 10});
20-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:height", SConfigValue {.intValue = 15});
21-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:padding", SConfigValue {.intValue = 5});
22-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:from_top", SConfigValue {.intValue = 0});
23-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:rounding", SConfigValue {.intValue = 3});
24-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:render_text", SConfigValue {.intValue = 1});
25-	HyprlandAPI::addConfigValue(
26-	    PHANDLE,
27-	    "plugin:hy3:tabs:text_font",
28-	    SConfigValue {.strValue = "Sans"}
29-	);
30-	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:tabs:text_height", SConfigValue {.intValue = 8});
31-	HyprlandAPI::addConfigValue(
32-	    PHANDLE,
33-	    "plugin:hy3:tabs:text_padding",
34-	    SConfigValue {.intValue = 3}
35-	);
36-	HyprlandAPI::addConfigValue(
37-	    PHANDLE,
38-	    "plugin:hy3:tabs:col.active",
39-	    SConfigValue {.intValue = 0xff32b4ff}
40-	);
41-	HyprlandAPI::addConfigValue(
42-	    PHANDLE,
43-	    "plugin:hy3:tabs:col.urgent",
44-	    SConfigValue {.intValue = 0xffff4f4f}
45-	);
46-	HyprlandAPI::addConfigValue(
47-	    PHANDLE,
48-	    "plugin:hy3:tabs:col.inactive",
49-	    SConfigValue {.intValue = 0x80808080}
50-	);
51-	HyprlandAPI::addConfigValue(
52-	    PHANDLE,
53-	    "plugin:hy3:tabs:col.text.active",
54-	    SConfigValue {.intValue = 0xff000000}
55-	);
56-	HyprlandAPI::addConfigValue(
57-	    PHANDLE,
58-	    "plugin:hy3:tabs:col.text.urgent",
59-	    SConfigValue {.intValue = 0xff000000}
60-	);
61-	HyprlandAPI::addConfigValue(
62-	    PHANDLE,
63-	    "plugin:hy3:tabs:col.text.inactive",
64-	    SConfigValue {.intValue = 0xff000000}
65-	);
66+#define CONF(NAME, TYPE, VALUE)                                                                    \
67+	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:" NAME, SConfigValue {.TYPE##Value = VALUE})
68+
69+	// general
70+	CONF("no_gaps_when_only", int, 0);
71+	CONF("node_collapse_policy", int, 2);
72+	CONF("group_inset", int, 10);
73+
74+	// tabs
75+	CONF("tabs:height", int, 15);
76+	CONF("tabs:padding", int, 5);
77+	CONF("tabs:from_top", int, 0);
78+	CONF("tabs:rounding", int, 3);
79+	CONF("tabs:render_text", int, 1);
80+	CONF("tabs:text_font", str, "Sans");
81+	CONF("tabs:text_height", int, 8);
82+	CONF("tabs:text_padding", int, 3);
83+	CONF("tabs:col.active", int, 0xff32b4ff);
84+	CONF("tabs:col.urgent", int, 0xffff4f4f);
85+	CONF("tabs:col.inactive", int, 0x80808080);
86+	CONF("tabs:col.text.active", int, 0xff000000);
87+	CONF("tabs:col.text.urgent", int, 0xff000000);
88+	CONF("tabs:col.text.inactive", int, 0xff000000);
89+
90+#undef CONF
91 
92 	g_Hy3Layout = std::make_unique<Hy3Layout>();
93 	HyprlandAPI::addLayout(PHANDLE, "hy3", g_Hy3Layout.get());