Code Study: GitHub Desktop / main-process / menu / build-default-menu.ts

This code file offers function to build the default Electron menu of GitHub Desktop, and sets up the menu event to send when a menu item is clicked.

GitHub Desktopos: macOS
└– About GitHub Desktopos: macOS
click: emit(‘show-about’)
id: ‘about’
└– Preferences…os: macOS
click: emit(‘show-preferences’)
id: ‘preferences’
└– Install Command Line Tool…os: macOS
click: emit(‘install-cli’)
id: ‘install-cli’
└– Servicesos: macOS
role: ‘services’
Standard menu
└– Hide GitHub Desktopos: macOS
role: ‘hide’
Standard menu
└– Hide Othersos: macOS
role: ‘hideothers’
Standard menu
└– Show Allos: macOS
role: ‘unhide’
Standard menu
└– Quit GitHub Desktopos: macOS
role: ‘quit’
Standard menu
Fileos: all
└– New Repository…os: all
click: emit(‘create-repository’)
id: ‘new-repository’
└– Add Local Repository…os: all
click: emit(‘add-local-repository’)
id: ‘add-local-repository’
└– Clone Repository…os: all
click: emit(‘clone-repository’)
id: ‘clone-repository’
└– Options…os: non-macOS
click: emit(‘show-preferences’)
id: ‘preferences’
└– Exitos: non-macOS
role: ‘quit’
Standard menu
Editos: all
└– Undoos: all
role: ‘undo’
Standard menu
└– Redoos: all
role: ‘redo’
Standard menu
└– Cutos: all
role: ‘cut’
Standard menu
└– Copyos: all
role: ‘copy’
Standard menu
└– Pasteos: all
role: ‘paste’
Standard menu
└– Select Allos: all
Viewos: all
└– (Show )Changesos: all
click: emit(‘show-changes’)
id: ‘show-changes’
└– (Show )Historyos: all
click: emit(‘show-history’)
id: ‘show-history’
└– (Show )Repository Listos: all
click: emit(‘choose-repository’)
id: ‘show-repository-list’
└– (Show )Branch Listos: all
click: emit(‘show-branches’)
id: ‘show-branches-list’
└– Toggle Full Screenos: all
role: ‘togglefullscreen’
Standard menu
└– Reset Zoomos: all
click: zoom(ZoomDirection.Reset)
tags: GitHub Desktop - Electron