commit d76750f
chld
·
2026-07-14 01:04:04 +0000 UTC
parent 8282dc7
document titles
3 files changed,
+19,
-11
+7,
-2
1@@ -8,15 +8,20 @@ clicking on a entry in xl causes the entry printed to stdout, so it can be later
2 ### xlrc
3 xlrc (`$HOME/.xlrc`) is a file in which xl reads from.
4 anything - as long as it works in your shell - can be put in it.
5-EMPTY in a xlrc file means the entry will be blank and unclickable.
6+
7+EMPTY in a xlrc file means the entry will be blank and unclickable.
8+if your line starts with `!`, it is a title.
9
10 example:
11 ```
12+EMPTY
13+!tools
14 st
15 xd
16-EMPTY
17+!other
18 firefox
19 scrot
20+EMPTY
21 ```
22 ### flags
23 - `-c`: specify file to read from
+1,
-0
1@@ -7,6 +7,7 @@ char *cols[] = {"#222222", /* border */
2 "#aaaaaa", /* font */
3 "#e74c3c", /* selected bg */
4 "#080808", /* selected font */
5+ "#111111", /* title */
6 NULL};
7
8 #endif
M
xl.c
+11,
-9
1@@ -159,7 +159,7 @@ int main(int ac, char **av) {
2 } else {
3 XSetForeground(d, gc, col[1].pixel);
4 }
5- if(prgs[j][0]=='!')
6+ if (prgs[j][0] == '!')
7 XSetForeground(d, gc, col[5].pixel);
8
9 XFillRectangle(d, w, gc, 0, (hi * j) / (int)p_i, wi, hi / (int)p_i + 1);
10@@ -169,24 +169,25 @@ int main(int ac, char **av) {
11 int direction, as, des;
12 XCharStruct ov;
13
14- XTextExtents(font, (prgs[i][0]=='!') ? prgs[i]+1 : prgs[i],
15- (prgs[i][0]=='!') ? strlen(prgs[i])-1 : strlen(prgs[i]),
16- &direction, &as, &des,
17- &ov);
18+ XTextExtents(font, (prgs[i][0] == '!') ? prgs[i] + 1 : prgs[i],
19+ (prgs[i][0] == '!') ? strlen(prgs[i]) - 1
20+ : strlen(prgs[i]),
21+ &direction, &as, &des, &ov);
22
23 if (sel == i) {
24 XSetForeground(d, gc, col[4].pixel);
25 } else {
26 XSetForeground(d, gc, col[2].pixel);
27 }
28- if(prgs[i][0]=='!')
29+ if (prgs[i][0] == '!')
30 XSetForeground(d, gc, col[2].pixel);
31
32 if (strcmp(prgs[i], "EMPTY") != 0) {
33 XDrawString(d, w, gc, (wi - ov.width) / 2,
34 (hi * i) / (int)p_i + (hi / (int)p_i + (as + des)) / 2,
35- (prgs[i][0]=='!') ? prgs[i]+1 : prgs[i],
36- (prgs[i][0]=='!') ? strlen(prgs[i])-1 : strlen(prgs[i]));
37+ (prgs[i][0] == '!') ? prgs[i] + 1 : prgs[i],
38+ (prgs[i][0] == '!') ? strlen(prgs[i]) - 1
39+ : strlen(prgs[i]));
40 }
41 }
42 break;
43@@ -197,7 +198,8 @@ int main(int ac, char **av) {
44 break;
45 case ButtonPress:
46 if (strcmp(prgs[sel], "EMPTY") != 0) {
47- if(prgs[sel][0]=='!') break;
48+ if (prgs[sel][0] == '!')
49+ break;
50 printf("%s\n", prgs[sel]);
51 goto q;
52 }