diff --git a/src/electron/electron/core.cljs b/src/electron/electron/core.cljs index 401e8423d..4b0fa0f09 100644 --- a/src/electron/electron/core.cljs +++ b/src/electron/electron/core.cljs @@ -186,7 +186,9 @@ {:role "fileMenu" :submenu [{:label "New Window" :click (fn [] - (p/let [graph-name (get-graph-name (state/get-active-window-graph-path)) + (p/let [graph-name (get-graph-name + (state/get-window-graph-path + (utils/get-focused-window))) _ (handler/broadcast-persist-graph! graph-name)] (handler/open-new-window!))) :accelerator (if mac? diff --git a/src/electron/electron/state.cljs b/src/electron/electron/state.cljs index 43a505d0e..264a0b9e4 100644 --- a/src/electron/electron/state.cljs +++ b/src/electron/electron/state.cljs @@ -46,16 +46,6 @@ [] (set (vals (:window/graph @state)))) -(defn get-active-window-graph-path - "Get the path of the graph of the currently focused window (might be `nil`)" - [] - (let [windows (:window/graph @state) - active-windows-pairs (filter #(.isFocused (first %)) windows) - active-window-pair (first active-windows-pairs) - path (second active-window-pair)] - path) - ) - (defn close-window! [window] (swap! state medley/dissoc-in [:window/graph window]))