[Lazarus] Running an app on boot

Marc Santhoff M.Santhoff at web.de
Wed Jan 25 19:46:28 CET 2017


On Mi, 2017-01-25 at 02:40 -0800, Ed Murashie via Lazarus wrote:
> I wrote a simple Lazarus program that displays a window and a button and did
> the same thing using Glade which also uses Gtk+.
> 
> I am using a Beaglebone Black with the latest stock Debian Jessie image
> which start a LxQt desktop program after it boots up.
> 
> When I run my program in the LxQt window or in a terminal window, it runs
> fine.
> 
> Now I want my Lazarus or Glade/Gtk program to run when I boot and not see
> the LxQt desktop program.
> 
> I have tried using the Crontab with @reboot command method and the create a
> .service and use systemctl to register and start it.
> 
> No matter what I try I get " Gtk-WARNING **: cannot open display: ".  This
> also happen on a Beaglebone Green and happens when I use Wheezy or Jessie.

That depends on what you want to achive. Ich you want to make a POS like
device that is only showing your program and no window manager menu,
task launchers or the like you could do:

Edit the file ".xinitrc" in the standard users home directory.
There is one line starting with a programm name only, should be sth.
like "lxqt" in your case.
Replace that line with the name of your programm to run. Disable any
unwanted background programs by commenting them out with a '#' in front
or deleteing that line(s).

Before that you should prepare your program to run full screen by
setting the size of the main screen to exactly matching the dipslay
size, e.g. for a vga display you use 640 for the width and 480 for the
hight. You could additionally block each movement of the main window.

That way you have a one program only device. If you end it, X, the gui
system, is shut down. There may be other things to watch and handle,
maybe you need to make the cursor invisible or force the main window to
stay on top. Or you may want to add a "shutdown -ph" or similar directly
after your program in ".xinitrc" so the os of the device shuts down if
the user end your program.

HTH,
Marc




More information about the Lazarus mailing list