commit a049308

wf  ·  2026-06-08 16:51:22 +0000 UTC
parent c4dd79a
Add sample config
3 files changed,  +87, -75
+72, -0
 1@@ -0,0 +1,72 @@
 2+# panko sample config file
 3+
 4+# Bar width/height
 5+width 850
 6+height 35
 7+
 8+# Screen edges to align the bar to [top, right, bottom, left]
 9+anchor bottom
10+
11+# Margins relative to the screen edges, in the format of [top right bottom left] (all mandatory)
12+margins 0 0 10 0
13+
14+# Whether the compositor should reserve space for the bar [true/false]
15+exclusive true
16+
17+# Bar style keys, same as modules with the exception of borders. Colors can be hex or named (e.g. `azure`)
18+style {
19+	foreground "#ff0000"
20+	background "#121212"
21+	font "Terminus:size=12"
22+}
23+
24+# An example module definiton
25+module "workspace" {
26+	# Source command for the text
27+	command "howlc get_workspace"
28+	# Interval at which to execute the source command (seconds)
29+	# If the interval is set to 0, the command is a one-shot (executed only once)
30+	interval 3
31+
32+	# Module margins/padding in the format of [top right bottom left] (all mandatory)
33+	margins 0 0 0 8
34+	padding 2 2 2 2
35+
36+	# Implicit geometry for the module (inferred from text size if unset)
37+	width 15
38+	height 15
39+
40+	# Style keys, unset ones are inherited from bar
41+
42+	style {
43+		foreground "blue"
44+		background "#ff0000"
45+		font "Terminus:size=12:style=Bold"
46+		border-width 1
47+		border-color "green"
48+	}
49+}
50+
51+module "text" {
52+	command "echo 'foobar'"
53+	interval 0
54+
55+	style {
56+		foreground "#333333"
57+		background "#121212"
58+		border-width 0
59+	}
60+}
61+
62+module "time" {
63+	command "date +'%a %R'"
64+	interval 10
65+
66+	margins 0 8 0 0
67+	padding 2 2 2 2
68+}
69+
70+# Modules to display on the left/middle/right side of the bar
71+modules-left "workspace"
72+modules-middle "text"
73+modules-right "time"
+0, -65
 1@@ -1,65 +0,0 @@
 2-Outline:
 3-
 4-The content is drawn based on 'modules' (ala tint2, polybar, etc.),
 5-which can be any sort of styled or otherwise configurable text.
 6-The configuration is in one singular .scfg file, where modules,
 7-alongside other bar variables, are defined. Here is an example of the
 8-configuration file:
 9-
10-```scfg
11-# Bar width/height
12-width 1920
13-height 30
14-
15-# Screen edges to align the bar to (top, right, bottom, left)
16-anchor bottom
17-
18-# Margins relative to the screen edges, in the format of [top right bottom left] (all mandatory)
19-margins 0 0 10 0
20-
21-# Padding relative to the edges of the bar, in the same format as the margins
22-padding 2 10 2 10
23-
24-# Whether the compositor should reserve space for the bar (true/false)
25-exclusive true
26-
27-# Bar style keys, same as modules with the exception of borders. Colors can be hex or named (e.g. Azure)
28-style {
29-	foreground "#ff00ff"
30-	background "#121212"
31-	font "Terminus"
32-}
33-
34-# An example module definiton
35-module "time" {
36-	# Source command for the text
37-	command "date +'%a %R'"
38-	# Interval at which to execute the source command (seconds)
39-	interval 10
40-
41-	# Module margins, in the format of [top right bottom left] (all mandatory)
42-	margins 5 0 5 0
43-	padding 5 5 5 5
44-	# Implicit geometry for the module (if it's not set, then it's inferred from text size)
45-	width 60
46-	height 30
47-
48-	# Style keys, unset ones are inherited from bar
49-	style {
50-		foreground "#ffffff"
51-		background "#000000"
52-		font "monospace:size=10"
53-		border-width 2
54-		border-color "#ff0000"
55-	}
56-}
57-
58-# Modules to display on the left/middle/right side of the bar
59-modules-left ""
60-modules-middle ""
61-modules-right "time"
62-```
63-
64-Things like importing other files and on-the-fly reloading are possible,
65-but not in the scope of this program and could easily be done with a tiny
66-bit of shell glue.
+15, -10
 1@@ -837,18 +837,23 @@ run(struct app *app) {
 2 
 3 		bool redraw = false;
 4 		n = 1;
 5-		for (size_t i = 0; i < app->panel.plen; i++) {
 6-			struct module *m = app->panel.parsed[i];
 7-			if (m->fd >= 0) {
 8-				if (pfds[n].revents & (POLLIN | POLLHUP | POLLRDHUP)) {
 9-					module_out(m);
10-					redraw = true;
11+		for (int s = 0; s < 3; s++) {
12+			for (size_t i = 0; i < MAXMOD; i++) {
13+				struct module *m = app->panel.modules[s][i];
14+				if (!m)
15+					continue;
16+
17+				if (m->fd >= 0) {
18+					if (pfds[n].revents & (POLLIN | POLLHUP | POLLRDHUP)) {
19+						module_out(m);
20+						redraw = true;
21+					}
22+					n++;
23 				}
24-				n++;
25-			}
26 
27-			if (m->fd < 0 && m->pid == 0 && m->interval && now >= m->next)
28-				module_run(m);
29+				if (m->fd < 0 && m->pid == 0 && m->interval && now >= m->next)
30+					module_run(m);
31+			}
32 		}
33 
34 		if (redraw)