-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Hide the icon in taskbar on Windows or hide the icon in Dockbar on Mac #3156
Comments
It seems like there is more to a "sys tray app" than just not closing when there are no windows... |
I second this requirement. At least on macOS it is quite usual that users want to have a systray entry, but only if they can as well decide to hide the app from the dock. Thank you for consideration. |
Perhaps I have misunderstood, but you can create a windowless app with just a sysTray like this:
|
these code make the app has none-window, but has icon on dockbar . |
I see, on Windows, I do not see an icon in the taskbar, only in the sysTray. Sorry I can't be of more help. |
Marking this as specific to macOS and Linux (some Linux) as it is an OS specific item we would need to add support for. |
maybe something like this |
I actually had this use case myself and considered putting in a PR for it. I don't know how to do this cross-platform (why I didn't submit a PR or patch fyne), but this is how I accomplished it on Mac. Note you don't need to patch Fyne to use this. You can use this as a workaround, or use some of this to accomplish this in fyne when building a real solution. For a real solution I think you may also want to provide a method set this value in the info.plist. activationpolicy.go package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
SetActivationPolicy(void) {
[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory];
return 0;
}
*/
import "C"
import "fmt"
func setActivationPolicy() {
fmt.Println("Setting ActivationPolicy")
C.SetActivationPolicy()
} usage:
Note the 200ms sleep, I forgot why I had to do this. But I think it had something to do with either what thread I ran on, or (more likely) glfw hardcoding it and me having to wait until after that code ran. |
mac Info.plist add
docs https://developer.apple.com/documentation/bundleresources/information_property_list/lsuielement |
@zangdale I believe that would work if this line didn't exist:
|
based on fyne issue - fyne-io/fyne#3156 (comment) - this seems to be needed as well as the plist change to ensure the app starts in the background swapped NewWithID to New as the id is set within the FyneApp toml config
It works 👍, the Dock icon will show then vanish, I tried comment |
Checklist
Is your feature request related to a problem?
My app only has a SystemTrayMenu, and I want hide the icon in taskbar.
Is it possible to construct a solution with the existing API?
no exisiting API
Describe the solution you'd like to see.
provide an API to do it.
The text was updated successfully, but these errors were encountered: