Electron tips and tricks on windows 10

2017-02-26 23:45:25

Electron is a developed framework on Node.js and provides wide access to native environment cross platforms.

I had some problems in developing app on windows 10 (in Tablet mode) with touchable screen.

1. Ignore two finger zoom

  • create a shortcut of your app.exe
  • right click on shortcut, click on properties, in General tab find target and add app.exe --kiosk -fullscreen --incognito --disable-pinch --overscroll-history-navigation=0

2. I needed to start application when system restart for any reason at startup. so you can add application to startup.

  • in main.js file:
                var scl = 1; 
    mainWindow = new BrowserWindow({ screen: electron.screen.getAllDisplays()[2], // depends on your display x:1920, width: 1080*scl, height: 1920*scl, fullscreen:true,minimizable:false,resizable :false,closable :false});
  • open Run and run shell:startup, add shortcut to opened window. but not enough. :(
  • when system restarting in Tablet mode there is not applications allows to be in front. so after a while searching in Internet I find out that there is an application to allows you to run keyboard shortcut in command line. keystuff

  • add below code block in createWindow function
                setTimeout(function(){
                var child = require('child_process').execFile;
                var executablePath = "/path/to//keystuff.exe";
                var parameters = ["Alt-Tab"];
    
                child(executablePath, parameters, function(err, data) {
    
                });
            },1000);
            
  • 3. If you pull data from api services you may need add:

                app.commandLine.appendSwitch('ignore-certificate-errors');
            

    Happy Coding!

    Tags Cloud

    Electron.atom.io

    Windows 10

    Tablet Mode