Added a right-click tray menu and refactored the tray icon logic