feat: add Linux build support (AppImage, deb, rpm)

Add Linux as a supported platform with AppImage, deb, and rpm targets
for both x64 and arm64 architectures.

Changes:
- electron-builder.yml: add linux section with AppImage/deb/rpm targets,
  icon, category, and desktop entry configuration
- package.json: add electron:pack:linux script
- electron/main.ts: fix getIconPath() to return .png on Linux instead
  of .icns (macOS format); enable loadUserShellEnv() on Linux since GUI
  apps launched from desktop also have limited env
- README.md + README_CN.md: update supported platforms section

The README previously stated 'Linux builds are planned. Contributions
welcome.' — this delivers on that.
This commit is contained in:
liuxiaopai-ai committed 2026-02-08 16:01:33 +08:00
1 parent 21226fc010
commit afeaa6a120
5 files changed
+28 -9

No files matched your search

+8 -4
View File
@@ -71,12 +71,13 @@ function checkNativeModuleABI(): void {
/**
* Read the user's full shell environment by running a login shell.
* When Electron is launched from Dock/Finder, process.env is very limited
* and won't include vars from .zshrc/.bashrc (e.g. API keys).
* When Electron is launched from Dock/Finder (macOS) or desktop launcher
* (Linux), process.env is very limited and won't include vars from
* .zshrc/.bashrc (e.g. API keys, nvm PATH).
*/
function loadUserShellEnv(): Record<string, string> {
// Only macOS needs login-shell env loading; Windows/Linux GUI apps inherit full env
if (process.platform !== 'darwin') {
// Windows GUI apps inherit the full user environment
if (process.platform === 'win32') {
return {};
}
try {
@@ -250,6 +251,9 @@ function getIconPath(): string {
if (process.platform === 'win32') {
return path.join(process.resourcesPath, 'icon.ico');
}
if (process.platform === 'linux') {
return path.join(process.resourcesPath, 'icon.png');
}
return path.join(process.resourcesPath, 'icon.icns');
}