eromatiya / blurredfox

A sleek, modern and elegant Firefox CSS theme
MIT License
914 stars 44 forks source link

Render the website's contents under the urlbar and tab bar like macOS' Safari #16

Open emvaized opened 4 years ago

emvaized commented 4 years ago

Very awesome appearance! My only question is - is it possible to achieve behaviour similar to Safari on Mac OS? E.g. title bar blures site's content behind it instead of desktop's content.

screen record to illustrate

eromatiya commented 4 years ago

I'm not really sure if you can achieve this by just using CSS. But I think this is better/more beautiful than rendering the desktop. Yeah, this is a nice suggestion/question but I don't know how to implement this. Patches welcome, of course.

eromatiya commented 4 years ago

So it turns out that you can do this by just using CSS:

image

Change the #nav-bar to

toolbar#nav-bar {
    background: var(--bf-navbar-bg) !important;
    padding: var(--bf-navbar-padding) !important;
    position: absolute !important;
    z-index: 99999 !important;
    margin-bottom: -50px !important;
    backdrop-filter: blur(20px) !important;

    /* Remove horizontal line on navbar */
    box-shadow: none !important;
    border-top: none !important;
}

The problem with this is that if the website has navigation bar, firefox's #nav-bar will hide it.

image

image

Of course, there could be a better way of implementing this. Is safari also have this problem or it doesn't render the web content under the titlebar if the webpage has navigation bar?

emvaized commented 4 years ago

@manilarome Sorry, can't confirm it working because I'm still trying to make whole thing work on Mac :)) But looks very promising on your screenshots!

emvaized commented 4 years ago

@manilarome As for Safari - on Reddit navbar is always down to the panel, like this: reddit navbar

What I found more interesting, is how it's being handled on Ukrainian website called olx - there is auto-hiding navbar, and in Safari it goes completely under the panel when hidden:

Запись экрана 2020-08-13 в 03 17 40

Not sure if it's feature and not a bug :) But probably may tell you something about how Safari processes navbars.

eromatiya commented 4 years ago

I'm still trying to make whole thing work on Mac :))

Sorry about the lack of mac support. Good luck!

How safari handle the navbars are interesting. I'll look more into it. Maybe we can find a hack/way to implement this.

eromatiya commented 4 years ago

I think this is a better implementation:

#navigator-toolbox {
    position: absolute !important;;
    overflow: visible !important;
    z-index: 99999;
    backdrop-filter: blur(6px) !important;
}

#browser {
    margin-top: -100px !important;
}

image

Anyway, please consider requesting a PR if you are able to make this theme work on macOS.

emvaized commented 4 years ago

@manilarome Just tried that on Linux - yeah, look very cool! But still overlapping navbar :(

emvaized commented 4 years ago

@manilarome

If you manually add transform: translate(0px, 100px); to the body in inspector, it partially solves the issue with overlapping. But then, navbar scrolls away with page content:

simplescreenrecorder-2020-08-13_08 04 30

I guess maybe it maybe can be done with some modifications to the sites itself -- maybe using some automatic parsers like TamperMonkey

eromatiya commented 4 years ago

If you manually add transform: translate(0px, 100px); to the body

It doesn't work well here.

20200813_131511

I guess maybe it maybe can be done with some modifications to the sites itself -- maybe using some automatic parsers like TamperMonkey

Yeah. I think the navigation bar staying on top was designed for safari browser so we don't really have a way to achieve it by just using CSS.

emvaized commented 4 years ago

@manilarome Ah, I mean, website's body :) Screenshot_20200813_092423

emvaized commented 4 years ago

@manilarome Not sure about that - Apple more likely will not rely on developers of all of the websites, and probably preferred to find a way to handle it in the browser itself.

emvaized commented 4 years ago

@manilarome Please try to add this line to userContent.css file:

body { transform: translate(0px, 100px); }

The only issue I see here is that navbars get scrolled with page instead of standard sticky behavior (see the gif I've sent above).

eromatiya commented 4 years ago

Ah, I mean, website's body :)

Oof, my bad.

Apple more likely will not rely on developers of all of the websites, and probably preferred to find a way to handle it in the browser itself.

Yeah, they're a billion dollar company after all.

Please try to add this line to userContent.css file:

It works! Now if we only have a way to alter the properties of the current webpage's navigation bar to make it sticky or something we could probably implement this right now.

emvaized commented 4 years ago

@manilarome Yeah :) I've experimented a little with adding this line to userContent.css:

header { 
        position: sticky !important; /* Set the navbar to fixed position */
    }

And it kind of works - with issues, and only for StackOverflow....

eromatiya commented 4 years ago

I've experimented a little with adding this line to userContent.css: header { position: sticky !important; / Set the navbar to fixed position / }

Nice! Your fast, eh? Haha.

with issues, and only for StackOverflow....

No problem. I'll also check my most visited websites so I can add them to userContent.

eromatiya commented 4 years ago

One more thing. I noticed that the sidebar is also under the firefox's navbar. Not a big problem tho.

image

emvaized commented 4 years ago

@manilarome I guess it can be moved with css downside by 100 px, so not a big issue.

Honestly, I found scrolled navbars issue more disturbing :) But unfortunately, I'm not that good in css to get any other ideas on how it can be fixed

eromatiya commented 4 years ago

Honestly, I found scrolled navbars issue more disturbing :)

Yeah. If we only have the source code of safari. lol. Anyway do you know the layer below the body of a webpage called? Unscrolled webpage has this gray background and it renders the blur on the firefox's navigation bar useless.

image

emvaized commented 4 years ago

Honestly, I found scrolled navbars issue more disturbing :)

Yeah. If we only have the source code of safari. lol. Anyway do you know the layer below the body of a webpage called? Unscrolled webpage has this gray background and it renders the blur on the firefox's navigation bar useless.

image

Hmm, I actually liked this appearance :) Not sure. Maybe this can help?

eromatiya commented 4 years ago

Not sure. Maybe this can help?

I'm already using this to test the theme real-time. The problem is the gray background seems like a part of the web page. The inspector can't select it. Anyway, we really need to address the issues(nav-bars, headers, etc.) before implementing this.

emvaized commented 4 years ago

Anyway, we really need to address the issues(nav-bars, headers, etc.) before implementing this.

Sure! But I'm glad it seems to be at least possible - only need to solve issues :)

eromatiya commented 4 years ago

I'll just leave this issue open. I don't really have an idea on how to support all the websites' navbar/header. We also need to fix the gray background.

emvaized commented 4 years ago

Yeah, same. I've also noticed some layout issues with web apps because of translation of the body.

Maybe it'll be great idea to ask on Reddit about this? Somebody may help.

KiranWells commented 3 years ago

I have spent a few hours looking into this, and I wanted to share what I found.

I believe the way Safari does it is that it sets the overflow of the brower object itself to visible. This allows the page to render normally, as it still stays in the same sized and positioned window, but the scrolled content can appear under the navbar. However, userChrome.css does not seem to have access to the direct parent of the :root element. Setting the overflow to visible or adding padding to the browser element, which should show the content inside, does not display the page content. I believe there is some disconnect between the browser element and the :root element, and we do not have access to it. Or, the browser element just doesn't support displaying the overflow.

What could work is somehow moving all the content down 100px (with :root{ padding-top: 100px}), and keeping position:sticky and position:fixed elements 100px away from the top. Maybe a script that takes all elements with a position of sticky or fixed and if they don't have a bottom attribute moving the top down 100px. However, I can't find a way to do this without something like a browser extension.

Picoseconds commented 3 years ago

I believe how Safari does it is that they have the contents of the window ABOVE the top showing under the urlbar. That means the things on top is not actually visible at the current scroll