-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig-template.pkl
208 lines (207 loc) · 4.72 KB
/
config-template.pkl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
module YggdrasilConfigTemplate
//This is a template for the Yggdrasil configuration file
//use pkl to generate the actual json file from this template
// pkl eval config-template.pkl -f json > config.json
//classes are used to type check the data
class group {
// name is not the index of the group
Name: String
// Layout can be "Tree", "Max"
Layout: String
// Inactive and active colors are used for the border of managed windows
Inactive_Color: String
Active_Color: String
// Border_Size is the size of the border of managed windows
Border_Size: Int
// Gap is the space between the windows
Gap: Int
}
class widget {
// Type can be "Group", "Clock", "WindowTitle"
Type: String
// Plugin location
Plugin: String
// Font
Font: String
// Font_Size is the size of the text
Font_Size: Int
// Border_Size is the size of the border of the widget
Border_Size: Int
// Border_Color is the color of the border of the widget
Border_Color: String
// Position is relative to the top left corner of the bar
Position: Int
// size is the width of the widget
Size: Int
// Color is the color of the text
Color: String
// Background_Color is the color of the background
Background_Color: String
// Arguments is the arguments of the widget
Arguments: String
}
class bar {
// Bar_Size is the height of the bar if top or bottom,
// the width if left or right
Bar_Size: Int
// Font is the font of the text
Font: String
// Font_Size is the size of the text
Font_Size: Int
// Font_Color is the color of the text
Font_Color: String
// Background_Color is the color of the background
Background_Color: String
// Border_Size is the size of the border of the bar
Border_Size: Int
// Border_Color is the color of the border of the bar
Border_Color: String
// Position can be "Top", "Bottom", "Left", "Right"
Position: String
// List of widgets in this bar
Widgets: Listing<widget>
}
class binding {
// Key is the key to bind the action to
// name of the key can be found in /usr/include/X11/keysymdef.h
Key: String
// Action can be "FocusGroup", "Spawn"
Action: String
// Arguments is the arguments of the action
Argument: String
}
// here we generate the groups by iterating over the list of group names
// using common parameters for the rest of group config parameters
local group_name = List("1","2","3")
Groups = new Listing<group> {
for (_name in group_name) {
new {
Name = _name
Layout = "Tree"
Inactive_Color = "#FF0000"
Active_Color = "#00FF00"
Border_Size = 1
Gap = 10
}
}
}
// you must define objects local to avoid polluting the final json
local w1 : widget = new {
Type = "Group"
Plugin = "build/bin/libgroupWidget.so"
Font = "DejaVu Sans"
Font_Size = 14
Border_Size = 1
Border_Color = "#000000"
Position = 10
Size = 200
Color = "#FF0000"
Background_Color = "#FFFFFF"
Arguments = ""
}
local w2 : widget = new {
Type = "Clock"
Plugin = "build/bin/libclockWidget.so"
Font = "DejaVu Sans"
Font_Size = 10
Border_Size = 1
Border_Color = "#000000"
Position = 210
Size = 150
Color = "#000000"
Background_Color = "#FFFFFF"
Arguments = ""
}
local w3 : widget = new {
Type = "Clock"
Plugin = "build/bin/libclockWidget.so"
Font = "DejaVu Sans"
Font_Size = 10
Border_Size = 1
Border_Color = "#000000"
Position = 10
Size = 150
Color = "#000000"
Background_Color = "#FFFFFF"
Arguments = ""
}
local b1 : bar = new {
Bar_Size = 30
Font = "Arial"
Font_Size = 12
Font_Color = "#000000"
Background_Color = "#FFFFFF"
Border_Size = 2
Border_Color = "#000000"
Position = "top"
Widgets = new Listing<widget> {
w1
w2
}
}
local b2 : bar = new {
Bar_Size = 30
Font = "Arial"
Font_Size = 12
Font_Color = "#000000"
Background_Color = "#FFFFFF"
Border_Size = 2
Border_Color = "#000000"
Position = "bottom"
Widgets = new Listing<widget> {
w3
}
}
// here Bars is not local because we want to use it in the final json
Bars = new Listing<bar> {
b1
b2
}
local k1 : binding = new {
Key = "1"
Action = "FocusGroup"
Argument = "1"
}
local k2 : binding = new {
Key = "2"
Action = "FocusGroup"
Argument = "2"
}
local k3 : binding = new {
Key = "3"
Action = "FocusGroup"
Argument = "3"
}
local kEnter : binding = new {
Key = "Return"
Action = "Spawn"
Argument = "kitty"
}
local kQ : binding = new {
Key = "Q"
Action = "Quit"
Argument = ""
}
local kJ : binding = new {
Key = "J"
Action = "Grow"
Argument = "-4"
}
local kK : binding = new {
Key = "K"
Action = "Grow"
Argument = "4"
}
// Bindings are grouped by modKey
// you can create as many modKeys as you need
Bindings {
Mod1 = new Listing<binding> {
k1
k2
k3
kEnter
kQ
kJ
kK
}
}