@@ -157,10 +157,11 @@ def __init__(
157
157
init_timer = QTimer (self )
158
158
init_timer .setSingleShot (True )
159
159
init_timer .timeout .connect (self .setup_client )# pyright: ignore [reportUnknownMemberType]
160
- init_timer .start (3000 )
160
+ init_timer .start (5000 )
161
161
162
162
def setup_client (self ):
163
163
"""Setup the tray monitor client and connect signals"""
164
+ self .load_state ()
164
165
client = SystrayWidget .get_client_instance ()
165
166
client .icon_modified .connect (self .on_icon_modified )# pyright: ignore [reportUnknownMemberType]
166
167
client .icon_deleted .connect (self .on_icon_deleted )# pyright: ignore [reportUnknownMemberType]
@@ -176,8 +177,6 @@ def setup_client(self):
176
177
def showEvent (self ,a0 :QShowEvent | None )-> None :
177
178
"""Called when the widget is shown on the screen"""
178
179
super ().showEvent (a0 )
179
- self .get_screen_id ()
180
- self .load_state ()
181
180
self .unpinned_vis_btn .setChecked (self .show_unpinned )
182
181
self .unpinned_vis_btn .setText (self .label_expanded if self .show_unpinned else self .label_collapsed )
183
182
self .unpinned_widget .setVisible (self .show_unpinned )
@@ -401,7 +400,7 @@ def update_current_state(self):
401
400
is_pinned = w .is_pinned ,
402
401
index = index ,
403
402
)
404
- self .current_state = widgets_state
403
+ self .current_state | =widgets_state
405
404
406
405
def save_state (self ):
407
406
"""Save the current icon position and pinned state to disk."""
@@ -410,6 +409,7 @@ def save_state(self):
410
409
if not LOCALDATA_FOLDER .exists ():
411
410
LOCALDATA_FOLDER .mkdir (parents = True ,exist_ok = True )
412
411
412
+ self .get_screen_id ()
413
413
file_path = LOCALDATA_FOLDER / Path (f"systray_state_{ self .screen_id } .json" )
414
414
logger .debug (f"Saving state to{ file_path } " )
415
415
saved_state :dict [str ,Any ]= {}
@@ -427,7 +427,7 @@ def save_state(self):
427
427
428
428
def load_state (self ):
429
429
"""Load the saved icon position and pinned state from disk."""
430
- logger . debug ( "Loading state from disk" )
430
+ self . get_screen_id ( )
431
431
file_path = LOCALDATA_FOLDER / Path (f"systray_state_{ self .screen_id } .json" )
432
432
logger .debug (f"Loading state from{ file_path } " )
433
433
self .current_state = {}