|
17 | 17 | // @raycast.packageName Gemini
|
18 | 18 |
|
19 | 19 | // Optional parameters:
|
20 |
| -// @raycast.icon ../images/icon-gemini.svg |
| 20 | +// @raycast.icon ./images/icon-gemini.svg |
21 | 21 | // @raycast.argument1 { "type": "text", "placeholder": "Selected Text", "optional": true }
|
22 | 22 | // @raycast.argument2 { "type": "text", "placeholder": "Prompt"}
|
23 | 23 |
|
@@ -52,15 +52,37 @@ function sleep(ms) {
|
52 | 52 | while (Date.now() - start < ms) {}
|
53 | 53 | }
|
54 | 54 |
|
55 |
| -try { |
56 |
| - execSync("which chrome-cli"); |
57 |
| -} catch { |
58 |
| - console.error( |
59 |
| - "chrome-cli is required to run this script (https://github.com/prasmussen/chrome-cli)", |
60 |
| - ); |
61 |
| - process.exit(1); |
| 55 | +/** |
| 56 | + * Verifies that all required dependencies are installed. |
| 57 | + * Exits the process with an error message if any dependency is missing. |
| 58 | + */ |
| 59 | +function checkDependencies() { |
| 60 | + // Check if Google Chrome is installed |
| 61 | + try { |
| 62 | + execSync("osascript -e 'tell application \"Google Chrome\" to get version'" , { stdio: "ignore" }); |
| 63 | + } catch { |
| 64 | + try { |
| 65 | + execSync("osascript -e 'tell application \"Chrome\" to get version'" , { stdio: "ignore" }); |
| 66 | + } catch { |
| 67 | + console.error("Google Chrome is required to run this script"); |
| 68 | + process.exit(1); |
| 69 | + } |
| 70 | + } |
| 71 | + |
| 72 | + // Check if chrome-cli is installed |
| 73 | + try { |
| 74 | + execSync("which chrome-cli"); |
| 75 | + } catch { |
| 76 | + console.error( |
| 77 | + "chrome-cli is required to run this script (https://github.com/prasmussen/chrome-cli)" |
| 78 | + ); |
| 79 | + process.exit(1); |
| 80 | + } |
62 | 81 | }
|
63 | 82 |
|
| 83 | +// Verify all dependencies are installed |
| 84 | +checkDependencies(); |
| 85 | + |
64 | 86 | // Bring Chrome to the foreground first.
|
65 | 87 | try {
|
66 | 88 | // Try to activate Chrome through AppleScript, supporting different possible application names.
|
|
0 commit comments