On Fri, Nov 4, 2016 at 1:47 PM, Cecil Westerhof <cldwester...@gmail.com> wrote:
> I have a script I want to run as a service which uses: > xmodmap -pk > I have to define the DISPLAY, so I use: > export DISPLAY=:0.0 > > But this gives: > export DISPLAY=:0.0 > xmodmap: unable to open display ':0.0' > > When I try the same with at, I do not have this problem. > > What is happening here and how can I resolve this? > What's happening is that you shouldn't run X11 programs as system services. Most of the time, Xlib saying "No protocol specified" means that the X server rejected the connection attempt due to missing authentication details. To fix that, either the program needs the path to your Xauthority file, or the X server needs to be configured to allow all connections by your UID. The default location of Xauth information is ~/.Xauthority – if your program cannot find it, either you need to set $HOME, or your display manager (gdm &c.) probably stored it elsewhere and you need to set $XAUTHORITY. Either way, don't run X11 programs as system services. Allowing connections by UID might be simpler – run `xauth +SI:localuser:$(id -un)` in your X11 startup script. (The full SI:* syntax is described in Xsecurity(7).) -- Mantas Mikulėnas <graw...@gmail.com>
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel