I have written a program generating a simple tray icon using cl-cffi-gtk and Common Lisp called tray-icon.lisp which is defined in a ASDF system called hourly-player. My problem is now that while this app starts fine from the command line, starting it from a script turns out to be a bit more difficult. If I try
sbcl --eval '(asdf:load-system "hourly-player")' --eval '(hourly-player:run)'
my application is correctly loaded into the SBCL REPL and the tray icon displays correctly. However if I add a & to launch my script in the background it seems to immediately terminate.
Adding a (loop) at the end of my run function keeps the script from terminating but obviously also occupies my CPU a lot more than would be necessary for such a app (roughly 12% load according to conky compared to basically nothing when running in sbcl).
Is there some canonical way to keep my script alive as a background process?
I'm also aware that there are other ways of executing a lisp programm but they either share the same problem (e.g. core dumps) or seem to break my system definitions dependencies (at least buildapp and cl-launch seem to do so).
If it helps, my project can be found here.