Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Fix Windows desktop icon installation (#1253)

Ali Khokharb695634b9123
diff --git a/pyproject.toml b/pyproject.toml
index f2cfcf08..c727d891 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "4.12.5"
+version = "4.12.6"
description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/scripts/install.ps1 b/scripts/install.ps1
index 3bec19f0..5c940be6 100644
--- a/scripts/install.ps1
+++ b/scripts/install.ps1
@@ -517,6 +517,40 @@ function Install-FreeClaudeCode {
Invoke-NativeCommand -FilePath $uvPath -Arguments $arguments
}
+function Export-FccDesktopIcon {
+ param(
+ [string] $DesktopCommand,
+ [string] $IconPath
+ )
+
+ $arguments = @("--export-icon", $IconPath)
+ $commandText = Format-Command -FilePath $DesktopCommand -Arguments $arguments
+ Write-Host "+ $commandText"
+ if ($DryRun) {
+ return
+ }
+
+ # PowerShell does not wait when directly invoking a Windows GUI executable.
+ $process = Start-Process `
+ -FilePath $DesktopCommand `
+ -ArgumentList @("--export-icon", ('"' + $IconPath + '"')) `
+ -WindowStyle Hidden `
+ -Wait `
+ -PassThru
+ try {
+ $exitCode = $process.ExitCode
+ }
+ finally {
+ $process.Dispose()
+ }
+ if ($exitCode -ne 0) {
+ throw "Command failed with exit code ${exitCode}: $commandText"
+ }
+ if (-not (Test-Path -LiteralPath $IconPath -PathType Leaf)) {
+ throw "Free Claude Code did not export its Windows app icon to '$IconPath'."
+ }
+}
+
function Configure-AndConfirmFreeClaudeCode {
$iconPath = Join-Path $env:USERPROFILE ".fcc\app-icon.ico"
if ($DryRun) {
@@ -524,10 +558,9 @@ function Configure-AndConfirmFreeClaudeCode {
Write-Host "+ uv tool dir --bin"
Write-Host "+ verify fcc-desktop, fcc-server, fcc-claude, fcc-codex, and fcc-pi in the uv tool bin directory"
Write-Host "+ fcc-server --version"
- Invoke-NativeCommand -FilePath "<uv-tool-bin>\fcc-desktop.exe" -Arguments @(
- "--export-icon",
- $iconPath
- )
+ Export-FccDesktopIcon `
+ -DesktopCommand "<uv-tool-bin>\fcc-desktop.exe" `
+ -IconPath $iconPath
Install-FccDesktopShortcuts `
-DesktopCommand "<uv-tool-bin>\fcc-desktop.exe" `
-IconPath $iconPath
@@ -566,13 +599,9 @@ function Configure-AndConfirmFreeClaudeCode {
}
Invoke-NativeCommand -FilePath $installedCommands["fcc-server"] -Arguments @("--version")
- Invoke-NativeCommand -FilePath $installedCommands["fcc-desktop"] -Arguments @(
- "--export-icon",
- $iconPath
- )
- if (-not (Test-Path -LiteralPath $iconPath -PathType Leaf)) {
- throw "Free Claude Code did not export its Windows app icon to '$iconPath'."
- }
+ Export-FccDesktopIcon `
+ -DesktopCommand $installedCommands["fcc-desktop"] `
+ -IconPath $iconPath
Install-FccDesktopShortcuts `
-DesktopCommand $installedCommands["fcc-desktop"] `
-IconPath $iconPath
diff --git a/tests/scripts/test_installers.py b/tests/scripts/test_installers.py
index 6ceb9bac..dcf795fc 100644
--- a/tests/scripts/test_installers.py
+++ b/tests/scripts/test_installers.py
@@ -1,6 +1,7 @@
import os
import shutil
import subprocess
+import sys
from dataclasses import dataclass
from pathlib import Path
@@ -746,6 +747,77 @@ def _powershells() -> tuple[str, ...]:
return tuple(dict.fromkeys(path for path in candidates if path is not None))
+def test_install_ps1_waits_for_gui_icon_export() -> None:
+ installer = (_repo_root() / "scripts" / "install.ps1").read_text(encoding="utf-8")
+ body = _braced_body(installer, "function Export-FccDesktopIcon")
+
+ assert "Start-Process" in body
+ assert "-WindowStyle Hidden" in body
+ assert "-Wait" in body
+ assert "-PassThru" in body
+ assert "$process.ExitCode" in body
+
+
+ "powershell",
+ _powershells() or (None,),
+ ids=lambda path: Path(path).name if path is not None else "unavailable",
+)
+def test_install_ps1_gui_icon_export_completes_before_returning(
+ powershell: str | None,
+ tmp_path: Path,
+) -> None:
+ if powershell is None or os.name != "nt":
+ pytest.skip("PowerShell GUI process behavior runs on Windows hosts")
+
+ installer = (_repo_root() / "scripts" / "install.ps1").read_text(encoding="utf-8")
+ function_declarations = (
+ "function Format-Argument",
+ "function Format-Command",
+ "function Export-FccDesktopIcon",
+ )
+ functions = "\n".join(
+ f"{declaration} {{{_braced_body(installer, declaration)}}}"
+ for declaration in function_declarations
+ )
+ installed_desktop_command = Path(sys.executable).with_name("fcc-desktop.exe")
+ desktop_command = tmp_path / "icon-exporter.exe"
+ shutil.copy2(installed_desktop_command, desktop_command)
+ destination = tmp_path / "profile with spaces" / ".fcc" / "app-icon.ico"
+ env = os.environ | {
+ "FCC_TEST_DESKTOP_COMMAND": str(desktop_command),
+ "FCC_TEST_ICON_PATH": str(destination),
+ }
+ script = "\n".join(
+ (
+ '$ErrorActionPreference = "Stop"',
+ "$DryRun = $false",
+ functions,
+ (
+ "Export-FccDesktopIcon "
+ "-DesktopCommand $env:FCC_TEST_DESKTOP_COMMAND "
+ "-IconPath $env:FCC_TEST_ICON_PATH"
+ ),
+ )
+ )
+
+ completed = subprocess.run(
+ [powershell, "-NoProfile", "-Command", script],
+ check=False,
+ capture_output=True,
+ text=True,
+ env=env,
+ )
+
+ assert completed.returncode == 0, completed.stderr
+ assert (
+ destination.read_bytes()
+ == (
+ _repo_root() / "src" / "free_claude_code" / "assets" / "app-icon.ico"
+ ).read_bytes()
+ )
+
+
def _create_windows_shortcut(
powershell: str,
shortcut_path: Path,
@@ -1104,7 +1176,7 @@ def test_install_ps1_fresh_install_is_verified(
app_data = Path(powershell_harness.env["APPDATA"])
icon = home / ".fcc" / "app-icon.ico"
assert icon.read_text(encoding="utf-8").strip() == "fake icon"
- assert calls[-1] == f"fcc-desktop:--export-icon {icon}"
+ assert calls[-1] == f'fcc-desktop:--export-icon "{icon}"'
desktop_shortcut = home / "Desktop" / "Free Claude Code.lnk"
assert desktop_shortcut.is_file()
assert (
diff --git a/uv.lock b/uv.lock
index 9295f6ac..26a8a9af 100644
--- a/uv.lock
+++ b/uv.lock
@@ -620,7 +620,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "4.12.5"
+version = "4.12.6"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },