Skip to content

Instantly share code, notes, and snippets.

@a-one-d-one
Last active April 23, 2018 00:08
Show Gist options
  • Save a-one-d-one/48144fa28df00143afee05890d6cec33 to your computer and use it in GitHub Desktop.
Save a-one-d-one/48144fa28df00143afee05890d6cec33 to your computer and use it in GitHub Desktop.
module.exports.showTabTitle = (state, frameKey) => {
const frame = frameStateUtil.getFrameByKey(state, frameKey)
if (frame == null) {
return false
}
const isNewTabPage = frameStateUtil.frameLocationMatch(frame, 'about:newtab')
const isActive = frameStateUtil.isFrameKeyActive(state, frameKey)
const isPartition = partitionState.isPartitionTab(state, frameKey)
const isPrivate = privateState.isPrivateTab(state, frameKey)
const secondaryIconVisible = !isNewTabPage &&
(isPartition || isPrivate || isActive) &&
tabUIState.showTabEndIcon(state, frameKey)
// If title is being intersected by ~half with other icons visible
// such as closeTab (activeTab) or session icons, do not show it
if (isEntryIntersected(state, 'tabs', intersection.at46) && secondaryIconVisible) {
return false
}
// title should never show at such intersection point
return !isEntryIntersected(state, 'tabs', intersection.at40)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment