exercism / gui

MIT License
22 stars 13 forks source link

Fix key shortcuts and context menu #28

Closed holandes22 closed 8 years ago

holandes22 commented 8 years ago

There is currently kind of a mess with shortcuts, menu and context-menu This ticket is to layout the possible ways we can fix/refactor the code dealing with this thing.

Shortcuts

Some shortcuts like "toggle full screen", "toggle developer tools" and "reload" do not work in the packaged version until you add an application menu (pointed to me by the ember-electron creator here https://github.com/felixrieseberg/ember-electron/issues/75).

In order to make those shortcuts work we have some options:

  1. Add an application menu (I like this the least as it changes completely the look of the app by having an extra menu on top of the nav bar)
  2. Use something like this package https://github.com/parro-it/electron-localshortcut to register shortcuts
  3. On top of adding the shortcuts we could add our own menu in the navbar, and triggering different actions that will act upon the window: For example requireNode('remote').getCurrentWindow().toggleDevTools(); to toggle dev tools

    Context Menu

The context menu event is supposed to work from the main process (electron.js) but this wasn't working (see #26) after packaging. Currently I added an ugly hack of adding an event listener within the app route (for some reason it works within the rendered process with remote).

Some options

  1. This might be a bug in ember-electron (context-menu works on the main process with the quick-start project after packaging) in which case a fix over there is needed. Here is the ticket https://github.com/felixrieseberg/ember-electron/issues/71
  2. Use ember event handlers https://guides.emberjs.com/v2.6.0/components/handling-events/ to listen for contextMenu instead of attaching directly to window

Also, limit options in context menu to editing stuff (copy/paste/undo/redo, etc.) and put stuff like toggle dev tools and full screen in main menu