[Gambas-user] Automatic Startup

Bruce Steers bsteers4 at gmail.com
Fri Nov 4 14:44:28 CET 2022

On Thu, 3 Nov 2022 at 22:53, gian via User <user at lists.gambas-basic.org>

> Hi Benoit,
> my wife wanted to have on her desktop, a clock (type alarm clock), as
> simple as the one she has on her nightstand, but nice as an day-date
> clock, with the moon phase, and that started automatically with the
> Linux session.
> On the Farm named mdDDclock (moon phase Day Date clock) is the result of
> my work.
> It can only work if the Gambas IDE is installed (it have to run an
> executable).
> Is there any way to create a project that starts automatically without
> having to install the IDE ?
> Thank you and regards

So to summarize...
to compile without the IDE you need gbc3 and gba3 and to pass some possibly
vital arguments like -fpublic-control -fpublic-module so application works.
try gbc3 --help gba3 --help to see options.

To Auto-start you just need a .desktop launching icon to reside in
$HOME/.kde/Autostart/ (for kde) or $HOME/.config/autostart/ for others (i
know of)

Auto-start may require a delay to ensure the desktop/toolkits/system
tray/etc have loaded properly before the gambas application starts
I use these settings in the .desktop file...

sometimes even the delay didn't work and the application was not able to
detect a system tray before loading so i also added an option to wait for
the tray with this code...

 UseTray = False
 $bHasTray = Desktop.HasSystemTray
  $bWaitForTray = Settings["WaitForTray", False]
  If $bWaitForTray And If Not $bHasTray Then
    For c As Integer = 1 To 60
      Wait 1
      fList.Retries = c
      $bHasTray = Desktop.HasSystemTray
      If $bHasTray Then Break
    Message("System tray did not load")

  If $bHasTray Then UseTray = Settings["UseSysTray", True]

that checks every second for up to 60 seconds if the SysTray has loaded.

Hope that all makes sense :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221104/445e2fed/attachment.htm>

More information about the User mailing list