 (ns nightcode.shortcuts
-  (:require [seesaw.core :as s]
+  (:require [nightcode.ui :as ui]
+            [seesaw.core :as s]
             [seesaw.keymap :as keymap])
   (:import [java.awt Color Component KeyboardFocusManager KeyEventDispatcher
             Toolkit]

  "Creates hints for all widgets within given target with IDs in `mappings`."
  [target]
  (doseq [[id mapping] mappings]
    (when-let [btn (s/select target [(keyword (str "#" (name id)))])]
      (create-hint! btn mapping))))

(defn listen-for-shortcuts!
  "Creates a global listener for shortcuts."

        (doto positioner
          (.enableFixedAttachLocation true)
          (.setAttachLocation 0.5 y))
        (when-let [container (some-> @ui/ui-root
                                     .getGlassPane
                                     (s/select [:JLayeredPane])
                                     first)]
          (.setTopLevelContainer tip container))
        (doto tip
          (.setPositioner positioner)
          (.setVisible false))))))
