Electron Documentation

Docs / Guides / Represented File for macOS BrowserWindows electron@master (b3edfd)

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)