Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Titlebar on Windows has a lot of wasted space #3036

Closed
bsclifton opened this issue Aug 8, 2016 · 25 comments · Fixed by #3854
Closed

Titlebar on Windows has a lot of wasted space #3036

bsclifton opened this issue Aug 8, 2016 · 25 comments · Fixed by #3854
Assignees
Labels
design A design change, especially one which needs input from the design team. feature/titlebar OS/Windows QA/checked-Win32
Milestone

Comments

@bsclifton
Copy link
Member

bsclifton commented Aug 8, 2016

Did you search for similar issues before submitting this one?
Yes

Describe the issue you encountered:
Brave on Windows has a lot of titlebar bloat. Here are some screenshot demonstrating that:

Windows 10
screen shot 2016-08-08 at 8 04 52 am

Windows 7
screen shot 2016-08-08 at 8 17 49 am

In order to show the minimize/maximize/close buttons, Windows requires you to add the WS_CAPTION style to the window, which also adds the titlebar and the icon.

Electron has a frameless mode but unfortunately that doesn't have the minimize/maximize/close buttons (and it doesn't support menus). While working on a proof of concept, I discovered the possibility exists to manually render these elements using Windows API, but there are complications.

The resolution for this issue needs to:

  • Create the BrowserWindow object as frameless
  • Manually render the caption buttons
  • Manually render the menu
  • Only update Windows; no changes are desired on Mac/Linux

Expected behavior:

Windows 10 (and 8) UI layout:

image

Windows 7 UI layout:

image

  • Platform (Win7, 8, 10? macOS? Linux distro?):
    All Windows platforms
  • Any related issues:
    New UI #2386
@bsclifton bsclifton added design A design change, especially one which needs input from the design team. OS/Windows Major labels Aug 8, 2016
@bsclifton bsclifton added this to the 1.0.0 milestone Aug 8, 2016
@KillianKemps
Copy link

I would say the issue is not Windows-only. Here it is the same on Linux.

Screenshot on Arch Linux with Gnome:
screenshot from 2016-08-10 09-38-01

Screenshot on elementaryOS (based on Ubuntu):
screenshot

@bbondy
Copy link
Member

bbondy commented Aug 10, 2016

Linux should be posted separate since it is completely distinct work, and will be prioritized separately. Thanks!

@bsclifton
Copy link
Member Author

bsclifton commented Aug 11, 2016

What @bbondy said- it would be great if you can create a separate issue, @KillianKemps (with similar text to what I posted originally, with your screen caps). But definitely, thanks for reporting! I personally haven't used Brave on anything other than Ubuntu, so it's great to know it can be improved too

@KillianKemps
Copy link

Alright I understand, I've created a new issue for Linux: #3126

@Sh1d0w
Copy link

Sh1d0w commented Aug 11, 2016

Hi guys. I've quickly implemented custom header bar, with minimize, maximaze and close actions. It also supports dragging and double click maximizing in the new header bar.

Tested on Linux. If someone can help with testing on Mac and Windows it will be very helpful. See my PR I have rised in order to run it locally and test. It should work flawlessly tho.

Also I accept suggestions on styling, will upload a video shortly of the current look and feel :)

cc @bbondy @luixxiul @bradleyrichter @bsclifton

Edit: Preview here: http://webm.land/media/g4DR.webm

@bsclifton
Copy link
Member Author

bsclifton commented Aug 11, 2016

@Sh1d0w that's pretty interesting and it looks pretty good 😄 This functionality would only be needed on Windows and Linux (not needed on Mac). The goal was to have pixel perfect versions of the native OSes buttons show in the top right.

@bradleyrichter @bbondy @luixxiul what do you all think? Would having our own styling be an option, rather than using the OSes native window kit?

@bradleyrichter
Copy link
Contributor

@Sh1d0w Your video above is showing this new toolbar on a Linux flavor which is running a macOS theme, correct?

If yes, then this is interesting. Can you show us how it looks with the default theme?

@bradleyrichter
Copy link
Contributor

@bsclifton No, we need to conform to the OS standard window controls in the proper place for each OS, mainly for usability reasons.

@Sh1d0w
Copy link

Sh1d0w commented Aug 12, 2016

@bradleyrichter Yes, this is Fedora 24 with macOS theme. Here is how it looks with v0.11.4 and without my changes

The problem here is from what you see, that I have title bar repeating twice, which is wasting a lot of space and there is like style difference between the header and the url panels.

@bsclifton What about a setting just like chrome does it right now? With chrome you have the option to choose to use the system theme border or the chrome theme, which removes and places custom buttons at the top? I think this way we will give the people the choice to have more compact view or to stick with the default one if they prefer it. Personally I think this is very good solution to the problem. Out of the box you will have the OS theme's styles, but if you prefer more compact view you can enable it. We can also put settings like setting the position of the buttons, you know to position them on the left or right side of the header.

cc @bbondy

@Sh1d0w
Copy link

Sh1d0w commented Aug 12, 2016

PS: @bsclifton on macOS we have the following:

On macOS 10.10 Yosemite and newer, there’s an alternative way to specify a chromeless window. Instead of setting frame to false which disables both the titlebar and window controls, you may want to have the title bar hidden and your content extend to the full window size, yet still preserve the window controls (“traffic lights”) for standard window actions. You can do so by specifying the new titleBarStyle option:

Do you want me to implement this in my PR for macOS only? Please let me know and I willl do :)

@bsclifton
Copy link
Member Author

bsclifton commented Aug 12, 2016

@Sh1d0w the final call on whether or not we can use a non-OS styled theme lies with @bradleyrichter and @bbondy. When discussing with them earlier today, the consensus was a no-go for your PR- even though it looks pretty nice (and we definitely do appreciate it, trust me 😄). It's a requirement for us to have the OS specific controls

The Mac version seems to be great as-is; it's basically frameless and the menu lives in the actual system menu on top. Here's a screenshot:
screen shot 2016-08-11 at 9 11 14 pm

You're absolutely right- the Linux and Windows versions use too much space 😦 I opened the following issue in Electron which I encourage you to look at.
electron/electron#6823

I need help understanding where to make the changes; maybe we can work together? 😄 I understand win32 very well but don't have much experience w/ X11 and Cocoa. The approach I am trying to take in electron would be using native API calls to get the bitmap and rendering it over the window contents, as if it were a non-client area. This could then be exposed on the BrowserWindow object so that other Electron users could benefit from it too

Let me know what you think and thanks again 😄

@Sh1d0w
Copy link

Sh1d0w commented Aug 12, 2016

@bsclifton Thanks for your comment. Unfortunately I am not that deep into the X11 stuff. What I know is that on Gnome desktop for example, as I suppose every other Linux desktop like Unity and KDE you can install different themes. Each of those themes are defined by CSS styles inside the themes.

In GTK you have gtk_widget_get_style() function, which fetches the current theme styles. Once we have them we can easily parse them and apply the styles to the buttons. Worth researchng also what should be the HTML structure for the buttons in Brave to be consistent with the styling.

I think this is interesting, just found it: https://github.com/WebReflection/node-gtk and https://github.com/coreybutler/node-windows

Will take a look into them.

Have you guys considered my suggestion to implement setting that turns my modification on/off? Since it is a common practise in Google Chrome for example? They have implemented the same thing - by default Chrome uses the system theme, but you have option to switch to completely custom Chrome theme with custom buttons at the top? This will keep as it is now, but will give the change to users like us who don't like the gap and the space waste.

Let me know what you think about it, so I will know if I should close my PR or tweak it :)

cc @bbondy @bradleyrichter

@bsclifton
Copy link
Member Author

bsclifton commented Aug 12, 2016

I understand the Google Chrome way- they allow you to customize the look and feel by offering themes. We don't offer that yet... but we do have several issues asking for functionality like this:
#1090
#473
#271

I think the only approach that would work is making the change at the electron level. We maintain a fork of electron here that I am looking at now. The issue I shared above is in the upstream repo- I'm hoping the maintainers can help me find a solution using the native controls.

For now, we can close the PR. But thank you for the thought and consideration that you put into it 😄

@Sh1d0w
Copy link

Sh1d0w commented Aug 12, 2016

@bsclifton No problems, thank you for your time. I will keep eye on this thread as I became very curious about the outcome 😄

@bsclifton
Copy link
Member Author

UPDATE: the electron route is a much longer term route. The great changes implemented by @Sh1d0w are being refined and will likely be accepted to close this issue 😄

For more info or to participate, check out his PR #3133

@bsclifton
Copy link
Member Author

bsclifton commented Sep 5, 2016

@Sh1d0w I closed #3133 after making progress with Windows API route. Shortly after, I ended up getting stuck again 😦

After talking with the team, we'd like to manually render the content for Windows (and revisit the Windows API route at a future date).

I have your commits pulled into my branch and will use them as a starting point 😄 I'll be trying to match the above that @bradleyrichter created (may include small CSS tweaks) and will also be adding a menu (mockup TBD).

@Sh1d0w
Copy link

Sh1d0w commented Sep 5, 2016

@bsclifton Cool I am glad I could help in some way. I hope you guys don't release this as windows only feature, as in my branch the component I've wrote can be reused for Linux build as well. Personally for each version of Brave I am building it from my branch so I can get a compact and polished look.

But it will be good to see it in the official build as well. Please don't leave Linux version behind and consider this for the 1.0.0 release :)

@bsclifton bsclifton modified the milestones: 0.12.1dev, 1.0.0 Sep 5, 2016
bsclifton pushed a commit that referenced this issue Sep 7, 2016
@bsclifton
Copy link
Member Author

Definitely not perfect, but made some great progress matching the styles w/ CSS:

Windows 7 look
windows7

Windows 10 look (will be also be used for Windows 8/8.1)
windows10

cc: @bradleyrichter

I'll get started on the menu control tomorrow 😄

@bsclifton bsclifton self-assigned this Sep 8, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
design A design change, especially one which needs input from the design team. feature/titlebar OS/Windows QA/checked-Win32
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants