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

Support _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED property #7681

Closed
memeplex opened this issue Jul 1, 2018 · 8 comments
Closed

Support _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED property #7681

memeplex opened this issue Jul 1, 2018 · 8 comments

Comments

@memeplex
Copy link

memeplex commented Jul 1, 2018

~:: uname -a
Linux carlos 4.14.52-1-MANJARO #1 SMP PREEMPT Tue Jun 26 15:24:31 UTC 2018 x86_64 GNU/Linux

~:: cinnamon --version
Cinnamon 3.8.6

~:: lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

~:: pacman -Qs xf86-video-intel
local/xf86-video-intel 1:2.99.917+829+gd7dfab62-1 (xorg-drivers)
    X.org Intel i810/i830/i915/945G/G965+ video drivers

The _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED property is supported by Gnome and it's currently the only way AFAICS that allows a client ask the WM to remove its decorations. We are trying to implement a hide-titlebar-on-maximize mode for Emacs but when the client explicitly hides/shows its decorations bad things happen both under Gnome and under Cinnamon. For instance, if you maximize the window, then hide its decorations, then show them again, the window becomes invisible, probably because Cinnamon WM is trying to fit a full-sized undecorated window plus its restored decorations so yielding a geometry larger than the actual screen. The bottom line is that it's safer to politely request the WM to remove the decorations, but there is no way to do that in Cinnamon. Notice I'm not asking for a settings UI but just for honouring the _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED property.

@memeplex memeplex closed this as completed Jul 1, 2018
@mtwebster
Copy link
Member

The first concern would be, how does one unmaximize this window if there aren't any window controls (ignoring window list applet and shortcuts)? I'm pretty sure that's why we no longer support it, though I could be wrong.

It looks like mutter (gnome's wm) has a preference to ignore these requests or not. I suppose we could do the same, but we'd probably default it to ignore.

@memeplex memeplex reopened this Jul 1, 2018
@memeplex
Copy link
Author

memeplex commented Jul 1, 2018

I think this is client responsibility, at least that is the way Gnome is going (by interpreting the titlebar is "owned by the client"), I'm not saying Cinnamon should follow Gnome there but:

  1. Since some clients would like to set this property to work under Gnome.
  2. Since it's a standard gtk feature [1]

I would say that Cinnamon should honour it and let the client provide its own means of exiting the maximized state. This is not a problem for a client such as emacs, emacs users that know how to toggle a property from emacs customization UI will probably also know how to exit maximized state with their keyboards (or by toggling the property again); anyway, that's for emacs to decide. Other clients will go the pure CSD way or won't provide a hide-titlebar-on-maximize option at all. Again: I'm not asking for the WM to hide decorations on maximize on a general basis but on a per client basis, letting the client decide. Additionally, honouring the property will simplify extensions like [2] that are currently a messy hack (I'm not even sure why this extension is setting _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED at all, maybe because it was ripped off from its Gnome equivalent --that's quite a hack too-- but the workhorse of the extension is _MOTIF_WM_HINTS).


[1] https://developer.gnome.org/gdk3/stable/gdk3-X-Window-System-Interaction.html#gdk-x11-window-set-hide-titlebar-when-maximized

[2] https://github.com/linuxmint/cinnamon-spices-extensions/blob/master/cinnamon-maximus%40fmete/files/cinnamon-maximus%40fmete/extension.js#L565

@memeplex
Copy link
Author

memeplex commented Jul 1, 2018

Another way to think about this is: nemo, terminal, firefox, all provide options to hide the menubar. The user that is willing to do that should also know how to undo it when needed. You're already allowing this feature for some clients, some of them show a popup explaining how to get the menu back, others don't, everything on a per client basis. Well, this is the same but for the titlebar.

Moreover, don't expect many clients to do that. Some clients with long lived sessions that highly value screen space will want to optionally enter some kind of "no distractions mode". Users of these few applications that enabled this "no distraction mode" know what they're doing.

@memeplex
Copy link
Author

memeplex commented Jul 1, 2018

Another thing to consider: even if you want to play safe and remove control even from power users that explicitly enabled it from their own apps, you can't really avoid that relatively popular extensions hide decorations in the worst possible way: relying on many hacks and on a global basis.

@mtwebster
Copy link
Member

Removing it was never about trying to hamper users (power- or otherwise) - for a period of time, Unity was heavily pushing the whole global menu idea, and the devs were patching popular programs to remove the titlebar. It was removed in defense of that primarily.

With unity gone, and client-side-decorated windows being the new 'in thing' I couldn't come up with an argument not to restore this support, just no one had requested it up until now.

@memeplex
Copy link
Author

memeplex commented Jul 3, 2018 via email

@memeplex
Copy link
Author

memeplex commented Jul 3, 2018

Sorry, would it be too much to ask for an option (just a gsettings option, no friendly UI) to set the _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED on every created window, in order to get this behavior globally? Many DEs allows something like that that: xfce, plasma, mate that I know of.

Well, that's a possible implementation, maybe it's more easy to implement without using _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED.

@memeplex
Copy link
Author

memeplex commented Jul 3, 2018

Regarding the last comment, just for anyone that happens to end up here in the future I've created maximal, a simple python xlib utility that just sits there waiting for creation events and setting _GTK_HIDE_TITLEBAR_WHEN_MAXIMIZED according to some rules.

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