mirror of
https://github.com/tw93/Mole.git
synced 2026-02-15 17:30:05 +00:00
Optimize the installation experience of raycast
This commit is contained in:
@@ -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
|
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).
|
Details and manual options live in [integrations/README.md](integrations/README.md).
|
||||||
|
|
||||||
## Features in Detail
|
## Features in Detail
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ curl -fsSL https://raw.githubusercontent.com/tw93/Mole/main/integrations/setup-q
|
|||||||
|
|
||||||
This command:
|
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.
|
- 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 `mclean` and `muninstall` so you can type and run Mole in Alfred.
|
- 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.
|
Both launchers call your locally installed `mo`/`mole` binary directly—no extra prompts or AppleScript permissions needed.
|
||||||
|
|
||||||
## Alfred
|
## Alfred
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ write_raycast_script() {
|
|||||||
local title="$2"
|
local title="$2"
|
||||||
local mo_bin="$3"
|
local mo_bin="$3"
|
||||||
local subcommand="$4"
|
local subcommand="$4"
|
||||||
|
local cmd="${mo_bin} ${subcommand}"
|
||||||
|
local cmd_escaped="${cmd//\\/\\\\}"
|
||||||
|
cmd_escaped="${cmd_escaped//\"/\\\"}"
|
||||||
cat > "$target" <<EOF
|
cat > "$target" <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
@@ -51,7 +54,24 @@ set -euo pipefail
|
|||||||
|
|
||||||
echo "🐹 Running ${title}..."
|
echo "🐹 Running ${title}..."
|
||||||
echo ""
|
echo ""
|
||||||
"${mo_bin}" ${subcommand}
|
|
||||||
|
if [[ -n "\${TERM:-}" && "\${TERM}" != "dumb" ]]; then
|
||||||
|
"${mo_bin}" ${subcommand}
|
||||||
|
exit \$?
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v osascript >/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
|
EOF
|
||||||
chmod +x "$target"
|
chmod +x "$target"
|
||||||
}
|
}
|
||||||
@@ -75,8 +95,8 @@ create_raycast_commands() {
|
|||||||
log_step "Installing Raycast commands..."
|
log_step "Installing Raycast commands..."
|
||||||
for dir in "${dirs[@]}"; do
|
for dir in "${dirs[@]}"; do
|
||||||
mkdir -p "$dir"
|
mkdir -p "$dir"
|
||||||
write_raycast_script "$dir/mole-clean.sh" "Clean Mac" "$mo_bin" "clean"
|
write_raycast_script "$dir/mole-clean.sh" "clean" "$mo_bin" "clean"
|
||||||
write_raycast_script "$dir/mole-uninstall.sh" "Uninstall Apps" "$mo_bin" "uninstall"
|
write_raycast_script "$dir/mole-uninstall.sh" "uninstall" "$mo_bin" "uninstall"
|
||||||
log_success "Scripts ready in: $dir"
|
log_success "Scripts ready in: $dir"
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -108,8 +128,8 @@ create_alfred_workflow() {
|
|||||||
|
|
||||||
log_step "Installing Alfred workflows..."
|
log_step "Installing Alfred workflows..."
|
||||||
local workflows=(
|
local workflows=(
|
||||||
"fun.tw93.mole.clean|Mole Clean|mclean|Run Mole clean|\"${mo_bin}\" clean"
|
"fun.tw93.mole.clean|Mole clean|clean|Run Mole clean|\"${mo_bin}\" clean"
|
||||||
"fun.tw93.mole.uninstall|Mole Uninstall|muninstall|Uninstall apps via Mole|\"${mo_bin}\" uninstall"
|
"fun.tw93.mole.uninstall|Mole uninstall|uninstall|Uninstall apps via Mole|\"${mo_bin}\" uninstall"
|
||||||
)
|
)
|
||||||
|
|
||||||
for entry in "${workflows[@]}"; do
|
for entry in "${workflows[@]}"; do
|
||||||
@@ -224,7 +244,7 @@ main() {
|
|||||||
create_alfred_workflow "$mo_bin"
|
create_alfred_workflow "$mo_bin"
|
||||||
|
|
||||||
echo ""
|
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 "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user