Search code examples
nsis

System tray Icon is not displaying after restart/logoff using NSIS


When I installed the application using NSIS it is showing the Notification Icon (System tray Icon). But once restart/logoff the icon is disappearing in the system tray.

While installing I am calling the "test.exe" that has the system tray functionality in the "Section". To display the system tray functionality even after restart/logoff, Do we need to add this functionality in any other place?

Below is my existing code that is displaying the system tray once installation has completed:

!insertmacro MUI_LANGUAGE "English" 

Solution

  • Notification icons (system tray icons) only exist while their application is running. If you want the icon to persist after a reboot then you must arrange for the application to start when the user logs in.

    You can add a value to the run key:

    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Run" "MyApplication" '"$InstDir\MyApp.exe"' ; Can also be created in HKCU
    

    or a startup shortcut:

    CreateShortcut "$SMStartup\MyApp.lnk" "$InstDir\MyApp.exe"