 (defn scrollify
   [widget]
   (scroll-pane widget (style :scroll-pane nil nil nil nil nil)))
+
+(defn error-str
+  []
+  (->> [(some-> @u/error .toString)
+        (when (and @u/error @u/stack-trace?)
+          (for [elem (.getStackTrace @u/error)]
+            (.toString elem)))]
+       flatten
+       (remove nil?)
+       (string/join \newline)))
+
+(defn set-clipboard!
+  [s]
+  (let [clip-board (.getSystemClipboard (Toolkit/getDefaultToolkit))]
+    (.setContents clip-board
+      (StringSelection. s)
+      (reify ClipboardOwner
+        (lostOwnership [this clipboard contents])))))
 
 (defscreen main-screen
   :on-show

      "restart" (restart!)
      "files" (u/toggle-glass!)
      "stack-trace" (swap! u/stack-trace? not)
      "copy" nil
      nil)
    nil))


            [nightmod.utils :as u]
            [play-clj.core :refer :all]
            [play-clj.ui :refer :all]
            [seesaw.core :as s])
  (:import [java.awt Toolkit]
           [java.awt.datatransfer Clipboard ClipboardOwner StringSelection]))

(declare nightmod main-screen blank-screen overlay-screen)

