commit d219f57
chld
·
2026-07-13 21:38:28 +0000 UTC
parent fc18009
add EMPTY
+3,
-1
1@@ -7,12 +7,14 @@ xl reads from `$HOME/.xlrc` to see what programs to display when opened.
2 clicking on a entry in xl causes the entry printed to stdout, so it can be later piped to sh.
3 ### xlrc
4 xlrc (`$HOME/.xlrc`) is a file in which xl reads from.
5-anything - as long as it works in your shell - can be put in it.
6+anything - as long as it works in your shell - can be put in it.
7+EMPTY in a xlrc file means the entry will be blank and unclickable.
8
9 example:
10 ```
11 st
12 xd
13+EMPTY
14 firefox
15 scrot
16 ```
M
xl.c
+10,
-6
1@@ -146,7 +146,7 @@ int main(int ac, char **av) {
2 XFillRectangle(d, w, gc, 0, 0, wi, hi);
3
4 for (int j = 0; j < (int)p_i; ++j) {
5- if (sel == j) {
6+ if (sel == j && strcmp(prgs[j], "EMPTY") != 0) {
7 XSetForeground(d, gc, col[3].pixel);
8 } else {
9 XSetForeground(d, gc, col[1].pixel);
10@@ -168,9 +168,11 @@ int main(int ac, char **av) {
11 XSetForeground(d, gc, col[2].pixel);
12 }
13
14- XDrawString(d, w, gc, (wi - ov.width) / 2,
15- (hi * i) / (int)p_i + (hi / (int)p_i + (as + des)) / 2,
16- prgs[i], strlen(prgs[i]));
17+ if (strcmp(prgs[i], "EMPTY") != 0) {
18+ XDrawString(d, w, gc, (wi - ov.width) / 2,
19+ (hi * i) / (int)p_i + (hi / (int)p_i + (as + des)) / 2,
20+ prgs[i], strlen(prgs[i]));
21+ }
22 }
23 break;
24 case ConfigureNotify:
25@@ -179,8 +181,10 @@ int main(int ac, char **av) {
26 goto q;
27 break;
28 case ButtonPress:
29- printf("%s\n", prgs[sel]);
30- goto q;
31+ if (strcmp(prgs[sel], "EMPTY") != 0) {
32+ printf("%s\n", prgs[sel]);
33+ goto q;
34+ }
35 break;
36 case ButtonRelease:
37 break;