 utf8      = require 'utf8'
 ipc       = require 'ipc'
 Clipboard = require 'clipboard'
+remote    = require 'remote'
+Menu      = remote.require 'menu'
 
 module.exports =
 class TerminalView extends View


    $('.terminal').on 'focus', (e) =>
      @term.focus()

    @term.on 'data', (data) =>
      ipc.send 'terminal-data', data

      if focus
        @term.focus()
        $('.terminal').focus()

  onContextMenu: () ->
    @contextMenu().popup()

  contextMenu: () ->
    Menu.buildFromTemplate([
      {
        label: 'Copy',
        accelerator: 'CmdOrCtrl+C',
        role: 'copy'
      },
      {
        label: 'Paste',
        accelerator: 'CmdOrCtrl+V',
        role: 'paste'
      }
    ])
