| ... | @@ -66,6 +66,8 @@ const ROOT_DIR = Path.resolve(__dirname, "../../.."); | ... | @@ -66,6 +66,8 @@ const ROOT_DIR = Path.resolve(__dirname, "../../.."); |
| 66 | const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL); | 66 | const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL); |
| 67 | const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; | 67 | const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; |
| 68 | const APP_USER_MODEL_ID = "com.t3tools.t3code"; | 68 | const APP_USER_MODEL_ID = "com.t3tools.t3code"; |
| | 69 | const LINUX_DESKTOP_ENTRY_NAME = isDevelopment ? "t3code-dev.desktop" : "t3code.desktop"; |
| | 70 | const LINUX_WM_CLASS = isDevelopment ? "t3code-dev" : "t3code"; |
| 69 | const USER_DATA_DIR_NAME = isDevelopment ? "t3code-dev" : "t3code"; | 71 | const USER_DATA_DIR_NAME = isDevelopment ? "t3code-dev" : "t3code"; |
| 70 | const LEGACY_USER_DATA_DIR_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; | 72 | const LEGACY_USER_DATA_DIR_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)"; |
| 71 | const COMMIT_HASH_PATTERN = /^[0-9a-f]{7,40}$/i; | 73 | const COMMIT_HASH_PATTERN = /^[0-9a-f]{7,40}$/i; |
| ... | @@ -80,6 +82,9 @@ const DESKTOP_UPDATE_CHANNEL = "latest"; | ... | @@ -80,6 +82,9 @@ const DESKTOP_UPDATE_CHANNEL = "latest"; |
| 80 | const DESKTOP_UPDATE_ALLOW_PRERELEASE = false; | 82 | const DESKTOP_UPDATE_ALLOW_PRERELEASE = false; |
| 81 | | 83 | |
| 82 | type DesktopUpdateErrorContext = DesktopUpdateState["errorContext"]; | 84 | type DesktopUpdateErrorContext = DesktopUpdateState["errorContext"]; |
| | 85 | type LinuxDesktopNamedApp = Electron.App & { |
| | 86 | setDesktopName?: (desktopName: string) => void; |
| | 87 | }; |
| 83 | | 88 | |
| 84 | let mainWindow: BrowserWindow | null = null; | 89 | let mainWindow: BrowserWindow | null = null; |
| 85 | let backendProcess: ChildProcess.ChildProcess | null = null; | 90 | let backendProcess: ChildProcess.ChildProcess | null = null; |
| ... | @@ -263,6 +268,10 @@ function captureBackendOutput(child: ChildProcess.ChildProcess): void { | ... | @@ -263,6 +268,10 @@ function captureBackendOutput(child: ChildProcess.ChildProcess): void { |
| 263 | | 268 | |
| 264 | initializePackagedLogging(); | 269 | initializePackagedLogging(); |
| 265 | | 270 | |
| | 271 | if (process.platform === "linux") { |
| | 272 | app.commandLine.appendSwitch("class", LINUX_WM_CLASS); |
| | 273 | } |
| | 274 | |
| 266 | function getDestructiveMenuIcon(): Electron.NativeImage | undefined { | 275 | function getDestructiveMenuIcon(): Electron.NativeImage | undefined { |
| 267 | if (process.platform !== "darwin") return undefined; | 276 | if (process.platform !== "darwin") return undefined; |
| 268 | if (destructiveMenuIconCache !== undefined) { | 277 | if (destructiveMenuIconCache !== undefined) { |
| ... | @@ -715,6 +724,10 @@ function configureAppIdentity(): void { | ... | @@ -715,6 +724,10 @@ function configureAppIdentity(): void { |
| 715 | app.setAppUserModelId(APP_USER_MODEL_ID); | 724 | app.setAppUserModelId(APP_USER_MODEL_ID); |
| 716 | } | 725 | } |
| 717 | | 726 | |
| | 727 | if (process.platform === "linux") { |
| | 728 | (app as LinuxDesktopNamedApp).setDesktopName?.(LINUX_DESKTOP_ENTRY_NAME); |
| | 729 | } |
| | 730 | |
| 718 | if (process.platform === "darwin" && app.dock) { | 731 | if (process.platform === "darwin" && app.dock) { |
| 719 | const iconPath = resolveIconPath("png"); | 732 | const iconPath = resolveIconPath("png"); |
| 720 | if (iconPath) { | 733 | if (iconPath) { |