W3cubDocs

/Electron

Represented File for macOS BrowserWindows

On macOS a window can set its represented file, so the file's icon can show in the title bar and when users Command-Click or Control-Click on the title a path popup will show.

You can also set the edited state of a window so that the file icon can indicate whether the document in this window has been modified.

Represented file popup menu:

Represented File

To set the represented file of window, you can use the BrowserWindow.setRepresentedFilename and BrowserWindow.setDocumentEdited APIs:

const { BrowserWindow } = require('electron')
  
  const win = new BrowserWindow()
  win.setRepresentedFilename('/etc/passwd')
  win.setDocumentEdited(true)

© 2013–2018 GitHub Inc.
Licensed under the MIT license.
https://electronjs.org/docs/tutorial/represented-file