Nw.js: Cut/Copy/Paste hotkeys doesn't work on Mac

Created on 10 Jun 2014  路  26Comments  路  Source: nwjs/nw.js

I get reports from Mac users that they can't use hotkeys for it, anyway on Windows/Linux it works natively.

If that was related only to code editor, I could provide workaround for it, but it seems to be related to everything.

https://github.com/as3boyan/HIDE/issues/124

Anybody got similar problems?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

bug regression triaged

Most helpful comment

If the edit menu is enabled with this copy and paste will work on Mac 10.10.2 and nwjs 0.12.0.

var gui = require('nw.gui');
if (process.platform === "darwin") {
  var mb = new gui.Menu({type: 'menubar'});
  mb.createMacBuiltin('RoboPaint', {
    hideEdit: false,
  });
  gui.Window.get().menu = mb;
}

(If anyone is wondering this code is modified from robopaint)

All 26 comments

I do have similar issues. Cmd+A for selecting all text in a textfield does not work either.

Just in case it helps in any way. I had a similar issue when launching the app using tmux.

I'm experiencing this on OSX as well, when launching like so:

app$ /Applications/node-webkit.app/Contents/MacOS/node-webkit .

@staygrimm How to make it work fine? How to launch it so it could work properly?
I am curious if atom-shell has such issue

try this in your init script...

var gui = require('nw.gui');
win = gui.Window.get();
var nativeMenuBar = new gui.Menu({ type: "menubar" });
try {
nativeMenuBar.createMacBuiltin("My App");
win.menu = nativeMenuBar;
} catch (ex) {
console.log(ex.message);
}

That seems to work

So using this internal function solves this issue? The problem is that I don't want to show native menu.

That's not an internal function -- it's part of public API: https://github.com/rogerwang/node-webkit/wiki/Menu#menucreatemacbuiltinappname

In 0.9.2 and earlier versions, the feature is provided by the items of 'Edit' menu, which is hard-coded and builtin. In later versions, the 'Edit' and 'Window' menu is optional and is supposed to be created in app.

I have the same issue, seems only cut command works.

@azmras This fixed the issue for me, thanks! I find it strange that it is needed to get the standard key-bindings to work though.

merge with #2039

broken again
OS X 10.10.1 (14B25)
Chrome 40.0.2214.111 (64-bit)

confirming broken
OS X 10.10 (14A389)
nwjs v0.12.0-rc1 (64-bit)

/cc @rogerwang regression here on the 0.12 releases.

If the edit menu is enabled with this copy and paste will work on Mac 10.10.2 and nwjs 0.12.0.

var gui = require('nw.gui');
if (process.platform === "darwin") {
  var mb = new gui.Menu({type: 'menubar'});
  mb.createMacBuiltin('RoboPaint', {
    hideEdit: false,
  });
  gui.Window.get().menu = mb;
}

(If anyone is wondering this code is modified from robopaint)

it works, thanks @docprofsky

Seems that copy/paste works only within node-webkit app.
I cannot copy text from my app and paste somewhere else outside app (e.g. to my terminal).

OS X 10.10.2
nwjs 0.12.0

Works on Windows.
Broken on mac.

I don't know why that works or why it's necessary, but thank you @docprofsky

I am glad this has helped.
I think this issue should not be closed until this is better documented and/or nw.js has the edit menu present by default.

Debug console still cannot paste.

@docprofsky @Jayin cool

Has this been solved yet?

@michahell I don't think so, i'm having problems with this as well

thanks @docprofsky it works, can copy and paste to console now

I wonder if this will be improved @rogerwang - when the builtinmac edit menu is not shown - all the copy and paste keys do not work.. is this by design?

Was this page helpful?
0 / 5 - 0 ratings