Skip to content

screen.highlight closes Electron window #505

Description

@s1hofmann

Version
3.1.1

Short overview
When calling screen.highlight in an Electron application quits the Electron application

Issue occurs on

  • Virtual machine
  • Docker container
  • Dev/Host system

macOS Ventura, 13.3.1

Steps to reproduce error
A simple Electron application with something like

const { app, BrowserWindow } = require('electron')
const {screen, Region} = require("@nut-tree/nut-js");

const path = require('path')

// modify your existing createWindow() function
const createWindow = () => {
  const win = new BrowserWindow({
    width: 800,
    height: 600,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js')
    }
  })

  win.loadFile('index.html')
}

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit()
})

app.whenReady().then(() => {
  createWindow()
  screen.highlight(new Region(0, 0, 100, 100));

  app.on('activate', () => {
    if (BrowserWindow.getAllWindows().length === 0) createWindow()
  })
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    DONEImplementation is done, but not yet merged into masterbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions