|
112 | 112 | (defn init []
|
113 | 113 | (go
|
114 | 114 | (proton/init-proton-mode-keymaps!)
|
115 |
| - (atom-env/show-modal-panel) |
116 | 115 | (atom-env/insert-process-step! "Initialising proton... Just a moment!" "")
|
117 | 116 | (let [{:keys [additional-packages layers configuration disabled-packages keybindings keymaps]} (proton/load-config)
|
118 | 117 | editor-default editor-config/default
|
|
130 | 129 | all-keymaps (into [] (distinct (concat keymaps (:keymaps editor-default) (proton/keymaps-for-layers all-layers))))
|
131 | 130 | all-keybindings (helpers/deep-merge (proton/keybindings-for-layers all-layers) keybindings)
|
132 | 131 | wipe-configs? (true? (config-map "proton.core.wipeUserConfigs"))
|
133 |
| - all-packages (pm/register-packages (into (hash-map) (concat (map pm/register-installable selected-packages) (map pm/register-removable disabled-packages))))] |
| 132 | + all-packages (pm/register-packages (into (hash-map) (concat (map pm/register-installable selected-packages) (map pm/register-removable disabled-packages)))) |
| 133 | + to-install (pm/get-to-install all-packages) |
| 134 | + to-remove (pm/get-to-remove (filter (comp not pm/is-bundled?) all-packages))] |
| 135 | + |
| 136 | + ;; Show welcome screen if there are packages to install/remove or the option to always show is enabled |
| 137 | + (if (or (config-map "proton.core.alwaysShowWelcomeScreen") (> (count to-install) 0) (> (count to-remove) 0) ) |
| 138 | + (atom-env/show-modal-panel)) |
| 139 | + |
134 | 140 | ;; wipe existing config
|
135 | 141 | (when wipe-configs?
|
136 | 142 | (do
|
|
153 | 159 | (atom-env/mark-last-step-as-completed!)
|
154 | 160 |
|
155 | 161 | ;; Install all necessary packages
|
156 |
| - (let [to-install (pm/get-to-install all-packages)] |
157 |
| - (if (> (count to-install) 0) |
158 |
| - (do |
159 |
| - (atom-env/insert-process-step! (str "Installing <span class='proton-status-package-count'>" (count to-install) "</span> new package(s)") "") |
160 |
| - (doseq [package to-install] |
161 |
| - (atom-env/insert-process-step! (str "Installing <span class='proton-status-package'>" (name package) "</span>")) |
162 |
| - (<! (pm/install-package (name package))) |
163 |
| - (atom-env/mark-last-step-as-completed!))))) |
| 162 | + (if (> (count to-install) 0) |
| 163 | + (do |
| 164 | + (atom-env/insert-process-step! (str "Installing <span class='proton-status-package-count'>" (count to-install) "</span> new package(s)") "") |
| 165 | + (doseq [package to-install] |
| 166 | + (atom-env/insert-process-step! (str "Installing <span class='proton-status-package'>" (name package) "</span>")) |
| 167 | + (<! (pm/install-package (name package))) |
| 168 | + (atom-env/mark-last-step-as-completed!)))) |
164 | 169 |
|
165 | 170 | ;; Remove deleted packages
|
166 |
| - (let [to-remove (pm/get-to-remove (filter (comp not pm/is-bundled?) all-packages))] |
167 |
| - (if (> (count to-remove) 0) |
168 |
| - (do |
169 |
| - (atom-env/insert-process-step! (str "Removing <span class='proton-status-package-count'>" (count to-remove) "</span> orphaned package(s)") "") |
170 |
| - (doseq [package to-remove] |
171 |
| - (atom-env/insert-process-step! (str "Removing <span class='proton-status-package'>" (name package) "</span>")) |
172 |
| - (<! (pm/remove-package (name package))) |
173 |
| - (atom-env/mark-last-step-as-completed!))))) |
| 171 | + (if (> (count to-remove) 0) |
| 172 | + (do |
| 173 | + (atom-env/insert-process-step! (str "Removing <span class='proton-status-package-count'>" (count to-remove) "</span> orphaned package(s)") "") |
| 174 | + (doseq [package to-remove] |
| 175 | + (atom-env/insert-process-step! (str "Removing <span class='proton-status-package'>" (name package) "</span>")) |
| 176 | + (<! (pm/remove-package (name package))) |
| 177 | + (atom-env/mark-last-step-as-completed!)))) |
174 | 178 |
|
175 | 179 | ;; set the user config
|
176 | 180 | (atom-env/insert-process-step! "Applying user configuration")
|
|
188 | 192 | (mode-manager/activate-mode (atom-env/get-active-editor))
|
189 | 193 | (keymap-manager/set-proton-leader-keys all-keybindings)
|
190 | 194 | (proton/init-proton-leader-keys! all-configuration)
|
191 |
| - (.setTimeout js/window #(atom-env/hide-modal-panel) (config-map "proton.core.post-init-timeout"))))))) |
| 195 | + |
| 196 | + ;; Hide the welcome screen after a timeout if we showed it earlier |
| 197 | + (if (or (config-map "proton.core.alwaysShowWelcomeScreen") (> (count to-install) 0) (> (count to-remove) 0) ) |
| 198 | + (.setTimeout js/window #(atom-env/hide-modal-panel) (config-map "proton.core.post-init-timeout")))))))) |
192 | 199 |
|
193 | 200 | (defn on-space []
|
194 | 201 | (reset! current-chain [])
|
|
0 commit comments