@@ -59,9 +59,21 @@ func load_window_data(window:PankuLynxWindow):
5959 window .set_window_visibility (load_module_data ("window_visibility" , false ))
6060
6161func save_window_data (window :PankuLynxWindow ):
62+ _save_window_geometry (window )
63+ save_module_data ("window_visibility" , window .visible )
64+
65+
66+ func _save_window_geometry (window :PankuLynxWindow ):
6267 save_module_data ("window_position" , window .position )
6368 save_module_data ("window_size" , window .get_normal_window_size ())
64- save_module_data ("window_visibility" , window .visible )
69+
70+
71+ # Add hook to window to auto save its geometry on close.
72+ func add_auto_save_hook (window : PankuLynxWindow ) -> void :
73+ # Here some global settings check can be implemented,
74+ # if we decide to make "save on close" feature optional
75+ window .window_closed .connect (_save_window_geometry .bind (window ))
76+
6577
6678func get_module_env () -> RefCounted :
6779 return _env
@@ -73,7 +85,7 @@ func _init_module():
7385 var module_script_dir :String = get_script ().resource_path .get_base_dir ()
7486 var env_script_path = module_script_dir + "/env.gd"
7587 var opt_script_path = module_script_dir + "/opt.gd"
76-
88+
7789 if FileAccess .file_exists (env_script_path ):
7890 _env = load (env_script_path ).new ()
7991 _env ._module = self
0 commit comments