···2020## v? - Extensibility
21212222Peek extensions
2323+- [ ] better name that "extension"
2324- [ ] figure out background app vs other
2425- [ ] maybe cmd stays in core?
2526- [ ] is background runtime aware? eg mobile/extension/desktop
2627- [ ] background app separation from "feature" apps, is runtime aware
2728- [ ] annotate all data with source creator/editor (sys vs extension)
2929+- [ ] figure out in-extension settings vs jamming in global settings
3030+- [ ] syncable settings (extension decides)
28312932Web extensions
3033- [ ] WebExtension integration for priority only, on some platforms
+45-12
app/slides/index.js
···1313// Map to track opened slides - key is slide key, value is window ID
1414const slideWindows = new Map();
15151616+// Track registered shortcuts for cleanup
1717+let registeredShortcuts = [];
1818+1619const executeItem = (item) => {
1720 const height = item.height || 600;
1821 const width = item.width || 800;
···166169 api.shortcuts.register(shortcut, () => {
167170 executeItem(item);
168171 });
172172+173173+ registeredShortcuts.push(shortcut);
169174 }
170175 });
171176};
172177173178/**
174174- * Handle cleanup when the module is unloaded
179179+ * Unregister all shortcuts and clean up windows
175180 */
176176-const cleanup = () => {
177177- console.log('Cleaning up slides module');
178178-181181+const uninit = () => {
182182+ console.log('slides uninit - unregistering', registeredShortcuts.length, 'shortcuts');
183183+184184+ // Unregister all shortcuts
185185+ registeredShortcuts.forEach(shortcut => {
186186+ api.shortcuts.unregister(shortcut);
187187+ });
188188+ registeredShortcuts = [];
189189+179190 // Close or hide all slide windows
180191 for (const [key, windowId] of slideWindows.entries()) {
181192 console.log('Closing slide window:', key);
182193 api.window.hide({ id: windowId }).catch(err => {
183194 console.error('Error hiding slide window:', err);
184184- // Try to close it if hiding fails
185195 api.window.close({ id: windowId }).catch(err => {
186196 console.error('Error closing slide window:', err);
187197 });
188198 });
189199 }
190190-191191- // Clear the map
192200 slideWindows.clear();
193201};
194202203203+/**
204204+ * Reinitialize slides (called when settings change)
205205+ *
206206+ * TODO: This is inefficient - reinitializes all slides when any single
207207+ * property changes. A better approach would be to diff the old and new
208208+ * settings and only update the shortcuts that actually changed.
209209+ */
210210+const reinit = () => {
211211+ console.log('slides reinit');
212212+ uninit();
213213+214214+ const prefs = store.get(storageKeys.PREFS);
215215+ const items = store.get(storageKeys.ITEMS);
216216+217217+ if (items && items.length > 0) {
218218+ initItems(prefs, items);
219219+ }
220220+};
221221+195222const init = () => {
196196- console.log('init');
223223+ console.log('slides init');
197224198225 const prefs = () => store.get(storageKeys.PREFS);
199226 const items = () => store.get(storageKeys.ITEMS);
···209236 }
210237 });
211238212212- // initialize slides
239239+ // Initialize slides
213240 if (items().length > 0) {
214241 initItems(prefs(), items());
215242 }
216216-243243+244244+ // Listen for settings changes to hot-reload
245245+ api.subscribe('slides:settings-changed', () => {
246246+ console.log('slides settings changed, reinitializing');
247247+ reinit();
248248+ });
249249+217250 // Set up listener for app shutdown to clean up windows
218218- api.subscribe('app:shutdown', cleanup);
251251+ api.subscribe('app:shutdown', uninit);
219252};
220253221254export default {
222255 defaults,
223256 id,
224257 init,
225225- cleanup,
258258+ uninit,
226259 labels,
227260 schemas,
228261 storageKeys