mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
atom project open in their own windows and behave more sanely
This commit is contained in:
@@ -202,6 +202,7 @@ class AtomApplication extends EventEmitter {
|
||||
|
||||
openWithOptions (options) {
|
||||
const {
|
||||
projectSettings,
|
||||
initialPaths,
|
||||
pathsToOpen,
|
||||
executedFrom,
|
||||
@@ -256,6 +257,7 @@ class AtomApplication extends EventEmitter {
|
||||
profileStartup,
|
||||
clearWindowState,
|
||||
addToLastWindow,
|
||||
projectSettings,
|
||||
env
|
||||
})
|
||||
} else if (urlsToOpen.length > 0) {
|
||||
@@ -819,6 +821,7 @@ class AtomApplication extends EventEmitter {
|
||||
window,
|
||||
clearWindowState,
|
||||
addToLastWindow,
|
||||
projectSettings,
|
||||
env
|
||||
} = {}) {
|
||||
if (!pathsToOpen || pathsToOpen.length === 0) return
|
||||
@@ -853,7 +856,7 @@ class AtomApplication extends EventEmitter {
|
||||
}
|
||||
|
||||
let openedWindow
|
||||
if (existingWindow) {
|
||||
if (existingWindow && projectSettings == null) {
|
||||
openedWindow = existingWindow
|
||||
openedWindow.openLocations(locationsToOpen)
|
||||
if (openedWindow.isMinimized()) {
|
||||
@@ -878,6 +881,7 @@ class AtomApplication extends EventEmitter {
|
||||
}
|
||||
if (!resourcePath) resourcePath = this.resourcePath
|
||||
if (!windowDimensions) windowDimensions = this.getDimensionsForNewWindow()
|
||||
|
||||
openedWindow = new AtomWindow(this, this.fileRecoveryService, {
|
||||
initialPaths,
|
||||
locationsToOpen,
|
||||
@@ -888,6 +892,7 @@ class AtomApplication extends EventEmitter {
|
||||
windowDimensions,
|
||||
profileStartup,
|
||||
clearWindowState,
|
||||
projectSettings,
|
||||
env
|
||||
})
|
||||
this.addWindow(openedWindow)
|
||||
|
||||
@@ -22,6 +22,7 @@ class AtomWindow extends EventEmitter {
|
||||
this.safeMode = settings.safeMode
|
||||
this.devMode = settings.devMode
|
||||
this.resourcePath = settings.resourcePath
|
||||
this.projectSettings = settings.projectSettings
|
||||
|
||||
let {pathToOpen, locationsToOpen} = settings
|
||||
if (!locationsToOpen && pathToOpen) locationsToOpen = [{pathToOpen}]
|
||||
@@ -55,18 +56,12 @@ class AtomWindow extends EventEmitter {
|
||||
if (this.shouldHideTitleBar()) options.frame = false
|
||||
this.browserWindow = new BrowserWindow(options)
|
||||
|
||||
let projectSettings
|
||||
|
||||
if (this.atomApplication.projectSettings != null) {
|
||||
projectSettings = this.atomApplication.projectSettings
|
||||
this.projectSettings = this.atomApplication.projectSettings
|
||||
}
|
||||
|
||||
Object.defineProperty(this.browserWindow, 'loadSettingsJSON', {
|
||||
get: () => JSON.stringify(Object.assign({
|
||||
userSettings: this.atomApplication.configFile.get(),
|
||||
projectSettings
|
||||
}, this.loadSettings)),
|
||||
configurable: true
|
||||
})
|
||||
this.loadDataOverProcessBoundary()
|
||||
|
||||
this.handleEvents()
|
||||
|
||||
@@ -159,6 +154,16 @@ class AtomWindow extends EventEmitter {
|
||||
return paths.every(p => this.containsPath(p))
|
||||
}
|
||||
|
||||
loadDataOverProcessBoundary() {
|
||||
Object.defineProperty(this.browserWindow, 'loadSettingsJSON', {
|
||||
get: () => JSON.stringify(Object.assign({
|
||||
userSettings: this.atomApplication.configFile.get(),
|
||||
projectSettings: this.getProjectSettings()
|
||||
}, this.loadSettings)),
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
|
||||
containsPath (pathToCheck) {
|
||||
if (!pathToCheck) return false
|
||||
const stat = fs.statSyncNoException(pathToCheck)
|
||||
|
||||
Reference in New Issue
Block a user