From 32cc3ecec37946e35708000367057bfe94cd6278 Mon Sep 17 00:00:00 2001
From: th
Date: Fri, 5 Jun 2026 17:34:50 +0200
Subject: [PATCH] Polish Electron desktop shell
---
README.md | 17 ++++++
build/icon.png | Bin 0 -> 195928 bytes
electron/main.cts | 123 ++++++++++++++++++++++++++++++++++++++---
electron/preload.cts | 9 ++-
package.json | 7 +++
src/App.vue | 76 +++++++++++++++++++++++++
src/types/desktop.d.ts | 24 ++++++++
vite.config.ts | 1 +
8 files changed, 249 insertions(+), 8 deletions(-)
create mode 100644 build/icon.png
diff --git a/README.md b/README.md
index 3d76324..41365cb 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,23 @@ npm run build # production bundle to dist/
npm run pack # zip dist/ into dist-archive/
```
+## Electron desktop build
+
+RUWIO can also run as an Electron desktop app. The desktop shell uses the
+same Vite-built app from `dist/` plus the compiled Electron entry points in
+`dist-electron/`.
+
+```bash
+npm install
+npm run desktop:dev # start Vite, then launch Electron against localhost
+npm run desktop:pack # build an unpacked desktop app into release/
+npm run desktop:build # build platform installer/package artifacts into release/
+```
+
+`desktop:pack` is the quickest compile check because it produces an unpacked
+app without creating an installer. `desktop:build` uses `electron-builder` and
+targets AppImage on Linux, NSIS on Windows, and DMG on macOS.
+
## Stack
- Vue 3 (`
diff --git a/src/types/desktop.d.ts b/src/types/desktop.d.ts
index eb8c791..fdf9721 100644
--- a/src/types/desktop.d.ts
+++ b/src/types/desktop.d.ts
@@ -1,5 +1,26 @@
export {}
+type RuwioDesktopMenuCommand =
+ | 'new-project'
+ | 'open-project'
+ | 'recent-projects'
+ | 'save-project'
+ | 'save-project-as'
+ | 'export-project'
+ | 'undo'
+ | 'redo'
+ | 'copy-current-frame'
+ | 'toggle-playback'
+ | 'stop-playback'
+ | 'rewind'
+ | 'fullscreen-preview'
+ | 'toggle-panels'
+ | 'media-library'
+ | 'document-settings'
+ | 'help'
+ | 'about'
+ | 'test-runner'
+
declare global {
interface Window {
ruwioDesktop?: {
@@ -9,6 +30,9 @@ declare global {
chrome?: string
node?: string
}
+ onMenuCommand?: (
+ callback: (command: RuwioDesktopMenuCommand) => void,
+ ) => () => void
}
}
}
diff --git a/vite.config.ts b/vite.config.ts
index 94e2438..356922b 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -3,6 +3,7 @@ import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
export default defineConfig({
+ base: './',
plugins: [vue()],
server: {
|