dwmblocks icon indicating copy to clipboard operation
dwmblocks copied to clipboard

No protocol specified Failed to open display

Open johanthoren opened this issue 5 years ago • 5 comments

After updating from 904e407 to b7d1970 dwmblocks intermittently crashes with the following messages:

No protocol specified
Failed to open display

The only patch applied is to blocks.def.h:

--- dwmblocks/blocks.def.h      2020-06-22 12:22:39.663038013 +0200
+++ dwmblocks.new/blocks.def.h  2020-06-22 12:26:27.770563841 +0200
@@ -1,11 +1,21 @@
 //Modify this file to change what commands output to your statusbar, and recompile using the make command.
 static const Block blocks[] = {
-       /*Icon*/        /*Command*/             /*Update Interval*/     /*Update Signal*/
-       {"Mem:", "free -h | awk '/^Mem/ { print $3\"/\"$2 }' | sed s/i//g",     30,             0},
-
-       {"", "date '+%b %d (%a) %I:%M%p'",                                      5,              0},
+  /*Icon*/  /*Command*/                     /*Update Interval*/  /*Update Signal*/
+  {"",    "$HOME/bin/status/vpn.sh",        1,                   0},
+  {"",    "$HOME/bin/status/mail.sh",       10,                  0},
+  {"",    "$HOME/bin/status/wired.sh",      10,                  0},
+  {"",    "$HOME/bin/status/wifi.sh",       10,                  0},
+  {"",    "$HOME/bin/status/cpu_load.sh",   5,                   0},
+  {"",    "$HOME/bin/status/cpu_temp.sh",   5,                   0},
+  {"",    "$HOME/bin/status/used_ram.sh",   5,                   0},
+  {"",    "$HOME/bin/status/free_disk.sh",  10,                  0},
+  {"",    "$HOME/bin/status/bat.sh",        10,                  0},
+  {"",    "$HOME/bin/status/airpods.sh",    5,                   0},
+  {"",    "$HOME/bin/status/pacman.sh",     60,                  0},
+  {"",    "$HOME/bin/status/volume.sh",     1,                   0},
+  {"",    "$HOME/bin/status/clock.sh",      1,                   0},
 };

 //sets delimeter between status commands. NULL character ('\0') means no delimeter.
-static char delim[] = " | ";
+static char delim[] = "|";
 static unsigned int delimLen = 5;

johanthoren avatar Sep 09 '20 07:09 johanthoren

The error you're getting suggests that dwmblocks can't talk to the X server. Most likely sometimes opening the X display failed for you but before this commit there wasn't proper error handling so it never crashed for you. I was already working on changing it so that it only opens the X display once rather than every time the root window name is changed. I just pushed this change so try it out and see if it helps.

torrinfail avatar Sep 09 '20 19:09 torrinfail

@torrinfail, thanks. I'll give it a go and will report back after running for a while.

johanthoren avatar Sep 09 '20 19:09 johanthoren

No crash so far. However, coming back after the screensaver had kicked in, the process is still running but nothing is showing from dwmblocks, instead I see the standard 'dwm-6.2' text.

johanthoren avatar Sep 09 '20 20:09 johanthoren

Interesting. What screensaver utility do you use?(or do you just mean when X automatically makes the screen go black after a little while?) I tried to reproduce with xscreensaver and it worked no problem.

torrinfail avatar Sep 09 '20 21:09 torrinfail

Sorry, I meant when X automatically makes the screen go black.

johanthoren avatar Sep 10 '20 06:09 johanthoren