Remember main window position?

Is there a way for ImGui to remember the position/size of the main window in the .ini file, the same way it does for its own windows?

(I understand that I am the one who in fact creates the main window, but is it possible for me to call ImGui’s functions to query that position before I create it?)

Hello Richard,

Sorry it’s not possible at the moment, though I understand it would be useful convenience.

Technically you can add stuff to the .ini file via the internal api (adding a ImGuiSettingsHandler to g.SettingsHandlers but it’s not really a one-liner trivial thing to do from the user point of view. I think it may be useful if someone wrote a simple key<>value API mapped to a custom section of the .ini file.

An easy workaround right now would be to call ImGuiWindowSettings* settings = ImGui::FindOrCreateWindowSettings() (declared in imgui_internal.h in the latest master, very coincidentally I just added this helper in there in master branch, but it’s been there for a while in docking branch) with a name you know isn’t colliding with any imgui window, and calling/filling the data again on exit. Bit fugly but it should work.

(You may post this sort of question on the GitHub issue tracker).

1 Like