lunakurame / firefox-gnome-theme

A theme for Firefox 57+ matching GNOME Adwaita.
The Unlicense
199 stars 15 forks source link

Center page title inside tabs #13

Closed Gert-dev closed 6 years ago

Gert-dev commented 6 years ago

Great work on this theme! A minor detail I noticed is that the page titles inside the tabs are not centered, which does seem to be the case with actual GTK tabs, such as used in epiphany.

lunakurame commented 6 years ago

Thanks! Tab labels should be centered now, like in Epiphany.

Gert-dev commented 6 years ago

Thanks, already looks better!

Also, not sure if this is desired or even possible, but I noticed in Epiphany the (fav)icons are centered as well, next to the centered tab title.

lunakurame commented 6 years ago

You're right. I just spent an hour trying to figure it out, but nothing works. Either everything is centered, including the close button and tab mute icon, or the icon isn't. I'm out of ideas so I'll label this issue as "help wanted" and maybe someone figures it out.

rafaelmardojai commented 6 years ago

I have spent my sunday trying to solve this XD.

Apparently works fine, but maybe is broken in some case, let me know.

Pd: Do we put it directly in theme.css or create a new experimental feature?

/* Center all inside tab */
.tab-content {
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 100% !important;
}

/* Prevent icons size breaking */
.tab-icon-image, .tab-icon-sound, .tab-throbber, .tab-throbber-fallback  {
    min-width: 16px;
}
.tab-close-button {
    min-width: 22px;
}

/* Adjust tab label width */
.tab-label-container {
    min-width: 0 !important;
}

/* Put close button and icon sound to the right  */
.tab-icon-sound[soundplaying="true"] {
    margin-left: auto !important;
}
.tabbrowser-tab:not([soundplaying]) .tab-close-button {
    margin-left: auto !important;
}

/* Force favicon to the center */
.tab-throbber, .tab-throbber-fallback {
    margin-left: auto;
}
.tabbrowser-tab:not([bussy]) .tab-icon-image {
    margin-left: auto;
}

/* If favicon is not present, force tab label to the center */
.tabbrowser-tab .tab-label-container {
    margin-left: auto !important;
}

.tabbrowser-tab[image] .tab-label-container, .tabbrowser-tab[bussy] .tab-label-container  {
    margin-left: 0px !important;
}

/* If close button is not present, don't force favicon to the center */
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]) .tab-throbber,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]) .tab-throbber-fallback,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]):not([bussy]) .tab-icon-image,
#tabbrowser-tabs[closebuttons="activetab"] .tabbrowser-tab:not([selected="true"]):not([image]) .tab-label-container {
    margin-left: 0 !important;
}
lunakurame commented 6 years ago

That's pretty cool! Just tested it on FF 57, 58 and 59, seems to work nicely. I haven't found any bugs and the code looks solid. It's a standard GTK behavior to center tab labels and it doesn't depend on any specific FF version (unlike client-side decorations), so I think you can add it directly to the theme.css file. Also you can remove what I added in 2a9708ac7fd8cde2ebfbb09630fde1d50573c305, we don't need it anymore.