electron: Clipboard not working in some OSX environments

Context

I’m building an app on atom-shell and a portion of atom. Copy/paste does not work for me, but it does for my other team members running identical code, identical versions of atom-shell and on OSX.

Example

c = require("clipboard")
c.writeText("text")
c.readText()
# undefined

This example sets the clipboard text and reads it back correctly if executed in atom on my machine, but shows the behaviour above in our atom-shell based app. It neither sets the clipboard, nor can it read it.

Environment

Atom-shell 0.19.4
OSX 10.9.5

Probably unrelated, but also installed systemwide:

Atom 0.152.0
NPM 2.1.6
Node 0.10.33

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Were you using any custom shell like screen or tmux in the terminal?

OS X’s clipboard API requires the process to run in a UI session, which might not be true if you are using tmux, you can also try if pbcopy/pbpaste work in your terminal.

See also the link bellow for a better explanation, it also provides some work-arounds: https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard#mac-os-x-pasteboard-access-under-tmux-and-screen

I’m closing this because this is not an issue of atom-shell.