 (add-watch state :main on-change-state)
 
 ;;------------------------------------------------------------------------------
+;; Non-react Events
+;;------------------------------------------------------------------------------
+
+(defn- on-keydown-body [js-evt]
+  (let [key-code (aget js-evt "keyCode")
+        escape-key-pressed? (= ESC key-code)
+        current-state @state]
+    (when escape-key-pressed?
+      (when (:add-project-modal-showing? current-state)
+        (click-add-project-modal-overlay))
+      (when (:settings-modal-showing? current-state)
+        (click-settings-modal-overlay)))))
+
+(def events-added? (atom false))
+
+(defn- add-events!
+  "Add non-react events.
+   NOTE: this is a run-once function"
+  []
+  (when-not @events-added?
+    (.addEventListener js/document.body "keydown" on-keydown-body)
+    (reset! events-added? true)))
+
+;;------------------------------------------------------------------------------
 ;; Init
 ;;------------------------------------------------------------------------------
 

    [cuttle.util :refer [date-format file-exists? homedir log js-log now
                               on-mac? uuid write-file-async!]
                       :refer-macros [while-let]]
    [quiescent :include-macros true]
    [sablono.core :as sablono :include-macros true]))


        "Load an existing project from a Leiningen " [:code "project.clj"] " file."]]
    [:div.modal-bottom-050c3
      [:span.bottom-link-7d8d7 {:on-click close-add-project-modal}
        "close"]]])

(sablono/defhtml new-project-form [app-state]
  [:div.modal-body-fe4db
