Skip to content

Instantly share code, notes, and snippets.

@chadbailey59
Last active July 18, 2017 08:40
Show Gist options
  • Save chadbailey59/9271085 to your computer and use it in GitHub Desktop.
Save chadbailey59/9271085 to your computer and use it in GitHub Desktop.
Auto hide your Atom tab bar if only one tab is open.
# Put this in your init script (Atom ➞ Open Init Script)
tabs = atom.workspaceView.find('.tab-bar')
tabs.on "DOMNodeInserted", ->
# find each tab bar
if (tabs.find('li').length) > 1
tabs.slideDown(300)
else
tabs.slideUp(300)
@andymcintosh
Copy link

You can accomplish this with styles too if you so desire.

Add this to your style sheet (Atom ➞ Open Your Stylesheet)

.tab-bar li:only-child {
  display: none !important;
}

@sandover
Copy link

The script approach seems to have bit-rotted and the CSS approach doesn't actually collapse the tab bar area -- it simply hides the tab UI element. Any updated versions of this?

@mekkanizer
Copy link

F#$k both methods, first one does not work, second one only hides the tabs, not the tab bar, which I find insanely stupid. Shame on you @andymcintosh for such a retarded solution

@mekkanizer
Copy link

Found it.
1. Atom > Preferences
2. Click on "Packages"
3. Search for "tabs" package
4. Click the "Settings" button for the "tabs" package.
5. Untick "Always Show Tab Bar"
And the styling solution to really hide tab bar:
.tab-bar { height: 0px; visibility: hidden; }

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