Skip to content

Commit

Permalink
Merge pull request #11 from pi-chan/master
Browse files Browse the repository at this point in the history
⌘C to copy image to pasteboard
  • Loading branch information
kentya6 authored Feb 7, 2017
2 parents 61b8223 + 640515a commit dd36331
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Fuwari/FloatWindow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,16 @@ class FloatWindow: NSWindow {
fade(isIn: false) {
self.floatDelegate?.close(floatWindow: self)
}
case UInt16(kVK_ANSI_C):
DispatchQueue.main.asyncAfter(deadline: .now()) {
if let image = self.contentView?.layer?.contents {
let cgImage = image as! CGImage
let size = CGSize(width: cgImage.width, height: cgImage.height)
let nsImage = NSImage(cgImage: cgImage, size: size)
NSPasteboard.general().clearContents()
NSPasteboard.general().writeObjects([nsImage])
}
}
default:
break
}
Expand Down

0 comments on commit dd36331

Please # to comment.