microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.65k stars 29.43k forks source link

Mac: Provide a setting to hide the title bar and inline the window controls #12377

Open orta opened 8 years ago

orta commented 8 years ago

Hello there, a lot of the standard apps in recent versions of macOS have started to inline their titlebar into their tabs, menu buttons etc. I assume this is mainly to save vertical space on laptops. However, like all UI trends, apps that don't quite keep up end up feeling old-fashioned πŸ‘―

I started a fork of VS Code that uses the inline style:

screen shot 2016-09-21 at 12 59 09

There needed to be a few changes:

Fork: https://github.com/orta/vscode/tree/inline-titlebar Changes: https://github.com/orta/vscode/compare/master...mac-titlebar-inline

I realise that VS Code is a cross-platform project, and so these changes should probably only be applied in the context of macOS, which I'm happy to look into with some advice (I don't have a windows/linux machine to hand for example).

I also know that no-one wants big unexpected UI changes on their OSS projects, so I've not made it as a PR, but I'd love to know if/what I can do to move this upstream?

Sidenote: If someone can tell me how, I'm happy to make a downloadable build for people to try too, I couldn't find a way to do it - I'm still quite fresh to npm projects.

orta commented 8 years ago

Here's a GIF of me prodding and poking around with it too

2016-09-21 13_19_25

joaomoreno commented 8 years ago

Good Lord, this looks amazing.

bpasero commented 8 years ago

@orta cool! how does it work though if you have a whole bunch of tabs open to the top? no more window drag?

orta commented 8 years ago

Looks like right now the tabs themselves are draggable as the window - which causes bugs as this interferes with re-ordering tabs normally. I can declare them as undraggable easily.

An option here is to have space above the tabs ( Chrome does this for example )

screen shot 2016-09-21 at 16 09 31

joaomoreno commented 8 years ago

Which is still pretty ugly. But you can always drag it from the space around the Close, Minimize and Maximize buttons, can't you?

orta commented 8 years ago

Yep, these are the current draggable regions ( I just removed tabs from being draggable )

The traffic lights, and if there is a sidebar open, the title of the sidebar screen shot 2016-09-21 at 16 34 21

All of the sidebar: screen shot 2016-09-21 at 16 35 17

Any non-tab content of the top bar, including around the buttons on the right: screen shot 2016-09-21 at 16 35 13

joaomoreno commented 8 years ago

Oh wow. That's just awesome.

PS: I learned something today: traffic lights!

bpasero commented 8 years ago

@orta is it possible to make the side bar size smaller and still fit the window icons? I feel like we loose a lot of horizontal space to accomodate for the icons. I am not sure how people would like that if they care about space for the editor... and in fact, many have asked for a way to hide that sidebar too.

orta commented 8 years ago

With respect to smaller width, it can, but this is roughly the minimum to ensure that there is a consistent margin applied to the buttons.

Which is roughly the same as say:

screen shot 2016-09-21 at 17 35 20 screen shot 2016-09-21 at 17 35 43 screen shot 2016-09-21 at 17 38 02 screen shot 2016-09-21 at 17 38 17

e.g. this is 50px as current:

screen shot 2016-09-21 at 17 34 34

As a counter-argument, the new Slack beta is more aggressive with its management of the titlebar:

screen shot 2016-09-21 at 17 36 22

which is the same x, y as

screen shot 2016-09-21 at 17 44 21

It does stick out a bit more, as those positions are the default for not-inlined titlebars ( e.g. normal stick a bar on the top ones, like current ) - with that it is possible to reduce the size down to 68px

screen shot 2016-09-21 at 17 41 21


Other possibilities are less trivial, Xcode for example has these sidebar menu items above the contextual sidebar

screen shot 2016-09-21 at 17 45 53

which makes them togglable along with the sidebar when you want more focus:

screen shot 2016-09-21 at 17 46 50

which, if you'll excuse my quick "rendering" in CSS could look something on the lines of:

screen shot 2016-09-21 at 17 51 13

There's potential in that, which I can jam on if you're interested (and make a higher fidelity version tomorrow ) - though I'd recommend using the other insets for the traffic lights, then there's a nice visual consistency along the top row


joaomoreno commented 8 years ago

Love the depth you go into this.

I don't really feel the same way as @bpasero and think the width is good. We can even show more in that bar, given the added width, like the keyboard shortcuts to open each viewlet (like Slack) or a label.

hochem commented 8 years ago

Hello! I've also been experimenting with a different UI for vscode and I really like the concepts shown here. I had some very similiar ideas:

vscode_frameless1

But with the completely titlebar-less design (tabs starting at window frame) and multiple editors and tabs it's quite hard to find a good solution for window dragging (which should also be consistent with the default macOS implementation).

Currently I am using this design (again very similiar to the latest image of @orta):

vscode

With this design I can easily show and hide the sidebar using a keyboard shortcut and the activitybar isn't taking up extra horizontal space. And there is still a dark titlebar (currently without a title) to drag the window around, but I will probably go back to the default titlebar and just keep the sidebar and activitybar design. This design (or a design where the activity bar can be hidden) would also greatly benefit from a button in the footer (maybe left corner where previously the extensions button was) to toggle the sidebar visibility. I don't have my changes online yet, as they seem quite hacky, are only for the dark theme and they are a part of other changes I made, but if there's any interest, I can isolate and push them.

bpasero commented 8 years ago

@stevencl @bgashler1 fyi

bpasero commented 8 years ago

@orta maybe when the window goes fullscreen we could revert the additional width in the side bar because then you do not need to host the window buttons in there πŸ‘

Tyriar commented 8 years ago

@orta the final screenshot in https://github.com/Microsoft/vscode/issues/12377#issuecomment-248674424 probably can't happen as extensions will be able to contribute viewlets with associated buttons on the activity bar soon (#12163).

orta commented 8 years ago

@hochem - interesting πŸ‘ the inline tabs to the window bar style was something I had considered too! I opted against them for the moment to try and do smaller incremental changes. Mainly so there's less to discuss.

@bpasero - that can happen, for sure, I don't see any current css classes related to being full-screen but that's something I can add to pull it off. I think it makes a lot of sense.

@Tyriar πŸ‘ makes sense


I did some playing around with the production app, this change disables the ability to drag and re-order your editors on the Mac. That could be fixed by adding right click context menus to move them, by adding grab handles to the editor free space or by keeping that to just the command palette commands to move them.

octref commented 8 years ago

@orta Thanks a lot for the work. Can you try hiding status bar (View -> Toggle Status Bar) and also hide sidebar + activity bar with CSS? Just want to see how it looks like.

Also, do you know if it's possible to do iA writer like title bar in Electron? ia

Would be awesome if VSCode has a Zen mode (or distraction-free mode, whatever you name it). This is what I use in Vim: https://github.com/junegunn/goyo.vim

image

orta commented 8 years ago

The titlebar coming and going could be done in electron, but I don't think it would include the animation, I can think of a way to do it in Objective-C, but my guess is that this would require electron changes. I'm also not 100% on how mouse handling would work, but I'm willing to bet there's a nice js callback for that kind of thing, which we can use to trigger it off/on

So I removed all the bits you asked:

screen shot 2016-09-22 at 09 07 05

Aside from the normal hiding stuff, I also indented the start of the tabs for the first editor by ~70px to make them not clash with the traffic lights.

The cantering of your text layout is possible too:

screen shot 2016-09-22 at 09 14 00

standalone:

screen shot 2016-09-22 at 09 18 42

orta commented 8 years ago

Another weird case is that the zoom in/out features feel weird with this, as it changes the width of the sidebar. Could make the sidebar exempt from the zooming? It could be a safe assumption that people aren't zooming to see those icons any larger ( I mainly use it with pair programming to make it easier for others to see the screen )

bpasero commented 8 years ago

I am not sure if that is possible but I do agree that it would be nice πŸ‘

bgashler1 commented 8 years ago

I think it looks visually very cool to inline the title bar. I never liked macOS's native title bar in the default dark theme, because the color contrast is so stark. Very nice work on prototyping this. I have a few usability concerns:

I think it would be cool to explore this provided we can address the usability issues and not just make it look prettier. Spotify is doing this cross-platform, and I mostly like how they did it.

bpasero commented 8 years ago

@bgashler1 this is a feature which to my knowledge only works on Mac

Tyriar commented 8 years ago

@bgashler1 I would have some objections if we tried to mash the macOS traffic lights into the Windows and Linux clients.

bgashler1 commented 8 years ago

@Tyriar we would of course never do that :). When I say what would it look like on other platforms, I mean using their respective native buttons for close, minimize and maximize. Particularly on Windows, this is challenging for reasons I mentioned above. I think as @bpasero it's actually not possible. Spotify does something kind of like this, but it seems they're actually theming the native OS title bar for Windows, whereas on Mac it's an inline title bar.

orta commented 8 years ago

An interesting case for inspiration on what a cross platform version of this would look like comes from some old Firefox designs: http://people.mozilla.org/~shorlander/ux-presentation/ux-presentation.html

http://people.mozilla.org/~shorlander/ux-presentation/01-Firefox-Australis-(Mac).jpg

To pull off a completely cross-platform version of this you'd need to change the way in which tabs are shown highlighted, and TBH, I can't even think of a way to make the windows menu feel right on every window there.

http://people.mozilla.org/~shorlander/blog-images/australis-landing-on-nightly/intro-image-large.jpg

In the end Firefox (and Chrome) ended up removing menus from the windows versions to make it feel consistent. Which I don't really think is probably what you'd want to do here.

FWIW though, there are design precedents in the windows world for Tabs on top of file menus in explorations for File Explorer but I don't know enough of the ecosystem to really have too much insight.

With respect to how Spotify (and the new Slack client) handles this, they have it pretty easy because they don't need to use that top-space for changing content there's always going to be a set number of items in the top space.

How would this work with Windows, since we need to have top app menu (and it's not separate from the window unlike Mac and certain distributions of Linux)?

So I think realistically/optimistically, this would end up being Mac only. Which is why I've tried to keep the scope of changes as small as possible, as no-one wants to be surprised on cross-platform regressions.

When the View Bar (aka Activity Bar) is enabled (and it is by default) the added space for fitting the "traffic lights" take away from the coding space. Users love their space there.

Yep, definitely!

iA writer's approach e.g. hiding toolbars when not needed

I will try to take some time tomorrow to think about how this could work elegantly, they have "no actionable elements" underneath where the titlebar would be ( either something you have scrolled through earlier or blank space ) which makes that problem easier.

The grabbable areas at the top of the window will be variable, since we we would be relying on the tab well.

Nice, TIL'd the terminology. I agree, and from using it, I think that realistically it's going to need some top spacing above the tabs to provide some consistency, off-hand I can't think of any designs like this where there is not a persistent top space.

Moving View Bar buttons to be horizontal instead of vertical as they are now will restrict space we have for it to grow. We are planning on adding additional optional buttons to it soon.

Yeah πŸ‘ cool cool

orta commented 8 years ago

sorry for the long comment - didn't have much time to make some more prototypes

sidenote: I'm still struggling to be able to make a downloadable build, so far I've grokked that I can use gulp vscode-darwin-min to generate the JS, but how can I plug that into an electron shell so that I can ship a version for others to test? ( would love it if you can expand this wiki page with the answers too - this is where I was hoping for the answers )

orta commented 8 years ago

Alright, got a chance to look at this again, I switched the theme to light VS Code to get a sense of what other themes would look like in the style

With indented tabs: screen shot 2016-09-24 at 10 06 06


I also considered what the ability to hide the activity bar might look like

There is a Cocoa (read: Apple provided, and updated per OS) icon that is standard in open dialogues / Safari, that is always used to toggle sidebars

I applied that at the bottom, centered and aligned, with a pretty high opacity in order to not take up too much attention, but to be there if you need it.

screen shot 2016-09-24 at 10 45 08

With a hidden activitybar, this would mean that the title label of the sidebar would need indenting to avoid the traffic lights screen shot 2016-09-24 at 10 26 58

I used debug as the example, as it's the most complicated title in the sidebar. The resizing handling works fine with these changes. The min width would probably need to be updated be the same as it is currently ( e.g. with the current 52px activity bar ) title buttons rest at the traffic lights end naturally.

With both hidden activitybar and sidebar, the tabs would need to be indented screen shot 2016-09-24 at 10 31 53

The left part is not a broken layout, but mid-scroll.


I have some rough ideas in my head about what an animating in/out titlebar might look like, but I can't think of any precedents for it except how apple handles the title + menu in full screen mode - e.g.

if you're on a Mac, it's easier to just of full screen on Safari, then move your mouse up and down from the top of the screen to get the sense.

I'd imagine that we could animate down the tabs + title + activity top-margin over the content at the same time as animating in the titlebar, and the actual text of the editor would stay at the exact same position.

Apple call this a "full size contentview" window e.g. the content goes behind the titlebar, if we can animate the toggle of the title bar visibility, and sync up the animation above it could be possible. I don't know how feasible that is with the electron API though.


For my opinion, I think allowing the activity bar to be hidden is doable, but it comes with quite a bit of complexity. There is no obvious answer to "how do I get it back" once you click the thing to remove it other than go to the menu, but that said, that's the same for the status bar at the bottom, so there's a bit more affordability there.

With respect to the tab heigh, these are now the same heights as Safari and in Sierra's new OS provided tabs - which I don't feel negatively affects it too much.

Took another stab at trying to make a build, and got this far :D but here's the compiled JS if you know what to do on your side to test.

hochem commented 8 years ago

I've also been working on some new concepts again, because with the latest activitybar additions my current design will no longer work. And with this new additions a permanent activitybar makes a lot of sense, but I don't want it to be that wide. I'm quite happy with this concept: vscode_frameless1

@orta Regarding your build issue, can you check, if you got the compiled app in a directory named 'VSCode-darwin' in the parent directory of your vscode source folder? I can compile it without problems and the app is then placed in that folder.

orta commented 8 years ago

Ohhh, I did not expect it in there! Found it - thanks, PR'd an update to the wiki, I skip all intermediary dirs by using z πŸ‘

Build of the above is available for download.

bpasero commented 8 years ago

Lets discuss this for October. I think I can also look into adding a new class to the workbench when you are in fullscreen because then I think the activitybar should not be so wide.

bpasero commented 8 years ago

Unfortunately I am not really able to find out when fullscreen changes from within the renderer, if someone has an idea, please let me know.

orta commented 8 years ago

In theory you may be able to use a check if the screen size for the window is the same as the content frame, in Electron the content frame is made to be full sized during a transition to full screen

bpasero commented 8 years ago

@orta I need an event...

orta commented 8 years ago

A VSCodeWindow has a reference to it's BrowserWindow which can emit events for the full screen toggles - they probably work like these events

bpasero commented 8 years ago

A bit ugly because you cannot listen from the renderer side, but yeah, looks like a valid option.

bpasero commented 8 years ago

I pushed a change to have a fullscreen class on the workbench container that toggles with this state. I suggest to hook it up with the explorations. I would not expect to see window buttons when I am in fullscreen.

orta commented 8 years ago

Cool, no problem, at least that problem was already solved for us

screen shot 2016-09-26 at 10 06 38

I'll update/revert the activitybar sizes/margins in full screen scope πŸ‘

bpasero commented 8 years ago

Ah nice to see that Mac OS takes care. Yeah, was referring mainly to paddings.

orta commented 8 years ago

Alright, I've given this an update, I've also scoped all of the changes to exist only for macOS, and rebased to the current master

https://github.com/orta/vscode/compare/master...mac-titlebar-inline

Window'd screen shot 2016-09-26 at 11 11 34

Cropped full screen screen shot 2016-09-26 at 11 13 52

TBH, the resizing is a little bit janky, the notification occurs after the change of state (and then has to cross the IPC barrier) and so it moves after the change. It does animate the transition though, so the changes feel deliberate.

Build here

bpasero commented 8 years ago

@orta cool, can we put this behind a setting so that it is possible to play around with it?

orta commented 8 years ago

I can, I think this would probably work best by being able to set another css class on the workspace - as most changes exist in the CSS code base. Does that sound reasonable?

bpasero commented 8 years ago

@orta yes, but nevertheless I think it needs a reload of the window (actually a restart) to set the proper window options for the inline title bar.

On the main side you can get hold of the IConfigurationService to read from the config and on the main side you can do so as well to add a new class to the workbench (using IPartService.addClass).

Maybe it would make sense to start a PR to discuss the code changes.

orta commented 8 years ago

πŸ‘ I've got pretty far on that ^ technique - I'll start a PR once I've got it working

smlombardi commented 8 years ago

@orta I edited the workbench.main.css file in your build (as I have in the actual Code 1.5.3) to color the status bar and hide the smiley face. However, your build now warns of a corrupt install (the actual Code does not). Is there a way I can edit the css without causing this?

orta commented 8 years ago

@smlombardi I'm afraid I don't know, if I had to guess, it's an artefact of the build process - I'm pretty sure I've been building those as dev releases. So they may have additional checks which are stripped in release builds

seiflotfy commented 8 years ago

can we please have that :D

jtlowe commented 8 years ago

I like this idea of maximizing the editor space. My thoughts:

patrys commented 8 years ago

@jtlowe good arguments but the "wide sidebar" is now a common thing in many macOS apps. I don't think ~25px of horizontal space is worth trying to come up with something different. I know it's a matter of taste but I'd say it looks better with more whitespace.

jtlowe commented 8 years ago

@patrys My feeling is that there's not a lot to gain from the proposed wider sidebar designs, in this specific application within its current design. I understand the good points made on keeping vscode modern, but I caution against this being the driving factor. IMO, a great design is one that is logical and natural, but the latest couple of design seem forced. I know there's a good solution to this, and hope it's one that is independent of the sidebar width.

And please don't hate me while I lightheartedly rephrase your comment a little bit in favor of the titlebar:

"I don't think ~25px of vertical space is worth trying to come up with something different"

be5invis commented 8 years ago

But I do not use tabs, how to drag if there is no title bar?

orta commented 8 years ago

With workbench.editor.showTabs as false, the entire top section is draggable - we covered that in the PR πŸ‘