0

I am using Raspian Jessie. I create a c++ program that it is execute as service at startup. It open a xserver session with chromium in kiosk mode and use xdotool to change the browser tab. The xserver and chromium works fine.

The command to open xserver and chromium:

startx /usr/bin/chromium-browser --no-sandbox --disable-infobars --no-message-box --disable-translate http://www.google.it htttp://yahoo.it  -- -nocursor :0 vt1 -dpms -v -s 0 &

The xdotool command:

xdotool search --onlyvisible --class chromium windowfocus && xdotool key ctrl+Tab

return this error:

Can't open display: (null)

Looking on internet the solutions found are:

export DISPLAY=:0


export XAUTHORITY=~/.Xauthority

but nothing works.

The commands are execute from my c++ app with system() function one by one.

The strange fact is that if run the program from console and then execute the xdotool command, it works fine.

There is some strange behavior when open a xserver session from a service? Any advice?

Thanks.

  • Can you provide the output of ps aux | grep Xorg? This should provide the number to insert into export DISPLAY=:0 (if that is the problem). – XtrmJosh Mar 26 '18 at 23:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.