Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Inline

Manav Rathia71ca936962c
diff --git a/desktop/src/main.ts b/desktop/src/main.ts
index e18d74ed7c..950c985b08 100644
--- a/desktop/src/main.ts
+++ b/desktop/src/main.ts
@@ -17,11 +17,9 @@ import os from "node:os";
import path from "node:path";
import {
addAllowOriginHeader,
- createWindow,
handleDownloads,
handleExternalLinks,
setupMacWindowOnDockIconClick,
- setupTrayItem,
} from "./main/init";
import { attachFSWatchIPCHandlers, attachIPCHandlers } from "./main/ipc";
import log, { initLogging } from "./main/log";
@@ -127,7 +125,7 @@ const hideDockIconIfNeeded = async () => {
*
* This window will show the HTML served from {@link rendererURL}.
*/
-export const createMainWindow = async () => {
+const createMainWindow = async () => {
// Create the main window. This'll show our web content.
const window = new BrowserWindow({
webPreferences: {
@@ -187,6 +185,12 @@ export const createMainWindow = async () => {
return window;
};
+/**
+ * Add an icon for our app in the system tray.
+ *
+ * For example, these are the small icons that appear on the top right of the
+ * screen in the main menu bar on macOS.
+ */
const setupTrayItem = (mainWindow: BrowserWindow) => {
// There are a total of 6 files corresponding to this tray icon.
//
@@ -274,7 +278,7 @@ const main = () => {
//
// Note that some Electron APIs can only be used after this event occurs.
app.on("ready", async () => {
- mainWindow = await createWindow();
+ mainWindow = await createMainWindow();
const watcher = initWatcher(mainWindow);
setupTrayItem(mainWindow);
setupMacWindowOnDockIconClick();
diff --git a/desktop/src/main/init.ts b/desktop/src/main/init.ts
index 6210dcdddd..baa6444fd2 100644
--- a/desktop/src/main/init.ts
+++ b/desktop/src/main/init.ts
@@ -1,12 +1,7 @@
-import { BrowserWindow, Tray, app, nativeImage, shell } from "electron";
+import { BrowserWindow, app, shell } from "electron";
import { existsSync } from "node:fs";
import path from "node:path";
-import { isAppQuitting, rendererURL } from "../main";
-import log from "./log";
-import { createTrayContextMenu } from "./menu";
-import autoLauncher from "./services/autoLauncher";
-import { isDev } from "./util";
-
+import { rendererURL } from "../main";
export function handleDownloads(mainWindow: BrowserWindow) {
mainWindow.webContents.session.on("will-download", (_, item) => {