Improved system tray icon logic