dwm-setstatus-6.2.diff (1336B)
1 From dbfb346a86c79b50bfa27c75547b42e34cb54715 Mon Sep 17 00:00:00 2001 2 From: aleks <[email protected]> 3 Date: Fri, 11 Sep 2020 17:42:50 +0200 4 Subject: [PATCH] Apply setstatus-6.2 5 6 Enables to set the status with dwm itself. No more xsetroot bloat! 7 To change the status to `foo bar` execute: 8 9 dwm -s "foo bar" 10 11 Piping into `dwm -s` is currently not supported but you can set the 12 status to the output of any command by doing something like: 13 14 dwm -s "$(run_command_which_outputs_the_status)" 15 16 For example to set the status to the current date run: 17 18 dwm -s "$(date)" 19 20 --- 21 dwm.c | 7 ++++++- 22 1 file changed, 6 insertions(+), 1 deletion(-) 23 24 diff --git a/dwm.c b/dwm.c 25 index 4465af1..b3c8f71 100644 26 --- a/dwm.c 27 +++ b/dwm.c 28 @@ -2129,12 +2129,17 @@ main(int argc, char *argv[]) 29 { 30 if (argc == 2 && !strcmp("-v", argv[1])) 31 die("dwm-"VERSION); 32 - else if (argc != 1) 33 + else if (argc != 1 && strcmp("-s", argv[1])) 34 die("usage: dwm [-v]"); 35 if (!setlocale(LC_CTYPE, "") || !XSupportsLocale()) 36 fputs("warning: no locale support\n", stderr); 37 if (!(dpy = XOpenDisplay(NULL))) 38 die("dwm: cannot open display"); 39 + if (argc > 1 && !strcmp("-s", argv[1])) { 40 + XStoreName(dpy, RootWindow(dpy, DefaultScreen(dpy)), argv[2]); 41 + XCloseDisplay(dpy); 42 + return 0; 43 + } 44 checkotherwm(); 45 setup(); 46 #ifdef __OpenBSD__ 47 -- 48 2.28.0 49