Skip to content

feat: add macOS Desktop App installation script#140

Merged
lsdefine merged 3 commits intolsdefine:mainfrom
huangrichao2020:feat/macos-desktop-app
Apr 25, 2026
Merged

feat: add macOS Desktop App installation script#140
lsdefine merged 3 commits intolsdefine:mainfrom
huangrichao2020:feat/macos-desktop-app

Conversation

@huangrichao2020
Copy link
Copy Markdown
Contributor

Summary

Add macOS Desktop App support — install GenericAgent as a native macOS application that launches from Spotlight, Launchpad, or the Applications folder with a single click.

Changes

1. Installation Script

  • File: scripts/install-macos-app.sh
  • One-click installer that creates a .app bundle in /Applications
  • Uses the official assets/images/logo.jpg as app icon (multi-resolution ICNS)
  • On first run, prompts user to select their GenericAgent project folder
  • Then runs python3 launch.pyw from that directory
  • Supports --auto flag for non-interactive mode

2. README Update

  • Added macOS Desktop App section under 快速开始
  • Chinese description matching the README style

User Experience

After installation:

  • Press Cmd + Space → type "GenericAgent" → Enter
  • First run: select your GenericAgent project folder
  • The app opens Terminal and runs launch.pyw with the pywebview desktop UI

Why This Matters

GenericAgent currently requires manual python launch.pyw from the terminal. macOS users often prefer launching tools from Spotlight/Launchpad. This provides a native desktop entry point, similar to how other dev tools provide .app bundles.

Checklist

  • Installation script tested on macOS
  • Uses existing repo asset (assets/images/logo.jpg) for icon
  • README updated in Chinese (matching existing style)
  • No new dependencies added
  • Script follows existing code philosophy: minimal, practical, no fluff

- Add scripts/install-macos-app.sh for one-click macOS app installation
- Uses bundled assets/images/logo.jpg as app icon
- AppleScript prompts for project folder on first run
- Updates README with macOS Desktop App installation option
- Supports both interactive and --auto non-interactive modes

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Copy link
Copy Markdown
Owner

@lsdefine lsdefine left a comment

Choose a reason for hiding this comment

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

感谢贡献!启动器的想法很好,不过实现上有几个点需要调整:

1. Dock 缓存刷新方式太激进

rm ~/Library/Application\ Support/Dock/*.db 2>/dev/null || true
killall Dock 2>/dev/null || true

这会删除用户整个 Dock 数据库,重置 Dock 布局(图标排列、最近使用等)。只需要 killall Dock 就够了,甚至可以不做(安装完用户自己重启 Dock 或等一会就会刷新)。

2. 路径不需要每次弹窗选择

脚本运行时已经通过 SCRIPT_DIR 算出了 PROJECT_ROOT,完全可以直接把项目路径硬编码进 AppleScript,不需要 choose folder。当前方案首次启动弹文件夹选择器,而且 AppleScript property 持久化在 /Applications 下的 .scpt 里,写权限不一定有,可能导致每次都弹。

建议直接在 osacompile 前把 PROJECT_ROOT 写进 AppleScript:

on run
    set projectPathStr to "/actual/path/to/GenericAgent/"
    tell application "Terminal"
        activate
        do script "cd " & quoted form of projectPathStr & " && python3 launch.pyw"
    end tell
end run

3. /Applications 写入缺少权限处理

cp -R/Applications/ 如果权限不足会直接失败(set -e),建议加个 fallback 到 ~/Applications/ 或提示用户 sudo。

4. 文件位置调整

不需要新建 scripts/ 目录,直接放 assets/install-macos-app.sh 即可。README 部分的改动先不加,我后续统一处理。


改完这几点就可以 merge,期待更新 👍

Comment thread scripts/install-macos-app.sh Outdated
Comment thread scripts/install-macos-app.sh Outdated
@huangrichao2020
Copy link
Copy Markdown
Contributor Author

Updated per your review. I narrowed the PR to only �[0;36m
╔═══════════════════════════════════════════════════════════╗
║ GenericAgent — macOS Desktop App Installer ║
╚═══════════════════════════════════════════════════════════╝
�[0m

This will install a desktop app that launches GenericAgent
from Spotlight, Launchpad, or the Applications folder. and adjusted the implementation accordingly:\n\n- removed the aggressive Dock database reset\n- embedded the current project path directly into the AppleScript instead of prompting on first run\n- added a fallback from to \n- moved the script from to \n\nREADME changes were dropped as requested.

@huangrichao2020
Copy link
Copy Markdown
Contributor Author

Updated per your review. I narrowed the PR to only assets/install-macos-app.sh and adjusted the implementation accordingly:

  • removed the aggressive Dock database reset
  • embedded the current project path directly into the AppleScript instead of prompting on first run
  • added a fallback from /Applications to ~/Applications
  • moved the script from scripts/ to assets/

README changes were dropped as requested.

@lsdefine lsdefine merged commit 567c7f5 into lsdefine:main Apr 25, 2026
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.

2 participants