flet icon indicating copy to clipboard operation
flet copied to clipboard

[Feature Request] system tray icon component

Open InfernalAzazel opened this issue 2 years ago • 3 comments

Please Describe The Problem To Be Solved flet no a system tray icon component

(Optional): Suggest A Solution

(Replace This Text: A concise description of your preferred solution. Things to address include:

  • Details of the technical implementation, e.g. Flutter widget solving the problem.
  • Tradeoffs made in design decisions
  • Caveats and considerations for the future

If there are multiple solutions, please present each one separately. Save comparisons for the very end.)

InfernalAzazel avatar Jan 30 '23 05:01 InfernalAzazel

https://github.com/ndonkoHenri/Flet-as-System-Tray-Icon

ndonkoHenri avatar Jan 30 '23 14:01 ndonkoHenri

hi, I've seen this before, it's not easy to customize, that is, it's the same as the flet gui menu.

tray_icon = pystray.Icon(
    name="Test",
    icon=tray_image,
    title="Flet in tray",
    menu=pystray.Menu(
        pystray.MenuItem(
            "Open App",
            default_item_clicked,  # alternative/broader callback: menu_item_clicked
            default=True  # set as default menu item
        ),
        pystray.MenuItem(
            "Go Nowhere 1",
            other_item_clicked  # alternative/broader callback: menu_item_clicked
        ),
        pystray.MenuItem(
            "Go Nowhere 2",
            other_item_clicked  # alternative/broader callback: menu_item_clicked
        ),
        pystray.MenuItem(
            "Close App",
            exit_app  # alternative/broader callback: menu_item_clicked
        )
    ),
    visible=False,
)

InfernalAzazel avatar Jan 31 '23 01:01 InfernalAzazel

I was about to create a new issue and saw this one. The described approach using pystray doesn't work completely in Linux (Ubuntu 22.04).

pystray does not support menu items in Linux. There is also an issue where it's not possible to hide the window. In other operating systems, it's possible to minimize the window and skip the taskbar, but the skip taskbar feature doesn't work in Linux.

There are the tray_manager and window_manager Flutter plugins that allow properly handling tray icons and hiding/showing windows for all major desktop platforms.

Is it possible to include those features in Flet?

cccaballero avatar Apr 15 '24 09:04 cccaballero