Re: [systemd-devel] xmodmap gives: No protocol specified
Am 04.11.2016 um 16:26 schrieb Cecil Westerhof: 2016-11-04 15:46 GMT+01:00 Cecil Westerhof : I want to set my own keyboard definitions when they get lost. They sometimes do. The only way of doing this automatically is in a cronjob or a systemd service. I would prefer a systemd service. But for the moment I rewrite the script to be run from cron instead of systemd. That does not work either: in cron I get the same errors. :'-( you *can not* start a GUI application without a GUI and systemd-services nor cron-jobs have any GUI - that's it what you try to do is simply not possible ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] xmodmap gives: No protocol specified
2016-11-04 15:46 GMT+01:00 Cecil Westerhof : > I want to set my own keyboard definitions when they get lost. They > sometimes do. The only way of doing this automatically is in a cronjob > or a systemd service. I would prefer a systemd service. But for the > moment I rewrite the script to be run from cron instead of systemd. That does not work either: in cron I get the same errors. :'-( -- Cecil Westerhof ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] xmodmap gives: No protocol specified
2016-11-04 13:29 GMT+01:00 Mantas Mikulėnas : > On Fri, Nov 4, 2016 at 1:47 PM, Cecil Westerhof > 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. It worked with xscreensaver: https://www.linkedin.com/pulse/saving-netbook-battery-bash-script-cecil-westerhof > 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 strange thing I use the same user with at and systemd. So what is the difference? But I also tried setting XAUTHORITY with: export XAUTHORITY=~/.Xauthority With ‘xauth info’ I saw that the authority file is: /run/lightdm/cecil/xauthority but using that in the above statement did not help either. > 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. I want to set my own keyboard definitions when they get lost. They sometimes do. The only way of doing this automatically is in a cronjob or a systemd service. I would prefer a systemd service. But for the moment I rewrite the script to be run from cron instead of systemd. -- Cecil Westerhof ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] xmodmap gives: No protocol specified
On Fri, 04.11.16 12:47, 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? This is the systemd mailing list, we don't really have much knowledge about X11, sorry. Lennart -- Lennart Poettering, Red Hat ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] xmodmap gives: No protocol specified
On Fri, Nov 4, 2016 at 1:47 PM, Cecil Westerhof 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 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] xmodmap gives: No protocol specified
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? -- Cecil Westerhof ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel