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

Fixes #3068 Implements 'Switch to new tabs immediately' setting #3729

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js/components/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class Window extends React.Component {
if (this.props.frames.length === 0) {
windowActions.newFrame({
location: config.defaultUrl
})
}, true)
} else {
this.props.frames.forEach((frame) => {
windowActions.newFrame(frame)
windowActions.newFrame(frame, true)
})
}
}
Expand Down
14 changes: 10 additions & 4 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const messages = require('../constants/messages')
const debounce = require('../lib/debounce.js')
const getSetting = require('../settings').getSetting
const importFromHTML = require('../lib/importer').importFromHTML
const AppUrlUtil = require('../lib/appUrlUtil')
const UrlUtil = require('../lib/urlutil')
const urlParse = require('url').parse
const currentWindow = require('../../app/renderer/currentWindow')
Expand Down Expand Up @@ -169,11 +170,8 @@ const newFrame = (frameOpts, openInForeground, insertionIndex) => {
frameOpts = {}
}
frameOpts = frameOpts.toJS ? frameOpts.toJS() : frameOpts

if (openInForeground === undefined) {
openInForeground = true
}
frameOpts.location = frameOpts.location || config.defaultUrl

if (frameOpts.location && UrlUtil.isURL(frameOpts.location)) {
frameOpts.location = UrlUtil.getUrlFromInput(frameOpts.location)
} else {
Expand All @@ -187,6 +185,14 @@ const newFrame = (frameOpts, openInForeground, insertionIndex) => {
}
}

if (openInForeground === undefined || openInForeground === null) {
openInForeground = getSetting(settings.SWITCH_TO_NEW_TABS)
// About urls (expect about:newtab) should open in foreground
if (!openInForeground && AppUrlUtil.isSourceAboutUrl(frameOpts.location) && frameOpts.location !== 'about:newtab') {
openInForeground = true
}
}

const nextKey = incrementNextKey()
let nextPartitionNumber = 0
if (frameOpts.partitionNumber) {
Expand Down