@@ -106,6 +106,26 @@ def __init__(self, parent=None):
106106 self .__on_show_startup_window_changed
107107 )
108108
109+ # 自动保存窗口大小设置
110+ self .auto_save_window_size_switch = SwitchButton ()
111+ self .auto_save_window_size_switch .setOffText (
112+ get_content_switchbutton_name_async (
113+ "basic_settings" , "auto_save_window_size" , "disable"
114+ )
115+ )
116+ self .auto_save_window_size_switch .setOnText (
117+ get_content_switchbutton_name_async (
118+ "basic_settings" , "auto_save_window_size" , "enable"
119+ )
120+ )
121+ _auto_save = readme_settings_async ("basic_settings" , "auto_save_window_size" )
122+ self .auto_save_window_size_switch .setChecked (
123+ True if _auto_save is None else _auto_save
124+ )
125+ self .auto_save_window_size_switch .checkedChanged .connect (
126+ self .__on_auto_save_window_size_changed
127+ )
128+
109129 # 后台驻留设置
110130 self .resident_switch = SwitchButton ()
111131 self .resident_switch .setOffText (
@@ -156,6 +176,12 @@ def __init__(self, parent=None):
156176 get_content_description_async ("basic_settings" , "show_startup_window" ),
157177 self .show_startup_window_switch ,
158178 )
179+ self .addGroup (
180+ get_theme_icon ("ic_fluent_save_20_filled" ),
181+ get_content_name_async ("basic_settings" , "auto_save_window_size" ),
182+ get_content_description_async ("basic_settings" , "auto_save_window_size" ),
183+ self .auto_save_window_size_switch ,
184+ )
159185 self .addGroup (
160186 get_theme_icon ("ic_fluent_resize_20_filled" ),
161187 get_content_name_async ("basic_settings" , "background_resident" ),
@@ -261,6 +287,31 @@ def __on_resident_changed(self, checked):
261287 parent = self .window (),
262288 )
263289
290+ def __on_auto_save_window_size_changed (self , checked ):
291+ update_settings ("basic_settings" , "auto_save_window_size" , checked )
292+ if checked :
293+ show_notification (
294+ NotificationType .SUCCESS ,
295+ NotificationConfig (
296+ title = get_content_name_async (
297+ "basic_settings" , "auto_save_window_size"
298+ ),
299+ content = "已开启自动保存窗口大小" ,
300+ ),
301+ parent = self .window (),
302+ )
303+ else :
304+ show_notification (
305+ NotificationType .INFO ,
306+ NotificationConfig (
307+ title = get_content_name_async (
308+ "basic_settings" , "auto_save_window_size"
309+ ),
310+ content = "已关闭自动保存窗口大小" ,
311+ ),
312+ parent = self .window (),
313+ )
314+
264315 def __on_url_protocol_changed (self , checked ):
265316 """URL协议开关变化处理"""
266317 # 临时断开信号连接,避免递归
0 commit comments