Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2020-12

Losing desktop when restarting Lazarus - where are desktop settings saved?

12 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bo Berglund

Now it happened again!
I closed Lazarus on a Raspberry Pi4 accessed via VNC. Then I started it again and now only the code editor window appears, all other windows for my desktop have disappeared!!! :(

Question:
---------
In which file is the desktop settings saved?
I need to restore that file so I don't have to frequently start over with a botched Lazarus desktop and reconfigure it as I like.

Note that the editor settings seem OK, at least by my custom color scheme, which is present in the single window that now appears.

I did copy all of the *files* in ~/.lazarus_2.0.8 into archive settings_20201221.tgz in a backup subdirectory on Dec 21, but I do not know in which file Lazarus stores the desktop settings so I can restore that file.

At the time I had saved the custom desktop by a name but that is no longer available when I look at "Tools/Desktops.../Manage Desktops".

Lazarus 2.0.8 / Fpc 3.0.4 on Raspberry Pi4 (4GB RAM)

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Jean SUZINEAU
Jean SUZINEAU wrote
I guess this settings are saved in the .lps file of your project. In my own lps files, I can find the units opened in the code editor, my debug watches ...

I think I stated that the code editor is the *only window* that is now visible and it contains the units I had open when I closed the project.
All of that is present, but EVERYTHING ELSE I had set up is gone!

I was told earlier that the window arrangement (project options, object inspector, code explorer, messages etc, etc) would be saved and possible to return to if one saved the desktop under a name other than default.

One can have several such desktops to choose from (optimized for GUI app development or console app etc).

And the desktops are not tied to the projects, they are a Lazarus configuration like the color scheme of the source editor etc. So I assume the only related item that would be found in the project lps file should be the *name* of the desktop to use.

So I saved my configured environment under such a name and it was returned when I closed and then opened my project until yesterday when it no longer was....

I want to restore it from my backup of Lazarus settings but I don't know where Lazarus saves this information...

And I woud like to know *why* Lazarus loses this information, it is not the first time it happened...

In fact I just opened a related Lazarus project (the client) on my Windows 10 PC where I run the same 2.0.8/3.0.4 version of Lazarus. Ant it too had lost its desktop settings and is now only displaying the code editor, no other window visible!!!!!

Next I started Lazarus 2.0.10 on Windows 10 to check if that too has lost the desktops, but in that case it has not!

Is this a known bug in Lazarus 2.0.8?

For example if the IDE is open across midnight and then closed does it lose its desktop configuration? I have used both of the 2.0.8 Lazarus (Windows and Raspberry) yesterday and I made sure to close them before I want to bed since my PC would run a weekly backup overnight (not so on the RPi).
So both were active at midnight but closed a bit later. But my 2.0.10 Lazarus was *not* running, last time I used that was yesterday morning.

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Bo Berglund
Bo Berglund wrote
I want to restore it from my backup of Lazarus settings but I don't know where Lazarus saves this information...

So I searched in the config files that had changed the last day and found environmentsoptions.xml contains a section for Desktop entries. So I could restore that file from my backup made back in October and now the Lazarus desktop operates properly again on Raspberry.

And I would like to know *why* Lazarus loses this information, it is not the first time it happened...

Still what I need to know to understand what I should not do with Lazarus since this has happened way to many times now.

On Windows I restored from the weekly backup made Dec 21st and got that back too. When I did so I noticed that the timestamp of the file (modification) was from October even though the backup is from Dec 21st.

But on both of my Lazarus 2.0.8 installs (Windows and Raspberry) the timestamp had been set to today on the broken file, so obviously the environment file was rewritten in the last 24 hours for some strange reason on both Windows and Raspberry and losing the desktop settings at that time.

WHY?

THe only item I have changed recently on both of the installations is the number of recent projects to show in the list from the default 5 to 10.
I believe I have modified that on both Windows and Raspberry possibly causing a rewrite of the environment file (and then losing the desktops).

I have both the broken and the backed up file available if someone is able to use that to decode what could have happened...

Bo Berglund Developer in Sweden

Reply by email

Bo Berglund
to Mattias Gaertner
Mattias Gaertner wrote 11 lines
On Sun, 27 Dec 2020 09:12:20 +0100 Bo Berglund via lazarus wrote: >[...] > And I woud like to know *why* Lazarus loses this information, it is > not the first time it happened... Maybe your windows are on another screen. Try in menu Window / Center a lost window / ... Mattias

Well, restoring the environmentoptions.xml from my most recent backup on both the Win10 and RPi4 systems gave me back my desktop with all of the expected windows and placements.

Note that when I discovered this problem there was a smaller file dated "just now" in the pcp directory and it contained no trace of the desktop I used.
So the environment file had for some reason been rewritten with a default content on *both* of my separate systems at the same basic time....
Very strange.

And restoring from the last backup which held older files than the backup date fixed the problem....

So now I have scripted the backup of the config dir so it is easier to make a backup (on the RPi4).

Bo Berglund Developer in Sweden

Reply by email

Mattias Gaertner
to Bo Berglund
[...] Note that when I discovered this problem there was a smaller file dated "just now" in the pcp directory and it contained no trace of the desktop I used.

When the IDE starts, and there is no environmentoptions.xml file it copies it from the secondary config directory. Maybe you are seeing that?

When there is no desktop in the environmentoptions.xml the IDE should show the default layout.

Mattias

Reply by email

Unknown author
to Mattias Gaertner
Mattias Gaertner wrote
When the IDE starts, and there is no environmentoptions.xml file it copies it from the secondary config directory. Maybe you are seeing that?

i think one of the main questions is "how does that file come up missing on a long time working installation in the first place?" especially since Laz is the only thing to touch it...

NOTE: No off-list assistance is given without prior approval. *Please keep mailing list traffic on the list where it belongs!*

Reply by email

Mattias Gaertner
to Unknown author
Show quoted text 8 lines
On 12/27/20 5:15 PM, Mattias Gaertner via lazarus wrote: > When the IDE starts, and there is no environmentoptions.xml file it > copies it from the secondary config directory. Maybe you are seeing > that? i think one of the main questions is "how does that file come up missing on a long time working installation in the first place?" especially since Laz is the only thing to touch it...

Was the file missing, or only the desktop node?

Mattias

Reply by email

Bo Berglund
to Mattias Gaertner
Mattias Gaertner wrote 7 lines
On Sun, 27 Dec 2020 18:58:58 -0500 wkitty42--- via lazarus wrote: > On 12/27/20 5:15 PM, Mattias Gaertner via lazarus wrote: > > When the IDE starts, and there is no environmentoptions.xml file it > > copies it from the secondary config directory. Maybe you are seeing > > that?

Where is this "secondary config dir" located?
I did not know it exists...

Show quoted text 6 lines
> i think one of the main questions is "how does that file come up > missing on a long time working installation in the first place?" > especially since Laz is the only thing to touch it... Was the file missing, or only the desktop node?

Impossible to know since I do not look in the config dir every time before starting Lazarus...

The file had changed its date from an earlier time (months ago) to the current time, and there was no sign of any custom desktop settings in it.

The only thing I think is in common between these instances, which happened on both Windows and Linux, is that I have used the Tools/Options to increase the count for recent projects from the default 5 to 10. I always seem to get a project I want to open disappear from that list when it only holds 5 recent projects.

I believe I did so on both Lazarus installations.

So what does Lazarus do when one changes this value? Does it rewrite the environment file based on the default or what? I made a test to check this (since using the backup file brought back the 5 files limit):
It seems like it rewrites the environment fiile by changing the 5 to 10 but also by changing the sequence of some xml nodes...

But it does not visibly affect the way Lazarus looks when starting up again.

Bo Berglund Developer in Sweden

Reply by email

Mattias Gaertner
to Bo Berglund
Show quoted text 12 lines
On Mon, 28 Dec 2020 01:35:54 +0100, Mattias Gaertner via lazarus wrote: >On Sun, 27 Dec 2020 18:58:58 -0500 >wkitty42--- via lazarus wrote: > >> On 12/27/20 5:15 PM, Mattias Gaertner via lazarus wrote: >> > When the IDE starts, and there is no environmentoptions.xml file >> > it copies it from the secondary config directory. Maybe you are >> > seeing that? Where is this "secondary config dir" located?

See
View - IDE Internals - About IDE

Show quoted text 6 lines
[...] The only thing I think is in common between these instances, which happened on both Windows and Linux, is that I have used the Tools/Options to increase the count for recent projects from the default 5 to 10. I always seem to get a project I want to open disappear from that list when it only holds 5 recent projects.

Same here. I have 30,30.
This is unrelated with the desktop issue.
The env file is written pretty often.

Show quoted text 8 lines
[...] I believe I did so on both Lazarus installations. So what does Lazarus do when one changes this value? Does it rewrite the environment file based on the default or what? I made a test to check this (since using the backup file brought back the 5 files limit): It seems like it rewrites the environment fiile by changing the 5 to 10 but also by changing the sequence of some xml nodes...

If your backup is months old, then maybe some functions in the IDE changed, changing the order.

But it does not visibly affect the way Lazarus looks when starting up again.

Restart lazarus making sure the config is working. Make a backup of environmentoptions.xml.
When the next time it happens, send the backup and the current version.

Mattias

Reply by email