diff --git a/desktop/src/index.ts b/desktop/src/index.ts index fe9ff933..6150b863 100644 --- a/desktop/src/index.ts +++ b/desktop/src/index.ts @@ -1,7 +1,7 @@ import { app, BrowserWindow, Menu } from "electron"; import { openFolder, openFolderPicker } from "./instance"; import { menu } from "./menu"; -import { getOpenWindows } from "./store"; +import { getOpenWindows, newWindowState } from "./store"; // This allows TypeScript to pick up the magic constants that's auto-generated by Forge's Webpack // plugin that tells the Electron app where to look for the Webpack-bundled app code (depending on @@ -18,6 +18,7 @@ if (require("electron-squirrel-startup")) { require("update-electron-app")(); async function boot() { + console.log("Process args", process.argv); const openWindows = getOpenWindows(); if (openWindows.length === 0) { await openFolderPicker(); @@ -38,6 +39,10 @@ app.on("ready", () => { boot().catch(console.error); }); +app.on("open-file", (event, path) => { + openFolder(newWindowState(path)).catch(console.error); +}); + // Quit when all windows are closed, except on macOS. There, it's common // for applications and their menu bar to stay active until the user quits // explicitly with Cmd + Q. diff --git a/desktop/src/instance.ts b/desktop/src/instance.ts index f7e2d004..9f0dfbbd 100644 --- a/desktop/src/instance.ts +++ b/desktop/src/instance.ts @@ -1,5 +1,13 @@ import { ChildProcessWithoutNullStreams, spawn } from "node:child_process"; -import { app, BrowserWindow, dialog, Menu, MenuItem, shell, nativeImage } from "electron"; +import { + app, + BrowserWindow, + dialog, + Menu, + MenuItem, + nativeImage, + shell, +} from "electron"; import portfinder from "portfinder"; import fetch from "node-fetch"; import { existsSync } from "node:fs"; @@ -55,6 +63,7 @@ async function folderPicker(): Promise { export async function openFolderPicker() { const folderPath = await folderPicker(); if (folderPath) { + app.addRecentDocument(folderPath); openFolder(newWindowState(folderPath)); } } diff --git a/desktop/src/menu.ts b/desktop/src/menu.ts index f462cdc3..e9cac02f 100644 --- a/desktop/src/menu.ts +++ b/desktop/src/menu.ts @@ -25,6 +25,14 @@ const template: MenuItemConstructorOptions[] = [ openFolderPicker(); }, }, + { + role: "recentDocuments", + submenu: [ + { + role: "clearRecentDocuments", + }, + ], + }, { type: "separator" }, { label: "Quit", diff --git a/website/CHANGELOG.md b/website/CHANGELOG.md index ec267747..3c2780ed 100644 --- a/website/CHANGELOG.md +++ b/website/CHANGELOG.md @@ -5,6 +5,8 @@ release. ## Next * Syntax highlighting for a bunch of new languages: PgSQL, Rust, CSS, Python, Protobuf, Shell, Swift, toml, XML, JSON, C, C++, Java, C#, Scala, Kotlin, ObjectiveC, ObjectiveC++ and Dart * [[Vim]] support for VIMRC (see [[Vim]] documentation) +* Desktop: “Open Recent” menu to quickly reopen recently opened spaces. +* Sync bug fixes and better logging (in {[Show Logs]}) --- ## 0.2.9