From 0ce74f67d9bcfebc3d3f0b95f8e958e98056c37d Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sun, 9 Nov 2025 11:03:31 +0800 Subject: [PATCH] Optimize the installation experience of raycast --- README.md | 2 +- integrations/README.md | 4 ++-- integrations/setup-quick-launchers.sh | 32 ++++++++++++++++++++++----- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ef13dc1..163fab2 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ One command sets up Raycast + Alfred shortcuts for `mo clean` and `mo uninstall` curl -fsSL https://raw.githubusercontent.com/tw93/mole/main/integrations/setup-quick-launchers.sh | bash ``` -Done! Raycast gets β€œClean Mac / Uninstall Apps”, Alfred gets `mclean / muninstall`. +Done! Raycast gets `clean` / `uninstall`, Alfred gets the same keywords. Details and manual options live in [integrations/README.md](integrations/README.md). ## Features in Detail diff --git a/integrations/README.md b/integrations/README.md index 80f05f7..41ac386 100644 --- a/integrations/README.md +++ b/integrations/README.md @@ -10,8 +10,8 @@ curl -fsSL https://raw.githubusercontent.com/tw93/Mole/main/integrations/setup-q This command: -- Adds two Raycast Script Commands (`Clean Mac`, `Uninstall Apps`) to the usual Raycast directories and opens the Script Commands panel so you can reload immediately. -- Creates two Alfred workflows with keywords `mclean` and `muninstall` so you can type and run Mole in Alfred. +- Adds two Raycast Script Commands (`clean`, `uninstall`) to the usual Raycast directories and opens the Script Commands panel so you can reload immediately. +- Creates two Alfred workflows with keywords `clean` and `uninstall` so you can type and run Mole in Alfred. Both launchers call your locally installed `mo`/`mole` binary directlyβ€”no extra prompts or AppleScript permissions needed. ## Alfred diff --git a/integrations/setup-quick-launchers.sh b/integrations/setup-quick-launchers.sh index fc7e16d..f689dc4 100644 --- a/integrations/setup-quick-launchers.sh +++ b/integrations/setup-quick-launchers.sh @@ -35,6 +35,9 @@ write_raycast_script() { local title="$2" local mo_bin="$3" local subcommand="$4" + local cmd="${mo_bin} ${subcommand}" + local cmd_escaped="${cmd//\\/\\\\}" + cmd_escaped="${cmd_escaped//\"/\\\"}" cat > "$target" </dev/null 2>&1; then + osascript <<'APPLESCRIPT' +tell application "Terminal" + activate + do script "${cmd_escaped}" +end tell +APPLESCRIPT +else + echo "TERM environment variable not set. Run this manually:" + echo " ${cmd}" + exit 1 +fi EOF chmod +x "$target" } @@ -75,8 +95,8 @@ create_raycast_commands() { log_step "Installing Raycast commands..." for dir in "${dirs[@]}"; do mkdir -p "$dir" - write_raycast_script "$dir/mole-clean.sh" "Clean Mac" "$mo_bin" "clean" - write_raycast_script "$dir/mole-uninstall.sh" "Uninstall Apps" "$mo_bin" "uninstall" + write_raycast_script "$dir/mole-clean.sh" "clean" "$mo_bin" "clean" + write_raycast_script "$dir/mole-uninstall.sh" "uninstall" "$mo_bin" "uninstall" log_success "Scripts ready in: $dir" done @@ -108,8 +128,8 @@ create_alfred_workflow() { log_step "Installing Alfred workflows..." local workflows=( - "fun.tw93.mole.clean|Mole Clean|mclean|Run Mole clean|\"${mo_bin}\" clean" - "fun.tw93.mole.uninstall|Mole Uninstall|muninstall|Uninstall apps via Mole|\"${mo_bin}\" uninstall" + "fun.tw93.mole.clean|Mole clean|clean|Run Mole clean|\"${mo_bin}\" clean" + "fun.tw93.mole.uninstall|Mole uninstall|uninstall|Uninstall apps via Mole|\"${mo_bin}\" uninstall" ) for entry in "${workflows[@]}"; do @@ -224,7 +244,7 @@ main() { create_alfred_workflow "$mo_bin" echo "" - log_success "Done! Raycast (search β€œClean Mac”) and Alfred (keywords: mclean / muninstall) are ready." + log_success "Done! Raycast (search β€œclean” / β€œuninstall”) and Alfred (keywords: clean / uninstall) are ready." echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" }