<div dir="auto"><div>Thank you Ben.</div><div dir="auto"><br></div><div dir="auto">I guess it's safer to save settings as they change instead.</div><div dir="auto"><br>Many thanks</div><div dir="auto">BruceS</div><div dir="auto"><br></div><div dir="auto"><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Mon, 4 Oct 2021, 20:38 Benoît Minisini, <<a href="mailto:g4mba5@gmail.com">g4mba5@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Le 03/10/2021 Ã  12:59, Bruce Steers a Ã©crit :<br>
> <br>
> I have a program that starts with my system and runs in the background.<br>
> <br>
> It has icons i can move and on exit it saves the positions.<br>
> <br>
> I have noticed if i do not exit the program but shutdown the computer <br>
> the settings do not save.<br>
> <br>
> Of course i could just save the settings on moving icons but i wondered <br>
> if there is a recommended method to catch an application exit due to a <br>
> shutdown?<br>
> Does the system just kill the program?<br>
> <br>
> I guessed DBus would probably be the best alternative way but wouldn't <br>
> hurt to ask the experts if there is already an easier way.<br>
> <br>
> Thanks for any advice :)<br>
> <br>
> BruceS<br>
> <br>
<br>
QT4, QT5 and GTK+2 components handle the "X11 session management protocol".<br>
<br>
<a href="https://www.x.org/releases/X11R7.7/doc/libSM/xsmp.html" rel="noreferrer noreferrer" target="_blank">https://www.x.org/releases/X11R7.7/doc/libSM/xsmp.html</a><br>
<br>
To handle it with Gambas, you just have to define the <br>
Application.Restart property with a string array that defines the <br>
command that will be run to automatically restart your application the <br>
next time the desktop starts again.<br>
<br>
When the desktop shutdowns, it is supposed to gracefully close the <br>
windows of your application, so that you can cancel the shutdown. If you <br>
do nothing, your application will be closed gracefully. It will be <br>
killed only if it does not answer to the window close events.<br>
<br>
GTK+3 component does not support that protocol (hey, it's a modern <br>
toolkit!), and I don't think there is the equivalent on Wayland, but I <br>
may be wrong. I need more information about that.<br>
<br>
Regards,<br>
<br>
-- <br>
Benoît Minisini<br><br>
</blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br></blockquote></div></div></div>