MozillaReality / horizon

(2015) Horizon was an experimental VR browser built on web standards using CSS-VR.
http://mozvr.github.io/horizon/web/
Other
1 stars 0 forks source link

Implement native window chrome UI (à la NW/Electron) #132

Open cvan opened 9 years ago

cvan commented 9 years ago

There are too many native permutations in the wild (Mac OS X 10.10 vs. 10.7, Windows 8 vs. 10, Linux, etc.) to emulate window controls in CSS. We'll never be native-looking enough.

The real solution should be to do something like embed web apps but with a thin native shell. (This is similar to how Slack, Rdio, etc. are packaged.)

It's been done in the past by Prism/Chromeless/Fluid on desktop (and Phonegap on mobile).

These days, lots of people are using node-webkit or Chromium, often alongside some build tool like Electron, Brackets, node-webkit-builder, or Web2Executable.

And according to the Graphene/browser.html folks, it looks like something like this for Graphene is on the _Horizon_:

gordonb [5:59 PM] Will revisit as graphene gets more mature


For archival purposes, here's an abridged excerpt from a Slack discussion in #horizon today:

jcarpenter [5:07 PM] @cvan: @cyee Dumb question perhaps, but why do we need the .window-controls ? I use keyboard shortcuts to move windows around on Mac, so I may be biased, but I don’t usually need them for anything..

cvan [5:08 PM] @jcarpenter: well you use an app to move windows, right? IMO, apps should respect native controls. imagine if OS X Cocoa apps weren't consistent w/ window management? (edited)

cvan [5:10 PM] https://github.com/MozVR/horizon/issues/47 - and https://github.com/MozVR/horizon/issues/91 which @kevining says are fixed but still don’t seem to work for me

jcarpenter [5:18 PM] @cvan: Long term sure, and certainly when we release to public, but at this early stage I don’t know if adds anything except code bloat?

jcarpenter [5:19 PM] Did we determine that it’s not possible to get actual native controls?

cvan [5:19 PM] it should work - and it’s a hassle that it doesn't

cvan [5:20 PM] but if we don’t want our application to have consistent controls, sure go ahead and remove them - there will no longer be three dots in the upper-left corner

cvan [5:21 PM] it makes it look like an actual browser (and a standard application) - but I understand that we’ll also need to mimic them on Windows

cvan [5:21 PM] so admittedly it probably makes more sense to remove them altogether today

cvan [5:25 PM] I can remove it in separate commit

jcarpenter [5:25 PM] @cvan: Yeah long term I don’t think it’ll be tenable to create custom implementations for all the various OS permeations out there. That inevitably falls into uncanny valley territory, where web controls try to mimic native and don’t get it quite right.

cvan [5:26 PM] some web apps (like Atom) are already falling into that trap - where they’re not using native Cocoa controls

jcarpenter [5:26 PM] I mean, there are subtle visual and behavioral differences between every version of OSX alone.

jcarpenter [5:26 PM] Huh. Interesting. Slack seems like good precedent.

jcarpenter [5:27 PM] To me it’s like being a good guest: we should fit like a glove into the native widgets of our host OS wherever we need them...

cvan [5:27 PM] kind of like this: https://github.com/jyapayne/Web2Executable

GitHub jyapayne/Web2Executable Web2Executable - Uses node-webkit to generate "native" apps for already existing web apps.

gordonb [5:30 PM] We're definitely not trying to ape the OS controls with the web. Instead we are dramatically reducing the amount of native footprint our UI touches. (edited)

gordonb [5:30 PM] See apps like Airmail for prior art

gordonb [5:33 PM] Esp if you are talking full screen app, the amount of native controls footprint is vanishingly small.

cvan [5:36 PM] yeah, I think what @gordonb is saying is that we shouldn’t try to mimic the window chrome - we should go the PhoneGap/Prism route

gordonb [5:58 PM] @jcarpenter: we had worked on hooking up native menus and window controls to JS APIs. This work is unfinished but it's feasible: a matter of adding a small bit of c++ and cocoa (edited)

gordonb [5:59 PM] Will revisit as graphene gets more mature

jcarpenter commented 9 years ago

Thanks for filing this. I've removed the css window elements with my latest PR, fwiw. Am updating this to reflect long term desire to move to native UI elements.

cvan commented 9 years ago

Awesome, I was going to file a separate issue. But this works better.