Closed mijoharas closed 4 years ago
Hmm, I'm not really interested in getting into the business of trying to detect pathological situations. I'm happy to add a check for missing $DISPLAY
, but if that isn't enough, then I don't think I'm going to add much further. How does that sound? :-)
I think that sounds like a good solution, I agree that this case doesn't warrant anything complicated, it's basically just an sanity-check :smile:.
One thing to note, is https://github.com/cdown/clipmenu/blob/develop/init/clipmenud.service#L8 which seems to set the display variable for the init script so you might just need a line like:
if ! xset q &>/dev/null; then
echo "No X server at \$DISPLAY [$DISPLAY]" >&2
exit 1
fi
(found from https://stackoverflow.com/questions/637005/how-to-check-if-x-server-is-running )
actually... that does beg the question of how DISPLAY is not set, when it's written right there in the environment...
so yeah, probably just fine checking the env var. Either way, issue is obviously fixed for me going forward, so go with whatever is easiest. Thanks again for your prompt response!
Adding a dependency on xset is a no go. We should really just stop setting DISPLAY at all, thanks for the reminder :-)
So, obviously this is somewhat user error, since clipmenu doesn't support wayland, because it depends on
xsel
e.t.c..I'm aware of that but I just tried out a new desktop environment without double checking whether my systemd would start anything Xserver related, and my cpu got pegged pretty high as clipmenud was spinning trying to access the Xserver.
Can we do a check for this and fail outright, or after a few attempts if that is the case?
example output: