Okay i had the same issues. as far as i can remember in early electron version we could do this without any problems but not it's not working in new version i don't know the reason. in kiosk
mode also this is not working we can change windows using Alt+Tab
in windows but kiosk
working in mac OS where it blocking all the Command+Tab
function witch Switching between windows.
KiosK
so as a solution in windows i had use alternative method. what i did is i have written a python code and compiled it into exe
and then when ever i wants block user using Alt+Tab
i am running that script using node command
function execute() {
var exePath =process.platform === "win32"? path.resolve(__dirname, './runner.exe'):null;
runner = child.execFile(exePath, function(error, stdout, stderr){
if (error !== null) {
runner.kill('SIGKILL');
}
});
};
Killing the task when app close
if (process.platform !== 'darwin') {
child.exec(`taskkill -F -T -PID ${runner.pid}`);
kill(runner.pid, 'SIGKILL',(err)=>{
app.quit();
});
}
Python Code
import keyboard
keyboard.add_hotkey("alt + tab", lambda: None, suppress =True)
keyboard.wait()
and that was it i am using kiosk
when i am using Mac or Linux and when i am in windows i am running my exe where it will block Alt+Tab