0

I am currently network booting a Raspberry Pi and using Openbox I autostart chromium, is it possible that if a user presses close or minimise I can programatically restart chromium in the background?

danfs
  • 83
  • 9

1 Answers1

2

You can use a shell command to restart the command as soon as it finishes.

Assuming your openbox config for autostarting stuff lets you put in shell snippets you can use

while true; do
  chromium
done

If you have to specify just one command in your openbox config you can wrap that in a string to hand to sh:

sh -c 'while true; do chromium; done'

Or you could put it in a script and make that executable (chmod +x my-script-file.sh):

#!/bin/sh
while true; do
  chromium
done

and then tell openbox to autostart the my-script-file.sh.

Lucas
  • 685
  • 4
  • 19
  • This works perfectly when Chromium is closed, is possible to do something similar when it has been minimised? – danfs Oct 19 '20 at 15:04
  • @danfs sorry I don't know. You can have a look at the docs of [`xdotool`](https://www.semicomplete.com/projects/xdotool/) and write a script with that. But you should ask a new question about that. Your specific question from the top seems to be answered then. – Lucas Oct 19 '20 at 17:45