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

app: add support to hidden minimize and maximize buttons on macos and … #143

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kkeybbs
Copy link

@kkeybbs kkeybbs commented Aug 29, 2024

Two options app.HiddenMinimizeButton and app.HiddenMaximizeButton are added to create a window without minimize or/and maximize buttons.

hide both minimize and maximize buttons

w := new(app.Window)
w.Option(app.HiddenMinimizeButton(true), app.HiddenMaximizeButton(true))
image

hide minimize button, keep maximize button:

w := new(app.Window)
w.Option(app.HiddenMinimizeButton(true), app.HiddenMaximizeButton(false))
  • on macOS:
image
  • on Windows:
image

app/os.go Outdated
Comment on lines 49 to 52
// HiddenMinimizeButton hide the window's minimize button
HiddenMinimizeButton bool
// HiddenMaximizeButton hide the window's maximize button
HiddenMaximizeButton bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should either note that these don't work under Linux, or make them work under Linux.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tried for days to test on ubuntu with os_x11.go, but still not working.

  • _NET_WM_ALLOWED_ACTIONS
  • _MOTIF_WM_HINTS
  • _NET_WM_WINDOW_TYPE: _NET_WM_WINDOW_TYPE_DIALOG

They all didn't work. I belive these properties also depend on window manager implementation, according to infomations bellow:

I'll continue wokring to make them work on x11 and wayland, but this may take long time.
So I add tips "only works for windows and macOS" for the options.
Maybe the feature working only on some os is acceptable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the feature working only on some os is acceptable?

Fine with me. Better than nothing! Thanks for trying.

@eliasnaur
Copy link
Contributor

Can you describe the use-cases you need these controls for? Can we just automatically apply them when, say, MinSize == MaxSize?

@kkeybbs
Copy link
Author

kkeybbs commented Sep 9, 2024

Can you describe the use-cases you need these controls for? Can we just automatically apply them when, say, MinSize == MaxSize?

Some usefull cases in my business products:

  • using both HiddenMaximizeButton and HiddenMinimizeButton
    • Making a dialog window, such as application's "About" dialog. Just need closing insteadof minimizing and maximizing.
    • Instead of minimizing to Dock, user can click the app, and makes it work in the background and an icon in the systray. Users like this easy experience, it saves spaces in Dock.
  • using HiddenMaximizeButton, to disallow a window to be a fullscreen window in new desktop on macOS.

So maybe I can try how to make a window be dialog in x11.

Sometimes HiddenMaximizeButton can be automatically apply with "MinSize == MaxSize", but not always when size is screen size. Maximizing will make the window as a new fullscreen window in macOS. So leave them standalone will be better.

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

Successfully merging this pull request may close these issues.

3 participants