photon icon indicating copy to clipboard operation
photon copied to clipboard

Native window button (Contribution enquiries)

Open gsouf opened this issue 8 years ago • 7 comments

Didnt find add close, minimize, maximize buttons in the title bar in photon. That's why this issue aims to discuss about.

Their are 2 aspects abouts this:

  1. Theme integration (css, styling)
  2. action automation (js)

1. Theme integration

Theme integration would allow offer way to create these buttons. E.g (view top right buttons):

photon_002

That raises a problem: each desktop/OS has it's one button layout, colors, styles... That's why buttons should be themable through custom classes e.g action-close but they should remain customable if he developer wants to do some weird button implementations (for instance the google chrome button that allows to login google account from the title bar).

2. Javscript integration

The second question. I'm only contributing, I have no precise idea of your goal with photon. Do you want to provide a feature rich javascript environment ?

In this case we could offer some shortcut to make a button closing the window (show bellow for example).

Implementation example

I provided an example of implementation: https://github.com/gsouf/photon/commit/0313cccd6d505117730199210fd59bd76817b807

The buttons are defined in the header next to the title: https://github.com/gsouf/photon/commit/0313cccd6d505117730199210fd59bd76817b807#diff-434fc7c230c4addfe39300dedd6074edR21

Buttons can be bind automatically from markup: https://github.com/gsouf/photon/commit/0313cccd6d505117730199210fd59bd76817b807#diff-441d9fb1b9d314b7b48820c2890acc76R20

Please note that the implementation I provided is only a draft that was developed fastly in order to provide a concret example.

gsouf avatar Oct 24 '15 15:10 gsouf

Doesn't Electron itself provide these and overlay them onto frameless apps?

developit avatar Oct 24 '15 23:10 developit

@developit I dont think so, or I didnt find this.

gsouf avatar Oct 25 '15 09:10 gsouf

I think it works only for OSX, using title-bar-style:hidden. AFAIK it doesn't work with frameless windows.

parro-it avatar Oct 26 '15 07:10 parro-it

I was trying to avoid reimplementing this but it might be unavoidable. Does anyone know for sure if this is completely broken in Windows?

I know in OSX, the "traffic lights" work automatically except when frameless windows are used.

connors avatar Oct 31 '15 19:10 connors

I don't know on windows. It does not work for sure in Lubuntu.

parro-it avatar Nov 03 '15 21:11 parro-it

@connors dont know if the term "broken" is the good one, but at least frameless windows are definitively not the same as the OSX onlytitle-bar-style:hidden.

Maybe that it can be good to implement this for anyone that would like to build a frameless windows with some additional control buttons ? I mean, this is leighweight and functional, should be though, isn't it ?

gsouf avatar Nov 03 '15 23:11 gsouf

OS X has three types of frameless windows: frame: false, 'title-bar-style': 'hidden', and 'title-bar-style': 'hidden-inset'. All show the window without a border, shadow, frames, and title bar. While the first one also hides the traffic lights, the other two show them.

The difference between hidden and hidden-inset is that hidden-inset shows the traffic lights a little bit more inset (lower on the page) than hidden. This is useful for applications that have a thicker header (ie. Chrome). The other thing is that these two options only work on Yosemite (v10.10) and higher. They also produce some bugs that have yet to be fixed. Links below:

kevinmartin avatar Nov 09 '15 16:11 kevinmartin