DEV Community

daanchuk
daanchuk

Posted on

How to Create a Tray-Only Tauri App

  1. Start with a Tauri app boilerplate. You can use the following command to create one: npm create tauri-app@latest

  2. Add a tray bar icon to your Tauri app:

    • Open the tauri.conf.json file.
    • Locate the "tauri" property.
    • Inside it, add a "systemTray" object, as shown below:
   {
     "tauri": {
       "systemTray": {
         "iconPath": "icons/icon.png",
         "iconAsTemplate": true
       }
     }
   }
Enter fullscreen mode Exit fullscreen mode

Ensure that you provide the correct path to your tray icon image file.

  1. Configure Tauri to not display any window:
    • In the same tauri.conf.json file, find the "build" property.
    • Inside it, locate the "windows" property and set it to an empty array, like this:
   {
     "build": {
       "windows": []
     }
   }
Enter fullscreen mode Exit fullscreen mode

By following these steps, you will be able to create a tray-only Tauri app with the specified tray bar icon and without any visible windows. Feel free to adjust the configuration based on your specific requirements.

Remember to run the necessary commands and build the app according to the Tauri documentation after making these changes.

Top comments (0)