Skip to content

Add Linux support for apt-installed figma-linux - #18

Open
monossido wants to merge 1 commit into
silships:mainfrom
monossido:feature/figma-linux-support
Open

Add Linux support for apt-installed figma-linux#18
monossido wants to merge 1 commit into
silships:mainfrom
monossido:feature/figma-linux-support

Conversation

@monossido

Copy link
Copy Markdown

Figma can be installed in linux via unofficial Electron-based desktop app (https://github.com/Figma-Linux/figma-linux)

I patched figma-cli for linux support

Please not:
Snap version of figma-linux cannot work in Yolo Mode because of sandbox.
Apt version is ok

For me Safe Mode is not usable because of missing working plugins in figma-linux

Copilot AI review requested due to automatic review settings March 29, 2026 22:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Linux support for the unofficial Electron-based figma-linux desktop app (primarily apt-installed) by improving binary/app.asar discovery and updating CLI + launcher scripts to handle Linux-specific behaviors and Snap limitations.

Changes:

  • Add Linux path detection for app.asar and the Figma binary, plus Linux-specific process management.
  • Block/handle Snap-installed figma-linux for Yolo Mode patching and improve related user messaging.
  • Update shell tooling (setup-alias, fig-start) and documentation to reflect Linux support.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/platform.js Adds Linux asar/binary detection, Linux process kill/run checks, and Linux version detection.
src/index.js Improves Linux Snap-related setup messaging and makes figma-use detection platform-specific.
src/figma-patch.js Explicitly blocks patching Snap-installed figma-linux and adds Linux-specific permission guidance.
bin/setup-alias.sh Makes alias-update sed -i behavior compatible across GNU/BSD sed.
bin/fig-start Adds Linux-aware Figma startup and broader “Figma running” detection.
README.md Documents Linux support constraints (apt-installed figma-linux, not Snap).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/platform.js
Comment on lines +225 to +228
case 'linux': {
const binaryPath = getLinuxBinaryPath();
return binaryPath ? `${binaryPath} --remote-debugging-port=${port}` : `figma-linux --remote-debugging-port=${port}`;
}

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux, getFigmaCommand returns an unquoted binaryPath. If FIGMA_CLI_BINARY_PATH contains spaces (or other shell-sensitive chars), the printed manual command will be incorrect. Consider shell-quoting the path or returning an argv-style array from getFigmaCommand and formatting it for display safely at the call site.

Copilot uses AI. Check for mistakes.
Comment thread src/platform.js
Comment on lines +240 to +245
} else if (PLATFORM === 'linux') {
const binaryPath = getLinuxBinaryPath();
if (!binaryPath) return 'unknown';
try {
return execSync(`${binaryPath} --version 2>/dev/null`, { encoding: 'utf8', stdio: 'pipe', timeout: 2000 }).trim() || 'unknown';
} catch {

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getFigmaVersion() builds a shell command with string interpolation: execSync(${binaryPath} --version ...). This breaks when binaryPath contains spaces and also needlessly invokes a shell. Use execFileSync(binaryPath, ['--version'], ...) (or spawnSync) to avoid quoting issues and shell interpretation.

Copilot uses AI. Check for mistakes.
Comment thread src/platform.js
const ps = execSync('pgrep -f Figma 2>/dev/null || true', { encoding: 'utf8' });
return ps.trim().length > 0;
} else if (PLATFORM === 'linux') {
const ps = execSync('pgrep -f "/figma-linux|/figma " 2>/dev/null || true', { encoding: 'utf8' });

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux isFigmaRunning() uses pgrep -f "/figma-linux|/figma ". This can fail when the process command line is just figma/figma-linux (no leading slash) or when the executable is running without arguments (no trailing space). Prefer pgrep -x figma-linux || pgrep -x figma or a regex that matches both path and bare names, e.g. (figma-linux|figma)( |$).

Suggested change
const ps = execSync('pgrep -f "/figma-linux|/figma " 2>/dev/null || true', { encoding: 'utf8' });
const ps = execSync('pgrep -f "(figma-linux|figma)( |$)" 2>/dev/null || true', { encoding: 'utf8' });

Copilot uses AI. Check for mistakes.
Comment thread src/index.js
console.log(chalk.gray(' Or use Safe Mode: ') + chalk.cyan('node src/index.js connect --safe\n'));
} else if (process.platform === 'linux' && err.message.includes('Snap')) {
console.log(chalk.yellow('\n Snap-installed figma-linux is not supported.\n'));
console.log(chalk.gray(' Install the unofficial apt package instead if you want Linux support.\n'));

Copilot AI Mar 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this Snap-specific failure branch, the output omits the Safe Mode fallback hint that other setup-failure branches include. Adding the same "connect --safe" suggestion here would keep guidance consistent and help users proceed even when Snap installs are unsupported.

Suggested change
console.log(chalk.gray(' Install the unofficial apt package instead if you want Linux support.\n'));
console.log(chalk.gray(' Install the unofficial apt package instead if you want Linux support.\n'));
console.log(chalk.gray(' Or use Safe Mode: ') + chalk.cyan('node src/index.js connect --safe\n'));

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants