commit a7338d6
ohmu
·
2026-09-13 17:52:08 +0300 MSK
parent e74f53e
fixed install script; new pastel configuration(you can pastelize all colors!); new color option(winbtnbord); some fixes; now acme can create default config if it doesn't exist instead of crashing
24 files changed,
+232,
-433
M
acme.1
+30,
-1
1@@ -79,7 +79,34 @@ Shell used for executing commands. Default:
2 .IR /usr/local/plan9/bin/rc .
3 .TP
4 .B pastels
5-Boolean. Enable pastel background colors. Default: 1.
6+Whitespace-separated list of color keys to which the pastel mix is
7+applied. Any of the color keys listed below may appear
8+.RB ( root ,
9+.BR border ,
10+.BR tagbg ,
11+.BR tagfg ,
12+.BR htagbg ,
13+.BR htagfg ,
14+.BR txtbg ,
15+.BR txtfg ,
16+.BR htxtbg ,
17+.BR htxtfg ,
18+.BR winbtn ,
19+.BR winbtnbord,
20+.BR colbtn ,
21+.BR tmpbtn ,
22+.BR scrlbg ,
23+.BR scrlfg ,
24+.BR scrlbord ,
25+.BR btn2hl ,
26+.BR btn3hl ;
27+.B mix
28+is not a color and is ignored if listed).
29+For each listed color, acme blends it with the
30+.B mix
31+color before use; colors not listed are used as-is.
32+Default:
33+.IR "tagbg txtbg" .
34 .TP
35 .B mix
36 Color mixed into pastel backgrounds, in RGBA hex. Default: 0xFFFFFFFF.
37@@ -116,6 +143,8 @@ Highlighted text foreground. Default: 0x000000FF.
38 .TP
39 .B winbtn
40 Window button color. Default: 0x8888CCFF.
41+.B winbtnbord
42+Top border(which under win button) color. Default 0x8888CCFF
43 .TP
44 .B colbtn
45 Column button color. Default: 0x8888CCFF.
M
acme.c
+85,
-20
1@@ -504,6 +504,7 @@ mousethread(void *v)
2 char *act;
3 enum { MResize, MMouse, MPlumb, MWarnings, NMALT };
4 static Alt alts[NMALT+1];
5+ Image *mainbg;
6
7 USED(v);
8 threadsetname("mousethread");
9@@ -532,7 +533,11 @@ mousethread(void *v)
10 case MResize:
11 if(getwindow(display, Refnone) < 0)
12 error("attach to window");
13- Image *mainbg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_ROOTBG);
14+
15+ if(ispastel("root"))
16+ mainbg = allocimagemix(display, C_ROOTBG, C_MIX);
17+ else
18+ mainbg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_ROOTBG);
19 draw(screen, screen->r, mainbg, nil, ZP);
20 iconinit();
21 scrlresize();
22@@ -950,6 +955,16 @@ Cursor boxcursor = {
23 0x7F, 0xFE, 0x7F, 0xFE, 0x7F, 0xFE, 0x00, 0x00}
24 };
25
26+int
27+ispastel(char *color)
28+{
29+ int i;
30+ for(i = 0; i < npastels; i++)
31+ if(strcmp(pastels[i], color) == 0)
32+ return 1;
33+ return 0;
34+}
35+
36 void
37 iconinit(void)
38 {
39@@ -957,30 +972,61 @@ iconinit(void)
40 Image *tmp;
41
42 if(tagcols[BACK] == nil) {
43- if (ENABLE_PASTELS)
44+ if(ispastel("tagbg"))
45 tagcols[BACK] = allocimagemix(display, C_TAGBG, C_MIX);
46 else
47 tagcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGBG);
48- tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGHLBG);
49- tagcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_COLBUTTON);
50- tagcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGFG);
51- tagcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGHLFG);
52-
53- if (ENABLE_PASTELS)
54+
55+ if(ispastel("htagbg"))
56+ tagcols[HIGH] = allocimagemix(display, C_TAGHLBG, C_MIX);
57+ else
58+ tagcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGHLBG);
59+
60+ if(ispastel("colbtn"))
61+ tagcols[BORD] = allocimagemix(display, C_COLBUTTON, C_MIX);
62+ else
63+ tagcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_COLBUTTON);
64+
65+ if(ispastel("tagfg"))
66+ tagcols[TEXT] = allocimagemix(display, C_TAGFG, C_MIX);
67+ else
68+ tagcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGFG);
69+
70+ if(ispastel("htagfg"))
71+ tagcols[HTEXT] = allocimagemix(display, C_TAGHLFG, C_MIX);
72+ else
73+ tagcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TAGHLFG);
74+
75+ if(ispastel("txtbg"))
76 textcols[BACK] = allocimagemix(display, C_TXTBG, C_MIX);
77 else
78 textcols[BACK] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTBG);
79- textcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLBG);
80- if (coolscrollbg) {
81+
82+ if(ispastel("htxtbg"))
83+ textcols[HIGH] = allocimagemix(display, C_TXTHLBG, C_MIX);
84+ else
85+ textcols[HIGH] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLBG);
86+
87+ if(coolscrollbg) {
88 textcols[BORD] = allocimage(display, Rect(0,0,2,2), CMAP8, 1, 0x000000FF);
89 draw(textcols[BORD], Rect(1,1,2,2), display->white, nil, ZP);
90 draw(textcols[BORD], Rect(0,0,1,1), display->white, nil, ZP);
91- } else {
92- textcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBG);
93+ }else{
94+ if(ispastel("scrlbg"))
95+ textcols[BORD] = allocimagemix(display, C_SCROLLBG, C_MIX);
96+ else
97+ textcols[BORD] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBG);
98 }
99- textcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTFG);
100- textcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLFG);
101-
102+
103+ if(ispastel("txtfg"))
104+ textcols[TEXT] = allocimagemix(display, C_TXTFG, C_MIX);
105+ else
106+ textcols[TEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTFG);
107+
108+ if(ispastel("htxtfg"))
109+ textcols[HTEXT] = allocimagemix(display, C_TXTHLFG, C_MIX);
110+ else
111+ textcols[HTEXT] = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TXTHLFG);
112 }
113
114 r = Rect(0, 0, Scrollwid+ButtonBorder, font->height+1);
115@@ -1002,7 +1048,10 @@ iconinit(void)
116 modbutton = allocimage(display, r, screen->chan, 0, DNofill);
117 draw(modbutton, r, tagcols[BORD], nil, r.min);
118 r = insetrect(r, 2);
119- tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
120+ if(ispastel("tmpbtn"))
121+ tmp = allocimagemix(display, C_TMPBUTTON, C_MIX);
122+ else
123+ tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
124 fillellipse(modbutton, (Point){r.min.x + 3, r.min.y + 5}, 3, 3, tmp, ZP);
125 } else {
126 button = allocimage(display, r, screen->chan, 0, DNofill);
127@@ -1016,16 +1065,32 @@ iconinit(void)
128 r.max.x -= ButtonBorder;
129 border(modbutton, r, ButtonBorder, tagcols[BORD], ZP);
130 r = insetrect(r, ButtonBorder);
131- tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
132+
133+ if(ispastel("tmpbtn"))
134+ tmp = allocimagemix(display, C_TMPBUTTON, C_MIX);
135+ else
136+ tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
137+
138 draw(modbutton, r, tmp, nil, ZP);
139 freeimage(tmp);
140 }
141
142 r = button->r;
143- colbutton = allocimage(display, r, RGBA32, 1, C_WINBUTTON);
144+
145+ if(ispastel("winbtn"))
146+ colbutton = allocimagemix(display, C_WINBUTTON, C_MIX);
147+ else
148+ colbutton = allocimage(display, r, RGBA32, 1, C_WINBUTTON);
149
150- but2col = allocimage(display, r, screen->chan, 1, C_BUTTON2HL);
151- but3col = allocimage(display, r, screen->chan, 1, C_BUTTON3HL);
152+ if(ispastel("btn2hl"))
153+ but2col = allocimagemix(display, C_BUTTON2HL, C_MIX);
154+ else
155+ but2col = allocimage(display, r, screen->chan, 1, C_BUTTON2HL);
156+
157+ if(ispastel("btn3hl"))
158+ but3col = allocimagemix(display, C_BUTTON3HL, C_MIX);
159+ else
160+ but3col = allocimage(display, r, screen->chan, 1, C_BUTTON3HL);
161 }
162 /*
163 * /dev/snarf updates when the file is closed, so we must open our own
M
cols.c
+10,
-2
1@@ -32,8 +32,16 @@ colinit(Column *c, Rectangle r)
2 {
3 Rectangle r1;
4 Text *t;
5- colsbg = allocimage(display, r, screen->chan, 1, C_ROOTBG);
6- bordercol = allocimage(display, r, screen->chan, 1, C_BORDER);
7+ if(ispastel("root"))
8+ colsbg = allocimagemix(display, C_ROOTBG, C_MIX);
9+ else
10+ colsbg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_ROOTBG);
11+
12+ if(ispastel("border"))
13+ bordercol = allocimagemix(display, C_BORDER, C_MIX);
14+ else
15+ bordercol = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_BORDER);
16+
17 draw(screen, r, colsbg, nil, ZP);
18 c->r = r;
19 c->w = nil;
+0,
-33
1@@ -1,33 +0,0 @@
2-# Acme theme based on wal-generated colors
3-# Converted from .Xresources
4-
5-mainfont /tmp/fonts/Iosevka-Oui/16a/font
6-monofont /tmp/fonts/Iosevka-Oui/16a/font
7-
8-coolcolbtn 1
9-coolscrollbg 0
10-
11-pastels 0
12-
13-root 1E1E1E
14-tagbg 1E1E1E
15-tagfg C7CCD1
16-htagbg C7CCD1
17-htagfg 1E1E1E
18-
19-txtbg 1E1E1E
20-txtfg C7CCD1
21-htxtbg C7CCD1
22-htxtfg 1E1E1E
23-
24-winbtn C7CCD1
25-colbtn C7CCD1
26-tmpbtn 747C84
27-scrlbg 747C84
28-scrlfg 1c2023
29-scrlbord 1E1E1E
30-
31-border C7CCD1
32-
33-btn2hl C7AE95
34-btn3hl C7AE95
+0,
-30
1@@ -1,30 +0,0 @@
2-mainfont /tmp/fonts/gallant12x22/16/font
3-monofont /tmp/fonts/gallant12x22/16/font
4-
5-coolcolbtn 2
6-
7-pastels 0
8-
9-root 0F0200
10-
11-tagbg 0F0200
12-tagfg ffffff
13-htagbg b08060
14-htagfg ffffff
15-
16-txtbg 0F0200
17-txtfg ffffff
18-htxtbg b08060
19-htxtfg ffffff
20-
21-winbtn F55142
22-colbtn 783129
23-tmpbtn ffffff
24-scrlbg 783129
25-scrlfg 0F0200
26-scrlbord 0F0200
27-
28-border 783129
29-
30-btn2hl b08060
31-btn3hl b08060
+0,
-33
1@@ -1,33 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/13a/font
3-monofont /tmp/fonts/Iosevka-Oui/13a/font
4-#mainfont /tmp/fonts/XonyFixed12x24rk/13a/font
5-#monofont /tmp/fonts/XonyFixed12x24rk/13a/font
6-
7-
8-coolcolbtn 1
9-coolscrollbg 1
10-
11-pastels 0
12-
13-root FFFFFF
14-tagbg FFFFFF
15-tagfg 000000
16-htagbg 000000
17-htagfg FFFFFF
18-
19-txtbg FFFFFF
20-txtfg 000000
21-htxtbg 000000
22-htxtfg FFFFFF
23-
24-winbtn 000000
25-colbtn 000000
26-tmpbtn AAAAAA
27-scrlbg AAAAAA
28-scrlfg FFFFFF
29-scrlbord 000000
30-
31-border 000000
32-
33-btn2hl 000000
34-btn3hl 000000
+0,
-33
1@@ -1,33 +0,0 @@
2-mainfont /tmp/fonts/gallant12x22/16/font
3-monofont /tmp/fonts/gallant12x22/16
4-
5-
6-coolcolbtn 1
7-coolscrollbg 1
8-
9-pastels 0
10-
11-mix ffffff
12-
13-root fcf5ec
14-
15-tagbg fcf5ec
16-tagfg 5c4a3a
17-htagbg b08060
18-htagfg ffffff
19-
20-txtbg fcf5ec
21-txtfg 5c4a3a
22-htxtbg b08060
23-htxtfg ffffff
24-
25-winbtn 6b5445
26-colbtn 8c7a64
27-tmpbtn 8c7a64
28-scrlbg 9c8271
29-scrlfg 9c8271
30-
31-border 8c7a64
32-
33-btn2hl b08060
34-btn3hl b08060
+0,
-33
1@@ -1,33 +0,0 @@
2-mainfont /tmp/fonts/XanhMono-Regular/15a/font
3-monofont /tmp/fonts/XanhMono-Regular/15a/font
4-
5-
6-coolcolbtn 1
7-coolscrollbg 0
8-
9-pastels 0
10-
11-mix eaddd0
12-
13-root f6efe5
14-
15-tagbg f6efe5
16-tagfg 5c4a3a
17-htagbg b08060
18-htagfg ffffff
19-
20-txtbg f6efe5
21-txtfg 5c4a3a
22-htxtbg b08060
23-htxtfg ffffff
24-
25-winbtn 6b5445
26-colbtn 8c7a64
27-tmpbtn 000000
28-scrlbg 9c8271
29-scrlfg f6efe5
30-
31-border 8c7a64
32-
33-btn2hl b08060
34-btn3hl b08060
+0,
-28
1@@ -1,28 +0,0 @@
2-mainfont /tmp/fonts/gallant12x22/16/font
3-monofont /tmp/fonts/gallant12x22/16/font
4-
5-squarecolbtn 1
6-
7-pastels 0
8-
9-root 060006
10-
11-tagbg 060006
12-tagfg edccda
13-htagbg B68997
14-htagfg edccda
15-
16-txtbg 060006
17-txtfg edccda
18-htxtbg B68997
19-htxtfg edccda
20-
21-winbtn DB2F8D
22-colbtn B04F8E
23-tmpbtn edccda
24-scrlbg B04F8E
25-
26-border B04F8E
27-
28-btn2hl B68997
29-btn3hl B68997
+0,
-27
1@@ -1,27 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/12a/font
3-monofont /tmp/fonts/Iosevka-Oui/12a/font
4-
5-squarecolbtn 0
6-pastels 1
7-mix 000044
8-
9-root 000000
10-tagbg 000044
11-tagfg ffffff
12-htagbg 8888cc
13-htagfg 000000
14-
15-txtbg 000000
16-txtfg ffffff
17-htxtbg eeee9e
18-htxtfg 000000
19-
20-winbtn 000000
21-colbtn 000000
22-tmpbtn 99994c
23-scrlbg 99994c
24-
25-border 000000
26-
27-btn2hl ff0000
28-btn3hl 00ff00
+0,
-30
1@@ -1,30 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/13a/font
3-monofont /tmp/fonts/Iosevka-Oui/13a/font
4-
5-coolcolbtn 1
6-coolscrollbg 0
7-
8-pastels 0
9-
10-root 1E1C1A
11-tagbg 272320
12-tagfg D3CAC5
13-htagbg 3E3833
14-htagfg F0E6E0
15-
16-txtbg 272320
17-txtfg D3CAC5
18-htxtbg 3E3833
19-htxtfg F0E6E0
20-
21-winbtn 7D6C61
22-colbtn 5D4E46
23-tmpbtn B8846A
24-scrlbg 332E2A
25-scrlfg D3CAC5
26-scrlbord 3E3833
27-
28-border 3E3833
29-
30-btn2hl B8846A
31-btn3hl 96695A
+2,
-0
1@@ -5,6 +5,7 @@ coolcolbtn 1
2 coolscrollbg 0
3
4 pastels 0
5+mix ffffff
6
7 root FFFFEA
8 tagbg FFFFEA
9@@ -18,6 +19,7 @@ htxtbg a6b2a2
10 htxtfg FFFFEA
11
12 winbtn a6b2a2
13+winbtnbord a6b2a2
14 colbtn a6b2a2
15 tmpbtn d1dad0
16 scrlbg d1dad0
+0,
-26
1@@ -1,26 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/12a/font
3-monofont /tmp/fonts/Iosevka-Oui/12a/font
4-
5-squarecolbtn 0
6-pastels 0
7-
8-root 000000
9-tagbg 000000
10-tagfg 44cc00
11-htagbg 8888cc
12-htagfg 000000
13-
14-txtbg 000000
15-txtfg 44cc00
16-htxtbg eeee9e
17-htxtfg 000000
18-
19-winbtn aaff55
20-colbtn 44cc00
21-tmpbtn aaff55
22-scrlbg aaff55
23-
24-border aaff55
25-
26-btn2hl ff0000
27-btn3hl 00ff00
+0,
-31
1@@ -1,31 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/13a/font
3-monofont /tmp/fonts/Iosevka-Oui/13a/font
4-
5-coolcolbtn 1
6-coolscrollbg 0
7-
8-pastels 1
9-
10-mix ffffff
11-root EDE7DF
12-tagbg EDE7DF
13-tagfg 000000
14-htagbg f2c4c7
15-htagfg 000000
16-
17-txtbg EDE7DF
18-txtfg 000000
19-htxtbg f2c4c7
20-htxtfg 000000
21-
22-winbtn b7c8b1
23-colbtn b7c8b1
24-tmpbtn AAAAAA
25-scrlbg EDE7DF
26-scrlfg f4efe8
27-scrlbord EDE7DF
28-
29-border 000000
30-
31-btn2hl f2c4c7
32-btn3hl f2c4c7
+0,
-30
1@@ -1,30 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/13a/font
3-monofont /tmp/fonts/Iosevka-Oui/13a/font
4-
5-coolcolbtn 0
6-coolscrollbg 0
7-
8-pastels 1
9-
10-root f0ebe3
11-tagbg f0ebe3
12-tagfg 6a5a4a
13-htagbg c9786e
14-htagfg f0ebe3
15-
16-txtbg f0ebe3
17-txtfg 5a6a5a
18-htxtbg 8ab8b0
19-htxtfg 2a3a3a
20-
21-winbtn c9786e
22-colbtn e8b088
23-tmpbtn d8d0c8
24-scrlbg d8d0c8
25-scrlfg 6a7a6a
26-scrlbord c9786e
27-
28-border 8ab8b0
29-
30-btn2hl b0685e
31-btn3hl 6aa8a0
+0,
-27
1@@ -1,27 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/12a/font
3-monofont /tmp/fonts/Iosevka-Oui/12a/font
4-
5-squarecolbtn 0
6-pastels 1
7-mix 222222
8-
9-root 2a2a2a
10-tagbg 3a3a3a
11-tagfg eeeeee
12-htagbg 5577aa
13-htagfg ffffff
14-
15-txtbg 1a1a1a
16-txtfg eeeeee
17-htxtbg 445566
18-htxtfg ffffff
19-
20-winbtn 666666
21-colbtn 444444
22-tmpbtn 445566
23-scrlbg 333333
24-
25-border 5577aa
26-
27-btn2hl cc6644
28-btn3hl 66aa66
+0,
-30
1@@ -1,30 +0,0 @@
2-mainfont /tmp/fonts/Iosevka-Oui/13a/font
3-monofont /tmp/fonts/Iosevka-Oui/13a/font
4-
5-coolcolbtn 1
6-coolscrollbg 1
7-
8-pastels 1
9-
10-root FFFFFF
11-tagbg FFFFFF
12-tagfg 000000
13-htagbg 000000
14-htagfg FFFFFF
15-
16-txtbg FFFFAA
17-txtfg 000000
18-htxtbg 72DEC2
19-htxtfg 000000
20-
21-winbtn 72DEC2
22-colbtn 72DEC2
23-tmpbtn 000000
24-scrlbg AAAAAA
25-scrlfg 000000
26-scrlbord FFFFAA
27-
28-border 000000
29-
30-btn2hl 000000
31-btn3hl 72DEC2
M
fns.h
+1,
-0
1@@ -47,6 +47,7 @@ void killtasks(void);
2 int runeeq(Rune*, uint, Rune*, uint);
3 int ALEF_tid(void);
4 void iconinit(void);
5+int ispastel(char *color);
6 Timer* timerstart(int);
7 void timerstop(Timer*);
8 void timercancel(Timer*);
+2,
-7
1@@ -1,12 +1,13 @@
2 #!/bin/sh
3
4-path=[$1:-/usr/local/bin/]
5+path=${1:-/usr/local/bin/}
6
7 mk clean && NPROC=$(nproc) mk
8
9 if [ -f "o.acme" ]; then
10 doas rm -f "$path/acme"
11 doas cp o.acme "$path/acme"
12+ doas cp acme.1 /usr/share/man/man1/acme.1
13 echo "==== acme installed succesfully ===="
14 mk clean
15 else
16@@ -14,9 +15,3 @@ else
17 exit 1
18 fi
19
20-if [ ! -f "/usr/share/man/man1/acme.1" ]; then
21- doas cp acme.1 /usr/share/man/man1/acme.1
22- echo "=== acme man installed ===="
23-else
24- echo "==== acme man already installed ===="
25-fi
M
parser.c
+69,
-5
1@@ -1,5 +1,9 @@
2 /* I'm so ashamed of this code, sorry */
3
4+/*
5+ * TODO: rewrite using p9p libs
6+ */
7+
8 #include <stdio.h>
9 #include <string.h>
10 #include <stdlib.h>
11@@ -8,6 +12,47 @@
12
13 char *home;
14
15+void
16+defconfig(FILE *f)
17+{
18+ fprintf(f, "shell /bin/sh\n");
19+ fprintf(f, "mainfont /lib/font/bit/lucsans/euro.8.font\n");
20+ fprintf(f, "monofont /lib/font/bit/lucm/unicode.9.font\n");
21+ fprintf(f, "dumppath /tmp/acme.dump\n");
22+ fprintf(f, "pastels tagbg txtbg scrlfg\n");
23+ fprintf(f, "\n");
24+ fprintf(f, "mix FFFFFF\n");
25+ fprintf(f, "root FFFFFF\n");
26+ fprintf(f, "border 000000\n");
27+ fprintf(f, "tagbg AAFFFF\n");
28+ fprintf(f, "tagfg 000000\n");
29+ fprintf(f, "htagbg 9EEEEE\n");
30+ fprintf(f, "htagfg 000000\n");
31+ fprintf(f, "txtbg FFFFAA\n");
32+ fprintf(f, "txtfg 000000\n");
33+ fprintf(f, "htxtbg EEEE9E\n");
34+ fprintf(f, "htxtfg 000000\n");
35+ fprintf(f, "winbtn 8888CC\n");
36+ fprintf(f, "winbtnbord 8888CC\n");
37+ fprintf(f, "colbtn 8888CC\n");
38+ fprintf(f, "tmpbtn 000099\n");
39+ fprintf(f, "scrlbg 99994C\n");
40+ fprintf(f, "scrlfg FFFFAA\n");
41+ fprintf(f, "scrlbord 99994C\n");
42+ fprintf(f, "btn2hl AA0000\n");
43+ fprintf(f, "btn3hl 006600\n");
44+ fprintf(f, "\n");
45+ fprintf(f, "autoindent 1\n");
46+ fprintf(f, "swpscrllbtns 0\n");
47+ fprintf(f, "clicktofocus 1\n");
48+ fprintf(f, "colcount 2\n");
49+ fprintf(f, "openarg 1\n");
50+ fprintf(f, "coolcolbtn 0\n");
51+ fprintf(f, "coolscrollbg 0\n");
52+ fprintf(f, "showdotfiles 1\n");
53+ fprintf(f, "newcolnewrow 1\n");
54+}
55+
56 char
57 *parsekeyvalue(FILE *file, char const *desired_name, char *def)
58 {
59@@ -32,7 +77,7 @@ char
60 snprintf(homepath, sizeof(homepath), "%s/%s", home, path);
61 fi = fopen(homepath, "r");
62 if (!fi) {
63- fprintf(stderr, "can't open include file from home\n");
64+ fprintf(stderr, "error: can't open included file from home\n");
65 exit(1);
66 }
67 }
68@@ -78,10 +123,11 @@ void
69 initconfig(char *custom_config)
70 {
71 char path[1024];
72+ char *pastels_str;
73
74 home = getenv("HOME");
75 if(!home){
76- fprintf(stderr, "$HOME not set\n");
77+ fprintf(stderr, "error: $HOME not set\n");
78 exit(1);
79 }
80 if(!custom_config)
81@@ -90,10 +136,27 @@ initconfig(char *custom_config)
82 snprintf(path, sizeof(path), "%s", custom_config);
83 FILE *f = fopen(path, "r");
84 if(!f){
85- fprintf(stderr, "can't open file\n");
86- exit(1);
87+ fprintf(stderr, "warning: can't open config file\n");
88+ f = fopen(path, "w");
89+ if(!f){
90+ fprintf(stderr, "fatal: can't create config file, exiting\n");
91+ exit(1);
92+ }
93+ defconfig(f);
94+ }
95+ pastels_str = parsekeyvalue(f, "pastels", NULL);
96+ if(pastels_str == NULL)
97+ pastels_str = strdup("tagbg txtbg scrlfg");
98+
99+ char *p = strtok(pastels_str, " \t\n");
100+ npastels = 0;
101+ while(p != NULL && npastels < MAXPASTELS){
102+ pastels[npastels++] = strdup(p);
103+ p = strtok(NULL, " \t\n");
104 }
105- ENABLE_PASTELS = getintvalue(f, "pastels", 1);
106+
107+ free(pastels_str);
108+
109 C_MIX = getcolor(f, "mix", 0xFFFFFFFF);
110 C_ROOTBG = getcolor(f, "root", 0xFFFFFFFF);
111 C_BORDER = getcolor(f, "border", 0x000000FF);
112@@ -106,6 +169,7 @@ initconfig(char *custom_config)
113 C_TXTHLBG = getcolor(f, "htxtbg", 0xEEEE9EFF);
114 C_TXTHLFG = getcolor(f, "htxtfg", 0x000000FF);
115 C_WINBUTTON = getcolor(f, "winbtn", 0x8888CCFF);
116+ C_WINBTNBORDER = getcolor(f, "winbtnbord", 0x8888CCFF);
117 C_COLBUTTON = getcolor(f, "colbtn", 0x8888CCFF);
118 C_TMPBUTTON = getcolor(f, "tmpbtn", 0x000099FF);
119 C_SCROLLBG = getcolor(f, "scrlbg", 0x99994CFF);
M
parser.h
+7,
-2
1@@ -1,14 +1,15 @@
2 #include <stdio.h>
3
4+#define MAXPASTELS 32
5+
6 char *parsekeyvalue(FILE *file, char const *desired_name, char *def);
7 uint32_t getcolor(FILE *f, char *key, uint32_t def);
8 void initconfig(char *custom_config_path);
9+void defconfig(FILE *f);
10
11-int ENABLE_PASTELS;
12 uint32_t C_MIX;
13 uint32_t C_ROOTBG;
14 uint32_t C_BORDER;
15-uint32_t C_ROWSBG;
16 uint32_t C_TAGBG;
17 uint32_t C_TAGFG;
18 uint32_t C_TAGHLBG;
19@@ -18,6 +19,7 @@ uint32_t C_TXTFG;
20 uint32_t C_TXTHLBG;
21 uint32_t C_TXTHLFG;
22 uint32_t C_WINBUTTON;
23+uint32_t C_WINBTNBORDER;
24 uint32_t C_COLBUTTON;
25 uint32_t C_TMPBUTTON;
26 uint32_t C_SCROLLBG;
27@@ -32,6 +34,9 @@ char *fontnames[2];
28 char *dumppath;
29 char *acmeshell;
30 char *customconfigpath;
31+char *pastels[MAXPASTELS];
32+
33+int npastels;
34
35 int globalautoindent;
36 int bartflag;
M
rows.c
+11,
-2
1@@ -31,8 +31,17 @@ rowinit(Row *row, Rectangle r)
2 {
3 Rectangle r1;
4 Text *t;
5- rowsbg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_ROOTBG);
6- bordercol = allocimage(display, r, screen->chan, 1, C_BORDER);
7+
8+ if(ispastel("root"))
9+ rowsbg = allocimagemix(display, C_ROOTBG, C_MIX);
10+ else
11+ rowsbg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_ROOTBG);
12+
13+ if(ispastel("border"))
14+ bordercol = allocimagemix(display, C_BORDER, C_MIX);
15+ else
16+ bordercol = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_BORDER);
17+
18 draw(screen, r, rowsbg, nil, ZP);
19 row->r = r;
20 row->col = nil;
M
scrl.c
+9,
-2
1@@ -74,8 +74,15 @@ textscrdraw(Text *t)
2 if(!eqrect(r2, t->lastsr)){
3 t->lastsr = r2;
4 if(scrollfg == nil) {
5- scrollfg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLFG);
6- scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
7+ if(ispastel("scrlfg"))
8+ scrollfg = allocimagemix(display, C_SCROLLFG, C_MIX);
9+ else
10+ scrollfg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLFG);
11+
12+ if(ispastel("scrlbord"))
13+ scrollborder = allocimagemix(display, C_SCROLLBORDER, C_MIX);
14+ else
15+ scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
16 }
17 draw(b, r1, t->fr.cols[BORD], nil, ZP);
18 draw(b, r2, scrollfg, nil, ZP);
M
wind.c
+6,
-1
1@@ -186,6 +186,7 @@ winresize(Window *w, Rectangle r, int safe, int keepextra)
2 int oy, y, mouseintag, mouseinbody;
3 Point p;
4 Rectangle r1;
5+ Image *winbtnborder;
6
7 mouseintag = ptinrect(mouse->xy, w->tag.all);
8 mouseinbody = ptinrect(mouse->xy, w->body.all);
9@@ -234,7 +235,11 @@ winresize(Window *w, Rectangle r, int safe, int keepextra)
10 if(y+1+w->body.fr.font->height <= r.max.y){ /* room for one line */
11 r1.min.y = y;
12 r1.max.y = y+1;
13- draw(screen, r1, tagcols[BORD], nil, ZP);
14+ if(ispastel("winbtnbord"))
15+ winbtnborder = allocimagemix(display, C_WINBTNBORDER, C_MIX);
16+ else
17+ winbtnborder = allocimage(display, r, RGBA32, 1, C_WINBTNBORDER);
18+ draw(screen, r1, winbtnborder, nil, ZP);
19 y++;
20 r1.min.y = min(y, r.max.y);
21 r1.max.y = r.max.y;