The official docs are actually useful now, so refer to those for up-to-date information.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(refer-clojure :exclude '[slurp spit]) | |
(import '[java.awt.datatransfer DataFlavor StringSelection Transferable]) | |
(defn clipboard [] | |
(.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit))) | |
(defn slurp [] | |
(try | |
(.getTransferData (.getContents (clipboard) nil) (DataFlavor/stringFlavor)) | |
(catch java.lang.NullPointerException e nil))) |