Flutter Desktop - System tray implementation

6.5k views Asked by At

I am new to flutter i am struggling to create a system tray implementation.

What i need is:

  1. Create a tray icon for my application.
  2. Be able to hide and show the application window through the tray icon right click menu.
  3. Be able to add options to tray icon right click menu, like open screen X.
  4. Be able to start and stop some process, and change the tray icon on real time (see image below).

enter image description here

Can someone guide me ? :D

P.S.: My application will run on Windows, Linux and MacOS.

Thanks all!

2

There are 2 answers

0
SvenDowideit On

There seem to be a couple of pointers at https://github.com/go-flutter-desktop/go-flutter/issues/185

related to the go based https://github.com/shurcooL/trayhost

0
Pablo Insua On

As of October 2021, there is no official support in Flutter for working with the System Tray, but there are a number of libraries that can help you:

  • Tray Manager (link)
  • System Tray (link)

Both of them are compatible with desktop apps on Windows, Mac & Linux (in Linux you have to do some extra configuration process, and actually I'm struggling to make it works in Debian Linux with KDE).

Both also gives you the option to edit the icon and to add the options menu.


To hide and show the application window, again there is no official support by Flutter, but again there is one library that can help you: Window Manager (link).


And finally, in your last point, you ask for "Be able to start and stop some process". Here you don't need an external library, because you have a very useful class in dart:io, that is Process (link)