-
-
Save karatatar/cac62681c70e2506b1c6aef33067904c to your computer and use it in GitHub Desktop.
Just a quick clipboard slip/slurp I put together because I didn't find anything similar, don't know if it's useful for anyone but found it invaluable when getting large strings being returned from the repl and sticking the result in an editor for more car
This file contains hidden or 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
| (defn get-clipboard [] | |
| (.getSystemClipboard (java.awt.Toolkit/getDefaultToolkit))) | |
| (defn slurp-clipboard [] | |
| (try | |
| (.getTransferData (.getContents (get-clipboard) nil) (java.awt.datatransfer.DataFlavor/stringFlavor)) | |
| (catch java.lang.NullPointerException e nil))) | |
| (defn spit-clipboard [text] | |
| (.setContents (get-clipboard) (java.awt.datatransfer.StringSelection. text) nil)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment