commit ab44a13
ohmu
·
2026-09-21 00:07:29 +0300 MSK
parent eb27932
added some visual theming like in acme from plan9-2e
10 files changed,
+165,
-60
M
acme.1
+5,
-2
1@@ -195,10 +195,13 @@ Number of initial columns. Default: 2.
2 Boolean. Open files given on the command line. Default: 1.
3 .TP
4 .B coolcolbtn
5-Boolean. Cool column buttons. 1 is square, 2 is ellipse. Default: 0.
6+Boolean. Cool column buttons. 1 is square, 2 is ellipse, 3 is from old acme. Default: 0.
7+.TP
8+.B coolwinbtn
9+Boolean. Cool win btn from old acme(1). Default: 0.
10 .TP
11 .B coolscrollbg
12-Boolean. Cool scrollbar background. Default: 0.
13+Boolean. Cool scrollbar background. From xxiivv(1) or from old acme(2). Default: 0.
14 .TP
15 .B showdotfiles
16 Boolean. Show dotfiles in directory windows. Default: 1.
M
acme.c
+41,
-3
1@@ -965,6 +965,20 @@ ispastel(char *color)
2 return 0;
3 }
4
5+Image*
6+tilebit(int dark)
7+{
8+ Image *t, *fg;
9+
10+ fg = dark ? display->white : display->black;
11+ t = allocimage(display, Rect(0,0,4,2), screen->chan, 1, dark ? DBlack : DWhite);
12+ if(t == nil)
13+ return nil;
14+ draw(t, Rect(2,0,3,1), fg, nil, ZP);
15+ draw(t, Rect(0,1,1,2), fg, nil, ZP);
16+ return t;
17+}
18+
19 void
20 iconinit(void)
21 {
22@@ -1070,6 +1084,22 @@ iconinit(void)
23 else
24 tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
25 fillellipse(modbutton, (Point){r.min.x + 3, r.min.y + 5}, 3, 3, tmp, ZP);
26+ }else if(coolcolbtn == 3){
27+ button = allocimage(display, r, screen->chan, 0, DNofill);
28+ draw(button, r, tagcols[BACK], nil, ZP);
29+ draw(button, insetrect(r, 1), tagcols[BORD], nil, ZP);
30+ draw(button, insetrect(r, 3), tagcols[BACK], nil, ZP);
31+
32+ modbutton = allocimage(display, r, screen->chan, 0, DNofill);
33+ draw(modbutton, r, tagcols[BACK], nil, ZP);
34+ draw(modbutton, insetrect(r, 1), tagcols[BORD], nil, ZP);
35+ draw(modbutton, insetrect(r, 3), tagcols[BACK], nil, ZP);
36+ if(ispastel("tmpbtn"))
37+ tmp = allocimagemix(display, C_TMPBUTTON, C_MIX);
38+ else
39+ tmp = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_TMPBUTTON);
40+ draw(modbutton, insetrect(r, 4), tmp, nil, ZP);
41+ freeimage(tmp);
42 }else{
43 button = allocimage(display, r, screen->chan, 0, DNofill);
44 draw(button, r, tagcols[BACK], nil, r.min);
45@@ -1093,8 +1123,16 @@ iconinit(void)
46 }
47
48 r = button->r;
49-
50- if(ispastel("winbtn"))
51+
52+ if(coolwinbtn){
53+ r = Rect(0, 0, Scrollwid, button->r.max.y);
54+ colbutton = allocimage(display, r, screen->chan, 0, DNofill);
55+ draw(colbutton, r, tagcols[BACK], nil, ZP);
56+ draw(colbutton, insetrect(r, 1), tagcols[BORD], nil, ZP);
57+ tmp = tilebit(1);
58+ draw(colbutton, insetrect(r, 2), tmp, nil, ZP);
59+ freeimage(tmp);
60+ }else if(ispastel("winbtn"))
61 colbutton = allocimagemix(display, C_WINBUTTON, C_MIX);
62 else
63 colbutton = allocimage(display, r, RGBA32, 1, C_WINBUTTON);
64@@ -1189,4 +1227,4 @@ timefmt(Fmt *f)
65 tm = localtime(va_arg(f->args, ulong));
66 return fmtprint(f, "%04d/%02d/%02d %02d:%02d:%02d",
67 tm->year+1900, tm->mon+1, tm->mday, tm->hour, tm->min, tm->sec);
68-}
69+}
+2,
-2
1@@ -1,8 +1,8 @@
2 " settings
3
4-@include .acmethemes/ghibli
5+@include acmethemes/alef
6
7-dumppath /home/glenda/.acme.dump
8+dumppath /tmp/.acme.dump
9 shell /bin/rc
10
11 autoindent 1
+33,
-0
1@@ -0,0 +1,33 @@
2+mainfont /lib/font/bit/lucsans/euro.8.font
3+monofont /lib/font/bit/lucm/unicode.9.font
4+
5+
6+coolcolbtn 3
7+coolscrollbg 2
8+coolwinbtn 1
9+
10+pastels 0
11+
12+root FFFFFF
13+tagbg FFFFFF
14+tagfg 000000
15+htagbg 000000
16+htagfg FFFFFF
17+
18+txtbg FFFFFF
19+txtfg 000000
20+htxtbg 000000
21+htxtfg FFFFFF
22+
23+winbtn 000000
24+winbtnbord 000000
25+colbtn 000000
26+tmpbtn 000000
27+scrlbg AAAAAA
28+scrlfg FFFFFF
29+scrlbord 000000
30+
31+border 000000
32+
33+btn2hl 000000
34+btn3hl 000000
+0,
-32
1@@ -1,32 +0,0 @@
2-mainfont /tmp/fonts/gallant12x22/16/font
3-monofont /tmp/fonts/gallant12x22/16/font
4-
5-coolcolbtn 1
6-coolscrollbg 0
7-
8-pastels 0
9-mix ffffff
10-
11-root FFFFEA
12-tagbg FFFFEA
13-tagfg 000000
14-htagbg a6b2a2
15-htagfg FFFFEA
16-
17-txtbg FFFFEA
18-txtfg 000000
19-htxtbg a6b2a2
20-htxtfg FFFFEA
21-
22-winbtn a6b2a2
23-winbtnbord a6b2a2
24-colbtn a6b2a2
25-tmpbtn d1dad0
26-scrlbg d1dad0
27-scrlfg FFFFEA
28-scrlbord a6b2a2
29-
30-border a6b2a2
31-
32-btn2hl a6b2a2
33-btn3hl a6b2a2
+31,
-0
1@@ -0,0 +1,31 @@
2+mainfont /tmp/fonts/gallant12x22/16/font
3+monofont /tmp/fonts/gallant12x22/16/font
4+
5+coolcolbtn 1
6+coolscrollbg 0
7+
8+pastels 0
9+
10+root 0F0202
11+tagbg 0F0202
12+tagfg ffffff
13+htagbg 7C5557
14+htagfg ffffff
15+
16+txtbg 0F0202
17+txtfg ffffff
18+htxtbg 7C5557
19+htxtfg ffffff
20+
21+winbtn 9E7779
22+winbtnbord 7C5557
23+colbtn 7C5557
24+tmpbtn ffffff
25+scrlbg 7C5557
26+scrlfg 0F0202
27+scrlbord 7C5557
28+
29+border 7C5557
30+
31+btn2hl 7C5557
32+btn3hl 7C5557
M
fns.h
+2,
-0
1@@ -46,6 +46,8 @@ void killprocs(void);
2 void killtasks(void);
3 int runeeq(Rune*, uint, Rune*, uint);
4 int ALEF_tid(void);
5+
6+Image *tilebit(int dark);
7 void iconinit(void);
8 int ispastel(char *color);
9 Timer* timerstart(int);
M
parser.c
+2,
-0
1@@ -48,6 +48,7 @@ defconfig(FILE *f)
2 fprintf(f, "colcount 2\n");
3 fprintf(f, "openarg 1\n");
4 fprintf(f, "coolcolbtn 0\n");
5+ fprintf(f, "coolwinbtn 0\n");
6 fprintf(f, "coolscrollbg 0\n");
7 fprintf(f, "showdotfiles 1\n");
8 fprintf(f, "newcolnewrow 1\n");
9@@ -194,6 +195,7 @@ initconfig(char *custom_config)
10 ncol = getintvalue(f, "colcount", 2);
11 openarg = getintvalue(f, "openarg", 1);
12 coolcolbtn = getintvalue(f, "coolcolbtn", 0);
13+ coolwinbtn = getintvalue(f, "coolwinbtn", 0);
14 coolscrollbg = getintvalue(f, "coolscrollbg", 0);
15 showdotfiles = getintvalue(f, "showdotfiles", 1);
16 ncolnrow = getintvalue(f, "newcolnewrow", 1);
M
parser.h
+1,
-0
1@@ -44,6 +44,7 @@ int swapscrollbuttons;
2 int ncol;
3 int openarg;
4 int coolcolbtn;
5+int coolwinbtn;
6 int coolscrollbg;
7 int showdotfiles;
8 int ncolnrow;
M
scrl.c
+48,
-21
1@@ -19,12 +19,14 @@ Image *scrollborder;
2
3 static
4 Rectangle
5-scrpos(Rectangle r, uint p0, uint p1, uint tot)
6+scrpos(Rectangle r, uint p0, uint p1, uint tot, int in)
7 {
8 Rectangle q;
9 int h;
10-
11+
12 q = r;
13+ if(in)
14+ q = insetrect(r, 1); /* thumb lives inside the frame */
15 h = q.max.y-q.min.y;
16 if(tot == 0)
17 return q;
18@@ -58,38 +60,63 @@ scrlresize(void)
19 void
20 textscrdraw(Text *t)
21 {
22- Rectangle r, r1, r2;
23- Image *b;
24+ Rectangle r, r1, r2, r3;
25+ Image *b, *tile;
26+ int customscrl;
27+
28+ customscrl = (coolscrollbg == 2);
29
30 if(t->w==nil || t!=&t->w->body)
31 return;
32 if(scrtmp == nil)
33 scrlresize();
34 r = t->scrollr;
35+ if(customscrl)
36+ r.min.x += 1; /* border between margin and bar */
37 b = scrtmp;
38 r1 = r;
39 r1.min.x = 0;
40 r1.max.x = Dx(r);
41- r2 = scrpos(r1, t->org, t->org+t->fr.nchars, t->file->b.nc);
42+ r2 = scrpos(r1, t->org, t->org+t->fr.nchars, t->file->b.nc, customscrl);
43 if(!eqrect(r2, t->lastsr)){
44 t->lastsr = r2;
45- if(scrollfg == nil) {
46- if(ispastel("scrlfg"))
47- scrollfg = allocimagemix(display, C_SCROLLFG, C_MIX);
48- else
49- scrollfg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLFG);
50-
51- if(ispastel("scrlbord"))
52- scrollborder = allocimagemix(display, C_SCROLLBORDER, C_MIX);
53- else
54- scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
55- }
56- draw(b, r1, t->fr.cols[BORD], nil, ZP);
57- draw(b, r2, scrollfg, nil, ZP);
58- r2.min.x = r2.max.x-1;
59- draw(b, r2, scrollborder, nil, ZP);
60+ if(customscrl){
61+ /* frame, light grey trough, white thumb capped by black lines */
62+ tile = tilebit(0);
63+ draw(b, r1, display->black, nil, ZP);
64+ draw(b, insetrect(r1, 1), tile, nil, ZP);
65+ freeimage(tile);
66+ draw(b, r2, t->fr.cols[BACK], nil, ZP);
67+ r3 = r2;
68+ r3.max.y = r3.min.y;
69+ r3.min.y--;
70+ draw(b, r3, display->black, nil, ZP);
71+ r3 = r2;
72+ r3.min.y = r3.max.y;
73+ r3.max.y++;
74+ draw(b, r3, display->black, nil, ZP);
75+ /* the 1px gap left of the bar */
76+ r3 = t->scrollr;
77+ r3.max.x = r3.min.x+1;
78+ draw(t->fr.b, r3, t->fr.cols[BACK], nil, ZP);
79+ }else{
80+ if(scrollfg == nil) {
81+ if(ispastel("scrlfg"))
82+ scrollfg = allocimagemix(display, C_SCROLLFG, C_MIX);
83+ else
84+ scrollfg = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLFG);
85+
86+ if(ispastel("scrlbord"))
87+ scrollborder = allocimagemix(display, C_SCROLLBORDER, C_MIX);
88+ else
89+ scrollborder = allocimage(display, Rect(0,0,1,1), RGBA32, 1, C_SCROLLBORDER);
90+ }
91+ draw(b, r1, t->fr.cols[BORD], nil, ZP);
92+ draw(b, r2, scrollfg, nil, ZP);
93+ r2.min.x = r2.max.x-1;
94+ draw(b, r2, scrollborder, nil, ZP);
95+ }
96 draw(t->fr.b, r, b, nil, Pt(0, r1.min.y));
97-/*flushimage(display, 1); // BUG? */
98 }
99 }
100