Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gcs/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ ipcMain.handle("window:select-file-in-explorer", async (_event, filters) => {
}
return null
})
ipcMain.on("window:update-title", async (_event, value) => {
getWindow()?.setTitle(value)
})

function createWindow() {
win = new BrowserWindow({
Expand All @@ -224,6 +227,7 @@ function createWindow() {
preload: path.join(__dirname, "preload.js"),
nodeIntegration: true,
},
title: "FGCS",
show: false,
alwaysOnTop: true,
minWidth: 750,
Expand Down
1 change: 1 addition & 0 deletions gcs/electron/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const ALLOWED_SEND_CHANNELS = [
"window:zoom-in",
"window:zoom-out",
"window:open-file-in-explorer",
"window:update-title",
// app state updates
"app:connected-state",
]
Expand Down
2 changes: 1 addition & 1 deletion gcs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +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</title>
<title>FGCS</title>
</head>
<body>
<div id="root"></div>
Expand Down
1 change: 1 addition & 0 deletions gcs/src/redux/middleware/socketMiddleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,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
Expand Down
4 changes: 4 additions & 0 deletions gcs/src/redux/slices/droneInfoSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ const droneInfoSlice = createSlice({
reducers: {
setFlightSwVersion: (state, action) => {
state.flightSwVersion = action.payload
window.ipcRenderer.send(
"window:update-title",
`FGCS - ${state.aircraftType === 1 ? "ArduPlane" : "ArduCopter"} ${action.payload}`,
)
},
setHeartbeatData: (state, action) => {
if (
Expand Down
2 changes: 1 addition & 1 deletion gcs/tests/electron-fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export async function getSharedElectronApp(): Promise<ElectronApplication> {
sharedMainWindow = await sharedElectronApp.waitForEvent("window", {
predicate: async (window) => {
const title = await window.title()
return title === "FGCS"
return title.includes("FGCS")
},
timeout: 30000,
})
Expand Down