Score:1

How to start a gui app within an openbox window outside of its autorun file

ke flag

TL;DR

Running ubuntu server 20.04 with xserver-xorg x11-xserver-utils xinit openbox installed. I can place a command within openbox's autorun file and its runs well. Now I wish start openbox, then from a daemon, at some later point start an app to run within the currently open openbox window. How does one get a handle to the current openbox window?

Details

I followed this very helpful tutorial on how to setup a kiosk, its for a raspberry pi, I adapted it to run on ubuntu server.

All runs well; a guest user auto logs in at boot up, then the guest user's .profile file runs startx -- -nocursor, and inside the openbox autostart file is a command to start chromium. Happy days.

Now I wish to move the command to start chromium out of the openbox autostart file, and place it under the control of supervisor (so if chromium crashes, supervisor will auto restart chromium).

Unfortuantely when supervisor tries to start chromium, running as the guest user, it fails to get the openbox window display. I have verified that in the openbox window, $DISPLAY is set to ":0".

I am guessing there is some other factors at play, that its not just the display I need to set, but maybe the window manager, or gui client, or something like that.

Supervisor config file:

[program:chromium]
environment = DISPLAY=":0"
command = chromium-browser --kiosk
startsecs=6
user=guest
stderr_logfile=/var/log/supervisor/chromium_stderr.log
stdout_logfile=/var/log/supervisor/chromium_stdout.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=3

Since it is running as user guest it has virtually no little permissions. I checked the supervisor error log for the chromium app, and it was failing to open /var/log/Xorg.1.log, so I chmod 777 it (its stays at 0 bytes as does not grow), now getting:

xauth: timeout in locking authority file /.Xauthority

Score:0
pl flag

In Ubuntu 20.04 you do not need Supervisord to make sure a program is restarted. You can use Systemd to restart a failed daemon. Maybe you should try this approach.

[Service]
Restart=on-failure
RestartSec=10s

As far as I understand when you get errors like this:

 timeout in locking authority file /.Xauthority

It means this file is locked by other app. To remove the lock I think you can use the -b option but I am not sure. Another solution would be to just remove it...

Also try configuring the logs to /tmp for /var/log/Xorg.1.log maybe your app does not have permissions on /var/log but I have my doubts ...

Just my 2 cents...

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.