Make electron Developer Tools window to always open at screen position I specify


#1

I’m sorry to cross-post this from SO, but since I’m not getting any help there:

I’m learning to do develop with electron in WebStorm. When I show the electron Developer Tools (undocked or detached), either by the menu (View…Toggle Developer Tools) or programmatically, the window always comes up in the same spot on my laptop monitor. I would like it to work like nw.js development, which remembered where I drag the Developer Tools window to and always comes up at that spot (on a second monitor) in subsequent runs.

I thought a programmatic solution sounded possible from the electron documentation, using code like below to get a handle on the window and then I could move the window programmatically:

const {app, BrowserWindow} = require('electron')

let win = null
let devtools = null

app.once('ready', () => {
  win = new BrowserWindow()
  devtools = new BrowserWindow()
  win.loadURL('https://github.com')
  win.webContents.setDevToolsWebContents(devtools.webContents)
  win.webContents.openDevTools({mode: 'detach'})
})

However, when I try the above code, I get this error: TypeError: appWindow.webContents.setDevToolsWebContents is not a function

I’m running Sierra on a MacBook Pro, in case that matters.

I hate having to manually switch spaces on my second monitor, then drag the Developer Tools window where I want it, every time I run my app during development. I just want the Developer Tools window to show up where I tell it to. Any ideas?