elementary / stylesheet

The GTK Stylesheet for elementary OS
https://elementary.io
GNU General Public License v3.0
320 stars 74 forks source link

Headerbars that have subtitles are taller than the ones that don't #506

Closed johnfactotum closed 4 years ago

johnfactotum commented 5 years ago

Apologies for opening a new issue, as this is really the same problem as #399 and #352, but I wish to frame the problem a bit differently.

The issue isn't about specific apps or any specific widget or margin they might have used. As it stands, any headerbar with subtitles will be taller than a headerbar without subtitles. This can be tested with the following code:

#!/usr/bin/env python3
import gi
from gi.repository import Gtk

win = Gtk.Window()
hb = Gtk.HeaderBar()
hb.set_show_close_button(True)
hb.props.title = 'Title'
hb.props.subtitle = 'Subtitle'
win.set_titlebar(hb)

win2 = Gtk.Window()
hb2 = Gtk.HeaderBar()
hb2.set_show_close_button(True)
hb2.props.title = 'Title'
hb2.set_has_subtitle(False)
win2.set_titlebar(hb2)

win.connect('destroy', Gtk.main_quit)
win2.connect('destroy', Gtk.main_quit)
win.show_all()
win2.show_all()
Gtk.main()

Here's how it looks with the elementary theme (tested with master): Screenshot from 2019-05-23 14-42-07

For reference, here's how it looks in Adwaita: Screenshot from 2019-05-23 14-41-26 Arc: Screenshot from 2019-05-23 14-42-54 Materia-compact Screenshot from 2019-05-23 14-42-36

To properly support subtitles in headerbars, I believe the desired behavior would be to make them have the same height.

Edit: Just realized that adding the .compact class to the headerbar resolves this issue. In which case I think it would be better if that look could be made default for headerbars with subtitles, or at the very least document this behavior so app developer can use the class instead of having to manually tweak their stylesheets like @ztefn did.

Edit 2: Using the .compact class on headerbars with subtitles only seems to work for non-maximized windows. If the window is maximized, the height actually grows instead of shrinking -- granted there isn't really much space left to shrink but it shouldn't grow either).

janxkoci commented 4 years ago

For me the weirdist part is that it changes height when you (un)maximize. No other "theme" does this.

danirabbit commented 4 years ago

It's intentional that headerbars shrink to fit their contents. The most consistent feedback we hear from users is that they want headerbars to take up the least amount of vertical space as possible.

Shrinking when maximized is also intentional since we can assume that reducing the drag area is not a concern and the user has signaled that space is a concern

Closing as "Design conflict"

johnfactotum commented 4 years ago

@danrabbit I understand that shrinking when maximized is intentional, hence my second edit commenting on the fact that when a headerbar with a subtitle is styled with .compact it actually grows when maximized, when it should be shrinking or at least remain the same.

This issue is about decreasing the height of headerbars containing subtitles so that they will have more or less the same height as headerbars without subtitles, maximized or not.