add desktop icon for extension

This commit is contained in:
Adam
2025-10-31 12:06:02 -07:00
parent 8da83f6f0a
commit be4b03f268
6 changed files with 62 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ Usage:
import os
import shutil
import subprocess
import sys
import tempfile
import zipfile
@@ -37,7 +38,7 @@ def main():
# Required files to copy
files_to_copy = {
"manifest.json": output_dir / "manifest.json",
"logo_black.png": output_dir / "logo_black.png",
"desktop_extension.png": output_dir / "desktop_extension.png",
"requirements.txt": output_dir / "requirements.txt",
"run_server.sh": output_dir / "run_server.sh",
"setup.py": output_dir / "setup.py",
@@ -106,6 +107,59 @@ def main():
print(f"✓ Build complete: {output_file}")
print(f" Archive size: {output_file.stat().st_size / 1024:.1f} KB")
# Set custom file icon based on platform
icon_file = output_dir / "desktop_extension.png"
if sys.platform == "darwin":
_set_icon_macos(output_file, icon_file)
elif sys.platform == "win32":
_set_icon_windows(output_file, icon_file)
elif sys.platform.startswith("linux"):
_set_icon_linux(output_file, icon_file)
def _set_icon_macos(output_file: Path, icon_file: Path):
"""Set custom file icon on macOS."""
try:
# Check if fileicon is installed
result = subprocess.run(["which", "fileicon"], capture_output=True, text=True)
if result.returncode == 0:
# Use the logo as the file icon
if icon_file.exists():
print(" Setting custom file icon (macOS)...")
subprocess.run(
["fileicon", "set", str(output_file), str(icon_file)],
check=False,
capture_output=True,
)
print(" ✓ File icon set")
else:
print(f" ⚠ Icon file not found: {icon_file}")
else:
print(" ⚠ fileicon not installed (optional - for custom file icon)")
print(" Install with: brew install fileicon")
except Exception as e:
print(f" ⚠ Could not set file icon: {e}")
def _set_icon_windows(output_file: Path, icon_file: Path):
"""Set custom file icon on Windows."""
try:
# Windows uses a desktop.ini approach, which is complex
# For simplicity, we'll skip this for now
print(" ⚠ Custom file icons not supported on Windows yet")
except Exception as e:
print(f" ⚠ Could not set file icon: {e}")
def _set_icon_linux(output_file: Path, icon_file: Path):
"""Set custom file icon on Linux."""
try:
# Linux uses .desktop files and thumbnail generation
# This is complex and depends on the desktop environment
print(" ⚠ Custom file icons not supported on Linux yet")
except Exception as e:
print(f" ⚠ Could not set file icon: {e}")
if __name__ == "__main__":
main()

View File

@@ -16,6 +16,9 @@ This will:
1. Copy the MCP server code from `mcp_server/` directory
2. Copy static files (manifest, icons, scripts)
3. Create a `.mcpb` zip archive in `desktop-extension/cua-extension.mcpb`
4. Set custom file icon (platform-specific):
- macOS: Uses `fileicon` (install with `brew install fileicon`)
- Windows/Linux: Not yet supported
## Directory Structure
@@ -23,11 +26,11 @@ This will:
desktop-extension/
├── README.md # This file
├── manifest.json # Extension manifest
├── logo_black.png # Extension icon
├── desktop_extension.png # Extension icon
├── requirements.txt # Python dependencies
├── run_server.sh # Server launcher script
├── setup.py # Dependency installer
└── cua-extension.mcpb # Generated extension archive (gitignored)
└── cua-extension.mcpb # Generated extension archive
```
## Source Files
@@ -42,7 +45,7 @@ The actual MCP server code lives in `../mcp_server/`:
These files are maintained in this directory:
- `manifest.json` - Extension metadata and configuration
- `logo_black.png` - Extension icon
- `desktop_extension.png` - Extension icon
- `requirements.txt` - Python package dependencies
- `run_server.sh` - Shell script to launch the server
- `setup.py` - Python script to install dependencies

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -17,7 +17,7 @@
"homepage": "https://trycua.com",
"documentation": "https://docs.trycua.com",
"support": "https://github.com/trycua/cua/issues",
"icon": "logo_black.png",
"icon": "desktop_extension.png",
"server": {
"type": "python",
"entry_point": "server.py",