rafaelmardojai / firefox-gnome-theme

A GNOME👣 theme for Firefox🔥
The Unlicense
3.32k stars 153 forks source link

Window controls missing on macOS #773

Open qwertychouskie opened 3 months ago

qwertychouskie commented 3 months ago

Describe the bug Window controls are missing on macOS.

To Reproduce Install theme on macOS

Expected behavior Window controls exist

Screenshots

image

Setup information

Additional context Sadly I have to use macOS for work

rafaelmardojai commented 3 months ago

The theme has the --gnome-navbar-csd-offset CSS var to know how much offset the navbar needs to show the window controls. The theme sets the value of this var based on the linux-only -moz-gtk-csd-minimize-button, -moz-gtk-csd-maximize-button and -moz-gtk-csd-close-button media queries. Then it uses the -moz-gtk-csd-reversed-placement to know if the offset needs to go in the start or end.

Said that, if you know some macOS-only media query in Firefox we could use it to set --gnome-navbar-csd-offset with some value that works for macOS, and I guess it would also need to set the offset in the start.

Otherwise you can add custom styles on top of the theme to fix your issue:

/* Window controls offset */
:root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
    padding-left: 117px !important;
    padding-right: 3px !important;
}
rafaelmardojai commented 3 months ago

Looking at https://github.com/mozilla/gecko-dev/blob/f602853ba8d55ba157e2a74d9b571615f6ed97b8/layout/style/test/chrome/chrome-only-media-queries.js looks like we might have some alternatives.

Can you check if the following code works?

@media (-moz-platform: macos) {
    :root {
        --gnome-navbar-csd-offset: 117px;
    }
    :root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
        padding-left: var(--gnome-navbar-csd-offset) !important;
        padding-right: 3px !important;
    }
    :root[tabsintitlebar] #titlebar .titlebar-buttonbox-container {
        left: 0;
        right: auto !important;
    }
}
qwertychouskie commented 3 months ago

Put that in customChrome.css, got this result:

image
rafaelmardojai commented 3 months ago

Hmm, so it works fine (adding the offset) but there are no window controls. I would need to inspect the UI I guess, but I don't have macOS, so we're at a dead end.

qwertychouskie commented 3 months ago

Hmm, so it works fine (adding the offset) but there are no window controls. I would need to inspect the UI I guess, but I don't have macOS, so we're at a dead end.

I have an older Macbook that I can set up remote desktop on if you wanted to use that to test on.

ChrisW-B commented 2 months ago

This seems to get the gnome style buttons workable/visible:

@media (-moz-platform: macos) {
    :root {
        --gnome-navbar-csd-offset: 120px;
    }
    :root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
        padding-left: var(--gnome-navbar-csd-offset) !important;
        padding-right: 3px !important;
    }
    :root[tabsintitlebar] #titlebar .titlebar-buttonbox-container {
        left: 0;
        right: auto !important;
    }

    :root[tabsintitlebar] #titlebar .titlebar-buttonbox {
        display: flex !important;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-min,
    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-max,
    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-close {
        display: flex !important;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-close {
        order: 1;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-min {
        order: 2;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-max {
        order: 3;
    }

    :root[tabsintitlebar]
        #titlebar
        #TabsToolbar
        .titlebar-buttonbox-container:not(#hack) {
        display: block !important;
    }

    :root[tabsintitlebar] .titlebar-buttonbox {
        position: absolute;
        top: -46px;
    }
}

Screenshot 2024-05-01 at 10 06 40 AM

I can make a PR if this is something you want, I'm not sure if you have a variable for the #nav-bar height, which is where that -46px is coming from.

I also added another 3px to --gnome-navbar-csd-offset as the button padding overlapped the maximize button on hover.

I wrote this in Nightly (127.0a1 (2024-04-30) (64-bit)) - I haven't tested it anywhere else

qwertychouskie commented 2 months ago

This seems to get the gnome style buttons workable/visible:

@media (-moz-platform: macos) {
    :root {
        --gnome-navbar-csd-offset: 120px;
    }
    :root[tabsintitlebar]:not([inFullscreen]) #nav-bar {
        padding-left: var(--gnome-navbar-csd-offset) !important;
        padding-right: 3px !important;
    }
    :root[tabsintitlebar] #titlebar .titlebar-buttonbox-container {
        left: 0;
        right: auto !important;
    }

    :root[tabsintitlebar] #titlebar .titlebar-buttonbox {
        display: flex !important;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-min,
    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-max,
    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-close {
        display: flex !important;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-close {
        order: 1;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-min {
        order: 2;
    }

    :root[tabsintitlebar] #titlebar .titlebar-button.titlebar-max {
        order: 3;
    }

    :root[tabsintitlebar]
        #titlebar
        #TabsToolbar
        .titlebar-buttonbox-container:not(#hack) {
        display: block !important;
    }

    :root[tabsintitlebar] .titlebar-buttonbox {
        position: absolute;
        top: -46px;
    }
}

Screenshot 2024-05-01 at 10 06 40 AM

I can make a PR if this is something you want, I'm not sure if you have a variable for the #nav-bar height, which is where that -46px is coming from.

I also added another 3px to --gnome-navbar-csd-offset as the button padding overlapped the maximize button on hover.

I wrote this in Nightly (127.0a1 (2024-04-30) (64-bit)) - I haven't tested it anywhere else

I can confirm that this makes the buttons show up, but they all seem shifted too far to the right, and more importantly, I can't click on any of the tabs beneath the window buttons.