From e43875011d25cf342059912547bf34a5c099431a Mon Sep 17 00:00:00 2001 From: ProgramPhantom Date: Sun, 23 Nov 2025 17:01:42 +0000 Subject: [PATCH 1/4] * Removed from index.html so it doesn't overwrite Electron * Added a new ipc handler for changing window title * Triggered ipc handler when drone SW version is set --- gcs/electron/main.ts | 4 ++++ gcs/electron/preload.js | 1 + gcs/index.html | 1 - gcs/src/redux/slices/droneInfoSlice.js | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcs/electron/main.ts b/gcs/electron/main.ts index 54d69995f..9d7c37ec3 100644 --- a/gcs/electron/main.ts +++ b/gcs/electron/main.ts @@ -209,6 +209,9 @@ ipcMain.handle("window:select-file-in-explorer", async (_event, filters) => { } return null }) +ipcMain.on("window:page-title-updated", async (_event, value) => { + getWindow()?.setTitle("FW Version: " + value) +}) function createWindow() { win = new BrowserWindow({ @@ -217,6 +220,7 @@ function createWindow() { preload: path.join(__dirname, "preload.js"), nodeIntegration: true, }, + title: app.getVersion().toString(), show: false, alwaysOnTop: true, minWidth: 750, diff --git a/gcs/electron/preload.js b/gcs/electron/preload.js index 1aa9cdf1e..02584bd9b 100644 --- a/gcs/electron/preload.js +++ b/gcs/electron/preload.js @@ -47,6 +47,7 @@ const ALLOWED_SEND_CHANNELS = [ "window:zoom-in", "window:zoom-out", "window:open-file-in-explorer", + "window:page-title-updated", ] const ALLOWED_ON_CHANNELS = [ diff --git a/gcs/index.html b/gcs/index.html index 5fee79978..b2d7fe609 100644 --- a/gcs/index.html +++ b/gcs/index.html @@ -4,7 +4,6 @@ <meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/logo_dark_icon.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> - <title>FGCS
diff --git a/gcs/src/redux/slices/droneInfoSlice.js b/gcs/src/redux/slices/droneInfoSlice.js index db54efb43..52e87d97a 100644 --- a/gcs/src/redux/slices/droneInfoSlice.js +++ b/gcs/src/redux/slices/droneInfoSlice.js @@ -100,6 +100,7 @@ const droneInfoSlice = createSlice({ reducers: { setFlightSwVersion: (state, action) => { state.flightSwVersion = action.payload + window.ipcRenderer.send("window:page-title-updated", action.payload) }, setHeartbeatData: (state, action) => { if ( From 204924e77a5ef5ff92e6c624e1a02fdb311b1e7f Mon Sep 17 00:00:00 2001 From: ProgramPhantom Date: Sun, 23 Nov 2025 19:33:51 +0000 Subject: [PATCH 2/4] Implemented code review requests --- gcs/electron/main.ts | 6 +++--- gcs/electron/preload.js | 2 +- gcs/src/redux/middleware/socketMiddleware.js | 1 + gcs/src/redux/slices/droneInfoSlice.js | 5 ++++- gcs/tests/electron-fixtures.ts | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gcs/electron/main.ts b/gcs/electron/main.ts index 9d7c37ec3..da5764303 100644 --- a/gcs/electron/main.ts +++ b/gcs/electron/main.ts @@ -209,8 +209,8 @@ ipcMain.handle("window:select-file-in-explorer", async (_event, filters) => { } return null }) -ipcMain.on("window:page-title-updated", async (_event, value) => { - getWindow()?.setTitle("FW Version: " + value) +ipcMain.on("window:update-title", async (_event, value) => { + getWindow()?.setTitle(value) }) function createWindow() { @@ -220,7 +220,7 @@ function createWindow() { preload: path.join(__dirname, "preload.js"), nodeIntegration: true, }, - title: app.getVersion().toString(), + title: "FGCS", show: false, alwaysOnTop: true, minWidth: 750, diff --git a/gcs/electron/preload.js b/gcs/electron/preload.js index 02584bd9b..3f85dd10c 100644 --- a/gcs/electron/preload.js +++ b/gcs/electron/preload.js @@ -47,7 +47,7 @@ const ALLOWED_SEND_CHANNELS = [ "window:zoom-in", "window:zoom-out", "window:open-file-in-explorer", - "window:page-title-updated", + "window:update-title", ] const ALLOWED_ON_CHANNELS = [ diff --git a/gcs/src/redux/middleware/socketMiddleware.js b/gcs/src/redux/middleware/socketMiddleware.js index 598cf9f23..8b38f1dbb 100644 --- a/gcs/src/redux/middleware/socketMiddleware.js +++ b/gcs/src/redux/middleware/socketMiddleware.js @@ -335,6 +335,7 @@ const socketMiddleware = (store) => { // Flags that the drone is disconnected socket.socket.on("disconnected_from_drone", () => { store.dispatch(setConnected(false)) + window.ipcRenderer.send("window:update-title", "FGCS") }) // Flags an error with the com port diff --git a/gcs/src/redux/slices/droneInfoSlice.js b/gcs/src/redux/slices/droneInfoSlice.js index 52e87d97a..a2e96db32 100644 --- a/gcs/src/redux/slices/droneInfoSlice.js +++ b/gcs/src/redux/slices/droneInfoSlice.js @@ -100,7 +100,10 @@ const droneInfoSlice = createSlice({ reducers: { setFlightSwVersion: (state, action) => { state.flightSwVersion = action.payload - window.ipcRenderer.send("window:page-title-updated", action.payload) + window.ipcRenderer.send( + "window:update-title", + "FGCS - ArduPlane " + action.payload, + ) }, setHeartbeatData: (state, action) => { if ( diff --git a/gcs/tests/electron-fixtures.ts b/gcs/tests/electron-fixtures.ts index 0afde2d18..0b4193a4b 100644 --- a/gcs/tests/electron-fixtures.ts +++ b/gcs/tests/electron-fixtures.ts @@ -31,7 +31,7 @@ export async function getSharedElectronApp(): Promise { sharedMainWindow = await sharedElectronApp.waitForEvent("window", { predicate: async (window) => { const title = await window.title() - return title === "FGCS" + return title.includes("FGCS") }, timeout: 30000, }) From 548245a030e1be94f5506da001928005110876a0 Mon Sep 17 00:00:00 2001 From: ProgramPhantom Date: Thu, 27 Nov 2025 12:08:06 +0000 Subject: [PATCH 3/4] Added back to index --- gcs/index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/gcs/index.html b/gcs/index.html index b2d7fe609..884dba96f 100644 --- a/gcs/index.html +++ b/gcs/index.html @@ -4,6 +4,7 @@ <meta charset="UTF-8" /> <link rel="icon" type="image/svg+xml" href="/logo_dark_icon.svg" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> + <title>FGCS
From 080f9c17fe78ecd4038fe9bc0f4e77c1ed5f1966 Mon Sep 17 00:00:00 2001 From: ProgramPhantom Date: Fri, 28 Nov 2025 14:55:37 +0000 Subject: [PATCH 4/4] Display different drone types in title --- gcs/src/redux/slices/droneInfoSlice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcs/src/redux/slices/droneInfoSlice.js b/gcs/src/redux/slices/droneInfoSlice.js index 5cfa6eb9f..e866cd567 100644 --- a/gcs/src/redux/slices/droneInfoSlice.js +++ b/gcs/src/redux/slices/droneInfoSlice.js @@ -111,7 +111,7 @@ const droneInfoSlice = createSlice({ state.flightSwVersion = action.payload window.ipcRenderer.send( "window:update-title", - "FGCS - ArduPlane " + action.payload, + `FGCS - ${state.aircraftType === 1 ? "ArduPlane" : "ArduCopter"} ${action.payload}`, ) }, setHeartbeatData: (state, action) => {