Closed maujim closed 3 years ago
Hi !
You could use this little C binary:
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <X11/Xlib.h>
int main(int argc, char *argv[]) {
Display *dpy = NULL;
Window win = 0;
size_t length = 0;
ssize_t bytes_read = 0;
char *input = NULL;
dpy = XOpenDisplay(getenv("DISPLAY"));
if (dpy == NULL) {
fprintf(stderr, "Can't open display, exiting.\n");
exit(1);
}
win = DefaultRootWindow(dpy);
while ((bytes_read = getline(&input, &length, stdin)) != EOF) {
input[strlen(input) - 1] = '\0';
XStoreName(dpy, win, input);
XFlush(dpy);
}
free(input);
return 0;
}
It reads on the standard input and set the name of the X root window with it.\ Compile it:
gcc dwm-setstatus.c -lX11 -o dwm-setstatus
Then in your WM startup process pipe baru output in dwm-setstatus input in a detached mod.\
For example in your .xinitrc
put this:
(baru | dwm-setstatus) &
And you should be good to go.
I'm having difficulty using this with dwm since it uses WM_NAME to set the statusbar. Is there a way to make baru output just once and then exit? If not, would it be possible to add this as an argument (ex. --once)?
This is because the only way to change WM_NAME "manually" is to run
xsetroot -name $status
. With this feature I could doxsetroot -name $(baru --once)
.If there is another way to set WM_NAME with baru, please let me know.