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

Hide taskbar/Dock icon and menu bar #2246

Open
ws909 opened this issue Jan 5, 2023 · 3 comments
Open

Hide taskbar/Dock icon and menu bar #2246

ws909 opened this issue Jan 5, 2023 · 3 comments

Comments

@ws909
Copy link

ws909 commented Jan 5, 2023

This is a feature request to introduce a new API to GLFW to support "accessory" applications; applications with windows, but no taskbar/Dock icon, and no menu bar.

On MacOS, this internally uses NSApplication.activationPolicy with NSApplicationActivationPolicy1.

  • TYPE_REGULAR = NSApplicationActivationPolicyRegular
  • TYPE_ACCESSORY = NSApplicationActivationPolicyAccessory
  • TYPE_BACKGROUND = NSApplicationActivationPolicyProhibited

I don't know Windows, but it seems like this has to be done per window. GLFW can save the state internally, and then apply this to all windows. There's the case of an application wanting N windows to have a taskbar icon, and M windows to not have that. This is not achievable on MacOS, but it should be possible to build an API which seamlessly supports this on Windows, without causing issues on MacOS. For instance, if this is a per-window flag/attribute, and not for the entire application, the Cocoa implementation can set the activation policy to Regular whenever a regular window is created, and change it to Accessory when there's only accessory windows open. The application-wide state is useful for the case where there's no windows open. Some applications will prefer the Dock icon and application menu bar to show, while some will not.

For a per-window state, some applications may even always want the Dock icon to show on MacOS, and may always want at least 1 taskbar icon on Windows.

I don't know how to implement this for X11 and Wayland.

Mode:

  1. MacOS: show Dock icon and menu bar. Windows: show taskbar icon. X11/WL: similar.
  2. MacOS: hide Dock icon and menu bar. Windows: hide taskbar icon. X11/WL: similar.

Possible APIs:

  • GLFW_APPLICATION_TYPE, GLFW_APPLICATION_TYPE_REGULAR, GLFW_APPLICATION_TYPE_ACCESSORY and GLFW_APPLICATION_TYPE_BACKGROUND
  • GLFW_WINDOW_TYPE, GLFW_WINDOW_TYPE_REGULAR, GLFW_WINDOW_TYPE_ACCESSORY and GLFW_WINDOW_TYPE_BACKGROUND
  • glfwShowApplicationIcon(bool)
  • glfwRepresentApplication(bool)
  • glfwSetApplicationType(int)
  • glfwSetWindowType(int)
glfwInitHint(GLFW_APPLICATION_TYPE, GLFW_APPLICATION_TYPE_REGULAR); // Default
glfwInit();

glfwSetApplicationType(GLFW_APPLICATION_TYPE_ACCESSORY);

or

glfwInit();
glfwWindowHint(GLFW_WINDOW_TYPE, GLFW_APPLICATION_TYPE_REGULAR); // Default
GLFWwindow* window = glfwCreateWindow(640, 500, "Regular window", NULL, NULL);

glfwSetWindowType(window, GLFW_APPLICATION_TYPE_ACCESSORY);
glfwSetWindowTitle(window, "Accessory window");

or

glfwInit();
glfwWindowHint(GLFW_WINDOW_TYPE, GLFW_APPLICATION_TYPE_REGULAR); // Default
GLFWwindow* window = glfwCreateWindow(640, 500, "Regular window", NULL, NULL);

glfwSetWindowAttrib(window, GLFW_WINDOW_TYPE, GLFW_APPLICATION_TYPE_ACCESSORY);
glfwSetWindowTitle(window, "Accessory window");

This feature request spawned from this thread:

Implementing this functionality, will fix that issue, but this feature is not in itself required to fix it.

Replaces:

Related:

Footnotes

  1. Only available on macOS 10.9 and above. Must emit GLFW_FEATURE_UNAVAILABLE on previous versions.

@ws909
Copy link
Author

ws909 commented Jan 5, 2023

I don't mind writing a Cocoa implementation, but I cannot design a good API without knowing more about the other platforms, so I require help for this. Some general feedback from core maintainers about this feature would also be useful. I am also a slight bit worried that this can cause issues for bundled applications1.

Footnotes

  1. See the issue linked to in the first post.

@anthonywww
Copy link

Actually need this feature right now for a LWJGL wallpaper app... If it's not possible with GLFW I might just try to figure this out with SWT. Is there really no cross-platform/cross-toolkit implementation of making a window become a "background process" or desktop wallpaper? I can set the framebuffer to transparent and not decorate the window, but still shows up as a program on the taskbar in Cinnamon, Debian. Also trying to force it to the background but not sure how.

@ws909
Copy link
Author

ws909 commented Aug 30, 2023

@anthonywww I'm busy these days, so I don't have time to invest in it, at the moment. In addition, there's been no activity recently in GLFW, so the project seems to be on hold for now.

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

No branches or pull requests

2 participants