Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

More title-bar options (macOS) - #13616

Merged
simurai merged 23 commits into
masterfrom
sm-custom-title-bar
Feb 22, 2017
Merged

simurai merged 23 commits into
masterfrom
sm-custom-title-bar

Conversation

@simurai

@simurai simurai commented Jan 14, 2017 •

Copy link
Copy Markdown
Contributor

Description of the Change

This replaces the current "Use Custom Title Bar" checkbox with a "Title Bar" dropdown. It has the following options:

  • native (default)
  • custom adapts to themes
  • custom-inset New! has more padding
  • hidden New! completely hidden

screen shot 2017-01-14 at 4 30 55 pm

Native

title-bar

Custom

title-bar 2

Custom Inset (new)

title-bar 3

Hidden (new)

title-bar 4

Alternate Designs

I also tried to add a "hide title-bar but keep the traffic lights" option:

title-bar-custom

Unfortunately there are a few edge cases that would make the UI look broken. It's something that a package, theme or styles.less could provide when custom-inset is used.

Another example with the tool-bar package taking the role of a "title bar":

title-bar-custom 2

Why Should This Be In Core?

Needs access to the BrowserWindow API.

Benefits

  • Provides more title-bar variations.
  • Themes can adapt to the different title-bar modes. Before there was no way to tell.
  • Allows packages/themes to customize even further, like hide the title-bar but keep the traffic lights.

Possible Drawbacks

When hiding the title-bar, managing the window needs to be done with the keyboard or from the menu. Dragging the window needs to be done with the status-bar. Not really a drawback since it's a choice and not the default.

Applicable Issues

This PR contiues from #10208 (Hide title bar on OS X) and #11790 (already merged).

/cc @atom/feedback @atom/design

@simurai simurai added mac Issues that occur on macOS but not on other platforms. needs-review needs-testing ui labels Jan 14, 2017
This was referenced Jan 14, 2017
@net

net commented Jan 14, 2017

Copy link
Copy Markdown

When hiding the title-bar, managing the window needs to be done with the keyboard or from the menu. Dragging the window needs to be done with the status-bar (or tree-view and tab-bar, but those could be hidden too). Not really a drawback since it's a choice and not the default.

Not entirely true. To move a window on macOS without a title bar, you can hover over the edge of the window so the resize arrow appears, then drag perpendicular to the direction of the resize arrow. For example, when hovering over the left or right edge, drag vertically instead of horizontally. (This also works for windows with a title bar, of course.)

@p-e-w

p-e-w commented Jan 14, 2017

Copy link
Copy Markdown
Contributor

Since the traffic lights are gone now, it appears that the hidden option has nothing left that makes it macOS-specific – so why not enable that option for Linux and Windows as well?

If the only concern is rendering of the menu bar, I'd be more than happy with the menu bar being completely disabled in hidden mode (I don't use it anyway – the command palette is enough) if only it meant I could get rid of the eyesore that the light-colored titlebar is in GNOME, and I doubt I'm the only one who feels that way.

@simurai

simurai commented Jan 17, 2017 •

Copy link
Copy Markdown
Contributor Author

@net To move a window on macOS without a title bar, you can hover over the edge of the window so the resize arrow appears, then drag perpendicular to the direction of the resize arrow. For example, when hovering over the left or right edge, drag vertically instead of horizontally.

Wow.. 🙀 I didn't know that. That's actually really clever. Had to gif it:

dragging

@simurai

simurai commented Jan 17, 2017

Copy link
Copy Markdown
Contributor Author

@p-e-w I doubt I'm the only one who feels that way.

Not the only one: #13249. And I agree too. But maybe better to create a new PR for Windows/Linux.

@saschaeggi

Copy link
Copy Markdown

@simurai great news, cheers from Zurich :)

@jdsimcoe

jdsimcoe commented Mar 9, 2017

Copy link
Copy Markdown

@simurai In my zero-title-bar plugin I was able to use the empty space to the right of the tab-bar area to allow dragging:

https://github.com/jdsimcoe/zero-title-bar

I simply set .tab-bar .tab to -webkit-app-region: no-drag;. This ensured that tabs retained their default behavior. It's worth considering adding support for this when hidden mode is activated.

@lexicalunit

lexicalunit commented Mar 9, 2017 •

Copy link
Copy Markdown
Contributor

@jdsimcoe, it seems like your plugin is a fork with a small modification of my no-title-bar package.

My copyright is even in your repository's commit history.

I am perfectly fine with you or anyone copying, modifying, and distributing my original codebase. However I am not sure that you've satisfied the following provision of the MIT license in the case of zero-title-bar:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

Considering a substantial portion of your package is my code, if you wouldn't mind please updating your repository's LICENSE and README to reflect as much, I would be grateful!

You might also be interested in the recent PR that author @thfrlw submitted to my package which provides the same functionality of being able to drag the window using the empty space to the right of non-full-width tab-bars. It does so in a way that does not force a tab height as your package does.

Your zero-title-bar:

zero

See how the tab hight has been incorrectly adjusted to be wider than intended by the theme I am using?

My no-title-bar:

no

With @thfrlw's solution, I do not have this problem. Perhaps your modification would best be implemented within no-title-bar. I would be happy to accept a PR or respond to an issue you are having with my package. Cheers!

@jdsimcoe

jdsimcoe commented Mar 9, 2017

Copy link
Copy Markdown

@lexicalunit I meant you know direspect, so sorry for lousing that up. I adjusted my README to reflect that my plugin is based on your no-title-bar plugin:

https://github.com/jdsimcoe/zero-title-bar

I adjusted the license and put my name in there because I wasn't sure how I should probably document the LICENSE portion but will change it any way that satisfies your request.

@lexicalunit

lexicalunit commented Mar 9, 2017 •

Copy link
Copy Markdown
Contributor

Thank you @jdsimcoe! I assumed you had no ill-intention. I think diversity in open source is an asset and look forward to seeing where you take zero-title-bar as you maintain it and it diverges from my package in potentially exciting ways.

I have also forked others' source code in the past and in one particular instance I modified, over time, their source to the point where it was nearly an entirely different codebase of my own writing. Yet I maintained some prominent documentation about the history of the source code in good faith.

Thank you again for the quick turn around on this issue! 🎉

@jdsimcoe

jdsimcoe commented Mar 9, 2017

Copy link
Copy Markdown

@lexicalunit 👍 Yeah I'm going to dive into the new beta features and explore monkeying with custom-inset styles per @simurai's comments above:

screenshot

@lexicalunit

lexicalunit commented Mar 9, 2017 •

Copy link
Copy Markdown
Contributor

Awesome! Yeah this PR has some big implications for both of our packages, @jdsimcoe. I have been meaning to take some time to explore different options for the direction of my package in the new Atom beta using the new hidden custom title bar setting. Thank you @simurai for this feature, I know I'm going to love it!

@simurai

simurai commented Mar 10, 2017

Copy link
Copy Markdown
Contributor Author

@jdsimcoe In my zero-title-bar plugin I was able to use the empty space to the right of the tab-bar area to allow dragging
@lexicalunit being able to drag the window using the empty space to the right of non-full-width tab-bars.

Yeah, was considering that but then decided against it. The reason is that you can't rely on the empty space because it keeps changing. If your muscle memory is trained to move towards the tab bar, it might be frustrating to realized that the tab bar is full and now you have to move your mouse down to the status bar. Probably better to let themes/packages enable it if the tab bar has some padding around the tabs. Or add some padding on the right (maybe with a border, icon on hover) so that you always know there is a place to drag.

Anyways, with this PR there are now 3 CSS classes that you could use to customize the tabs or other things:

  1. .custom-title-bar 👉 traffic-lights height: 22px
  2. .custom-inset-title-bar 👉 traffic-lights height: 38px
  3. .hidden-title-bar 👉 no traffic-lights

@jdsimcoe

Copy link
Copy Markdown

Fabulous, @simurai! 👏 Thanks for the color!

@eboracus

Copy link
Copy Markdown

For the ability to still drag the window with little or no (or unreliable) empty space available, would it be a good suggestion to introduce a hotkey to change dragging a tab from move tab position to move entire window position.

So for example click and drag on any tab and it behave as it does now and moves the relative position of that particular tab, but hold down say alt + click and drag moves the whole window. Similar to alt + click anywhere on window to drag it on some platforms.

Having this off by default and toggle-able would allow the user to know what is needed to move the window, as opposed to introducing a 'hidden' method.

@lexicalunit

Copy link
Copy Markdown
Contributor

@eboracus that actually sounds like a neat idea! I may take a crack at it this weekend.

@j-f1

j-f1 commented Mar 10, 2017

Copy link
Copy Markdown

@lexicalunit You could also toggle the visibility of the tab bar to show a draggable area.

@thfrlw

thfrlw commented Mar 14, 2017

Copy link
Copy Markdown

Managed to get this, using One light theme, hidden title bar, flex-tool-bar package and some custom stylesheets.
screen-shot-2017-03-14-at-15 03 21

@simurai

simurai commented Mar 14, 2017

Copy link
Copy Markdown
Contributor Author

@thfrlw Hehe.. probably a little against Apple's HIG, but clever hack. 😆

Do the custom traffic lights actually work, or would they still need to be wired up?

@thfrlw

thfrlw commented Mar 14, 2017 •

Copy link
Copy Markdown

It does work, here is a snippet from toolbar.cson, it explains how.

{
	"type": "button",
	"callback": "window:close",
	"className": "window-ctrl, red"
},
{
	"type": "button",
	"callback": "application:minimize",
	"className": "window-ctrl, green"
},
{
	"type": "button",
	"callback": "window:toggle-full-screen",
	"className": "window-ctrl, yellow"
}

@lee-dohm

Copy link
Copy Markdown
Contributor

Since this PR is merged and this discussion is not directly regarding the PR itself, could we move it to Discuss? It will also make these suggested enhancements more visible to the community, I think 😀

@jdsimcoe

Copy link
Copy Markdown

👍

@Wolfr

Wolfr commented Mar 15, 2017

Copy link
Copy Markdown

Haha @thfrlw that is awesome :)

@xtoolkit

Copy link
Copy Markdown

hi
my customize for hide titlebar: xtoolkit/arshen-ac#1

@danielbayley

danielbayley commented Jul 31, 2017 •

Copy link
Copy Markdown
Contributor

@thfrlw Neat! Mind sharing your styles? I kind of got it working, but the behaviour doesn't quite match the native controls…

@thfrlw

thfrlw commented Aug 2, 2017

Copy link
Copy Markdown

@danielbayley Thanks!
I actually stoped using custom buttons & use native buttons now with styling around it.
You should check this gist. It might have something useful.
https://gist.github.com/thfrlw/8a89b1c93ee2bf27ebedcbbdc5ce5ade

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

mac Issues that occur on macOS but not on other platforms. needs-testing ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.