Raathigesh
Raathigesh

Reputation: 2336

Electron JS kiosk mode with touch screen

We are working on a customer facing electron app which should run in kiosk mode. The application runs on a touch enabled device with windows 10.

Even when the app is in kiosk mode, users can easily get into the OS by using the swipe gestures (Swipe left and Swipe right) of the OS.

What is the ideal way to lock down the app and prevent users from interacting with the OS?

Upvotes: 6

Views: 17743

Answers (5)

Ponzio Pilato
Ponzio Pilato

Reputation: 325

If you have windows Home and you don't have gpedit.msc (even if you can install using https://www.itechtics.com/enable-gpedit-windows-10-home/)

I found this working solution:

https://www.tenforums.com/tutorials/48507-enable-disable-edge-swipe-screen-windows-10-a.html

Upvotes: 0

tjaska
tjaska

Reputation: 130

What I've done to disable the swipe functionality of Windows is to launch our kiosk application instead of explorer.exe.

So, we often deal with multiple displays and many of our apps are written for chrome browser. That means an automated kiosk will have to run a script that launches full screen incognito/kiosk browser instances on two or more displays. We use AutoHotkey to automate the placement and fullscreening of displays, as well as running a watchdog script that monitors for possible browser crashes and popups.

Unintended defocusing by the OS is the last thing we want.

Anyway, to replace the explorer with your app, I've found this regedit to work:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Shell"="D:\\path\\to\\your\\appFile.bat"

Copy that into a .txt file, rename the extension to .reg and run it.

To revert:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
"Shell"="explorer.exe"

Since windows cannot run an .ahk file, we just run a .bat file that runs .ahk file, that in turn runs all the browsers and does all the other initialization magic.

For remote work, we do the same as user Bink mentioned: bring up run dialog and run explorer.exe. When done, reboot.

Upvotes: 2

Bink
Bink

Reputation: 176

A method I've used since Windows 8, is to kill the explorer.exe process shortly after login. Achieved with a scheduled task, set to run 20-30 seconds after login, with a command like this: taskkill /F /IM explorer.exe

If you need to work on the system, remote in or connect a keyboard and send CTRL + ALT + Del to bring up Task Manager. Go to File > Run new task. In the Create new task dialogue, enter explorer and hit Enter.

When done, reboot the system and all is back to normal.

Upvotes: 3

Rastographics
Rastographics

Reputation: 390

I was able to disable touchscreen gestures for edge of screen by editing a group policy value:

  1. RUN gpedit.msc from the Run box
  2. Computer Configuration > Administrative Templates > Windows Components > EdgeUI > Allow Swipe: DISABLE

Upvotes: 4

Tim
Tim

Reputation: 8186

There doesn't appear to be a way to disable touch screen gestures in Windows 10.

If you don't need the full node integration offered in electron, ie. your app could run entirely in Chrome you can run it from a cheap Android dongle and lock it down much more easily. I've done this a few times and there are apps which let you add a password, etc.

Alternatively, you could listen for the blur event on your BrowserWindow which is fired when your app loses focus. At that point you may be able to set it into the foreground again:

const mainWindow = require('electron').remote.getCurrentWindow();

mainWindow.on('blur', () => {
  mainWindow.restore();
  mainWindow.focus();
  mainWindow.setKiosk(true);
});

Upvotes: 6

Related Questions