Toggling devtools out of the box


#1

Hi all -

I have a fullscreen electron app being used at a venue I work from that I helped make. They are complaining of some errors but I can’t replicate the error, so I want to add devtools so when I log in remotely with teamviewer and debug from there (unless someone has some better idea that seems best way). Problem is, only way I can get devtools to work is use the line in main.js (mainWindow.webContents.openDevTools()) but that means the app launches with devtools already open.

I want to be able to toggle the devtools via keypress. I have found the code snippet below, but while the reload function works (f5_, the devtools don’t open (f12 but i’ve tried assigning other keys too).

Some people have suggested cmd+shift+I (on a mac) but this does nothing either. What I can’t work out is if that requires the electron-debug module (https://github.com/sindresorhus/electron-debug) which I did try but it caused some problems with my node, and because I’m up against it I want to avoid having to go down that road for now. So does electron allow toggling of devtools somehow without extra modules?

Many thanks for your help