Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for OS system tray to allow closing/minimizing exported projects to the tray #2349

Open
gabrielborgesweb opened this issue Feb 25, 2021 · 25 comments

Comments

@gabrielborgesweb
Copy link

gabrielborgesweb commented Feb 25, 2021

Run exported as system tray, with (or without) script.

Describe the project you are working on

Well, I was thinking about my future project, where it will be a multiplayer game and along with the game there will be advanced systems like native auto-update and out-of-game notifications ("Match Found!", for example).

Describe the problem or limitation you are having in your project

But, one of those features have a engine limitation for now. This feature is out-of-game notifications. It needs to be another .EXE and running as System Tray.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

It would be nice, when exporting the project for Windows, MacOS or Linux, an option that runs the program on the System Tray and define some functions if the user opens the Context Menu on the icon.
With that, we can make some popups using custom GUI. (Concept below)
image

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

Concepts:

godotSystemTray

The operation will be as follows: There will be a PoolStringArray to be able to define functions in the Context Menu.
godotSystemTrayExport
Syntax: (OPTION_TITLE : String, GDSCRIPT : String)

If this enhancement will not be used often, can it be worked around with a few lines of script?

If by any chance, this cannot be done visually on Export window, you can use the following GDScript commands:
OS.on_system_tray(true);
OS.system_tray_context(INDEX : int, OPTION_TITLE : String, GDSCRIPT : String)

Is there a reason why this should be core and not an add-on in the asset library?

Well, from what I know about programming, unfortunately that will not be possible as a plugin/add-on in the Asset Library, for perhaps being very complex.

@YuriSizov

This comment has been minimized.

@gabrielborgesweb

This comment has been minimized.

@Calinou
Copy link
Member

Calinou commented Feb 25, 2021

As this feature's implementation is highly OS-specific and not relevant to most games, I would recommend you to use a third-party utility like RBTray instead. It lets you minimize any application to the system tray by right-clicking the Minimize button.

Also, automatic updates and matchmaking features are generally better provided by third-party services such as Steam and itch.io.

@Calinou Calinou changed the title System Tray Add support for OS system tray to allow closing/minimizing exported projects to the tray Feb 25, 2021
@YuriSizov

This comment has been minimized.

@gabrielborgesweb

This comment has been minimized.

@jespereggers
Copy link

any updates on this? This is not "unimportant to most games" but incredibly relevant to many devs out there. No matter if it's for games or not (Godot isn't just good for making games btw)

@jespereggers
Copy link

  • Engines like Unity, UE, CryEngine & GameMaker support notifications as well...

@Calinou
Copy link
Member

Calinou commented Apr 25, 2021

any updates on this? This is not "unimportant to most games" but incredibly relevant to many devs out there. No matter if it's for games or not (Godot isn't just good for making games btw)

As far as I know, nobody has started working on this feature yet. This proposal hasn't received much support, so it may not be implemented at all in core. However, it's always feasible for a skilled developer to implement this in a fork of Godot, for those who really need it.

  • Engines like Unity, UE, CryEngine & GameMaker support notifications as well...

Sending desktop notifications is covered by #1338. That proposal has received more support because it's more wildly applicable – games might actually need to send desktop notifications from time to time.

PS: Please use the Edit button (hidden behind the icon at the top-right corner of your comments) instead of multi-posting.

@CsloudX
Copy link

CsloudX commented May 20, 2021

I like this feature too, and I wish I can hide taskbar icon, like DesktopPet App.
Or OS-specific plugins, implement common useful features.

@shrewdlogarithm
Copy link

I'll add my 10p to this - I've recently found myself using Godot to create simple GUI apps and they would benefit from being 'Minimize to Tray' capable

It's also not a 100% Windows thing - when I previously used nwjs it supported this concept on MacOS and some Linux Desktops too - docs here if anyone's interested

https://docs.nwjs.io/en/latest/References/Tray/

@Bauxitedev
Copy link

If you're using godot-rust you can use this crate to make a tray icon on Win/Mac/Linux: https://github.com/olback/tray-item-rs

@shrewdlogarithm
Copy link

If you're using godot-rust you can use this crate to make a tray icon on Win/Mac/Linux: https://github.com/olback/tray-item-rs

Thats interesting and useful to know - thanks!

@fire
Copy link
Member

fire commented Aug 22, 2022

https://github.com/dmikushin/tray Found a single header, super tiny C99 implementation of a system tray icon with a popup menu.on Github.

Edited:
Changed link to the fork.

@Calinou
Copy link
Member

Calinou commented Aug 22, 2022

zserge/tray Found a single header, super tiny C99 implementation of a system tray icon with a popup menu.on Github.

The upstream repository doesn't appear to be actively maintained, so I'd recommend using the fork instead.

@maxeonyx
Copy link

I'm interested in using this feature for my multiplayer game, for which I've made a separate "dedicated server" GUI scene export, which is something that will tend to run in the background.

@BadCoyoteStudios
Copy link

I'm writing an app right now that could use this functionality. If Godot is going to be used for applications or advanced games, functionality like this will really help. In the meantime, I may have to move to MAUI.

@FeralBytes
Copy link

It would be nice if this tiny library could be included in core: https://github.com/dmikushin/tray and can @Calinou as a contributor to RBTray, can you confirm that is a Windows specific tool? I am hoping to create minimize to tray functionality for a parental tool/Firewall manager on my children's Linux systems.

@Calinou
Copy link
Member

Calinou commented Jan 13, 2023

and can @Calinou as a contributor to RBTray, can you confirm that is a Windows specific tool?

RBTray is Windows-only, but it's likely feasible to create an alternative that works on macOS and Linux too.

@OsakiTsukiko
Copy link

this would also be very useful for making launchers for games using godot, once the main game launches the launcher can go to tray and maybe have the ability to add a few options to it like quit, stop, etc

@Lance-Starkie
Copy link

Yeah, I've got this same issue, for a project I'm working on, would be very nice for a window manager, as playing hot potato whenever the main window gets closed seems like a nightmare to implement. Being able to just retire it to the taskbar is a really nice clean solution there.

@foxp552

This comment was marked as off-topic.

@Calinou
Copy link
Member

Calinou commented Aug 14, 2024

@foxp552 Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead.

Also, if I'm reading the documentation right, this is already implemented in 4.3 on Windows and macOS, but not on Linux. You'll need to use a StatusIndicator node (e.g. as the root node of an autoloaded scene) and a native menu that can be a PopupMenu child with prefer_native_menu set to true. Make sure to assign the PopupMenu node in the StatusIndicator's popup property afterwards, and it should appear when clicking the tray icon.

I'll look into expanding the Operating System Testing demo to add an example.

Adding Linux support will prove challenging, as the pull request says:

  • Linux (org.freedesktop.StatusNotifierItem/org.kde.StatusNotifierItem on D-BUS) Interface seems to be tied to specific GUI kit menus and external icon resources, so will keep it Windows/macOS only for now.

(Godot does not link against GTK, Qt or any other GUI toolkit.)

@foxp552
Copy link

foxp552 commented Aug 15, 2024

@Calinou
Yes sir |(0_0)
By the way im still new to these staff

@unfa
Copy link

unfa commented Aug 21, 2024

Ok, I love that this works, even if not on Linux (yet).
I wish there was a way to make the application skip taskbar when a status indicator is present.
I am making a productivity application that is supposed to be always on-screen, and having it occupy the taskbar is unnecessary clutter - keeping it to the status icon only would be preferable.
Do you consider that a related feature?

@Calinou
Copy link
Member

Calinou commented Aug 21, 2024

I am making a productivity application that is supposed to be always on-screen, and having it occupy the taskbar is unnecessary clutter - keeping it to the status icon only would be preferable.
Do you consider that a related feature?

There's a proposal tracking this: #8467

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests