     (.set js/chrome.proxy.settings
           (clj->js m)
           (fn [] (.log js/console "#restored")))))
+
+(defn make-proxy-settings! [uri]
+  (let [u (re-seq #"(\w+)://(\w+):(\d+)" uri)
+        ss (first u)
+        n (assoc-in @proxy-settings [:value :rules :singleProxy]
+                    {:scheme (second ss)
+                     :host (nth ss 2)
+                     :port (Integer/parseInt (last ss))})]
+    (reset! proxy-settings n)))
 
 (defn on-proxy-run! [e]
   (let [s @proxy-switch]

      (do 
          (.log js/console "#popup:on-doc-ready")
          (switch-proxy!)
          (set-link! "options_link" "options.html")
          (set-link! "echo_link" "resources/public/echo.html")
          (load-proxy-uri "http://localhost:9001")
          (ev/listen! (by-id "proxy_run") :click on-proxy-run!)

      false)))

(set! (.-onreadystatechange js/document) on-doc-ready)
