Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 452b09c

Browse files
committed
Add debugging information
1 parent 76639d7 commit 452b09c

File tree

4 files changed

+53
-12
lines changed

4 files changed

+53
-12
lines changed

lib/install/macos.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
const { exec: _exec } = require('child_process');
44
const { resolve } = require('path');
55
const { promisify } = require('util');
6+
7+
const debug = require('debug')('install');
8+
69
const { 'interaction.pressKeys': pressKeys } = require('../modules/macos/interaction');
710

811
const LSREGISTER_EXECUTABLE_PATH =
@@ -137,17 +140,20 @@ const getExecOptions = async function () {
137140
* https://support.apple.com/en-us/101987
138141
*
139142
* @param {ExecOptions} options
140-
* @returns {Promise<void>}
143+
* @returns {Promise<boolean>} Whether a change took place
141144
*/
142145
async function removeQuarantine(options) {
146+
debug('Removing macOS quarantine');
143147
await exec(`xattr -r -d com.apple.quarantine ${APPLICATION_NAME}`, options);
148+
return true;
144149
}
145150

146151
/**
147152
* @param {ExecOptions} options
148153
* @returns {Promise<void>}
149154
*/
150155
async function registerExtensions(options) {
156+
debug('Registering trusted macOS extension');
151157
await exec(`${LSREGISTER_EXECUTABLE_PATH} -f -R -trusted ${APPLICATION_NAME}`, options);
152158
}
153159

@@ -156,19 +162,33 @@ async function registerExtensions(options) {
156162
* @returns {Promise<void>}
157163
*/
158164
async function unregisterExtensions(options) {
165+
debug('Unregistering trusted macOS extension');
159166
await exec(`${LSREGISTER_EXECUTABLE_PATH} -f -R -trusted -u ${APPLICATION_NAME}`, options);
160167
}
161168

162169
async function enableExtension() {
170+
debug('Enabling macOS extension');
163171
await exec(`pluginkit -e use -i ${EXTENSION_IDENTIFIER}`);
164172
}
165173

166174
/**
167-
* @param {string} voice
175+
* @param {string} newValue the identifier for the voice to set
168176
* @returns {Promise<void>}
169177
*/
170-
async function setSystemVoice(voice) {
178+
async function setSystemVoice(newValue) {
179+
debug(`Setting macOS system voice to "${newValue}"`);
180+
181+
const {stdout} = await exec('defaults read com.apple.Accessibility SpeechVoiceIdentifierForLanguage');
182+
const currentValue = stdout.replace(/[\s]/g, '').match(/2={en="([^"]+)";};/);
183+
184+
debug(`Current value: ${currentValue ? JSON.stringify(currentValue[1]) : '(unset)'}`);
185+
186+
if (currentValue && currentValue[1] === newValue) {
187+
debug('Already set.');
188+
return;
189+
}
190+
171191
await exec(
172-
`defaults write com.apple.Accessibility SpeechVoiceIdentifierForLanguage '{2 = {en = "${voice}";};}'`,
192+
`defaults write com.apple.Accessibility SpeechVoiceIdentifierForLanguage '{2 = {en = "${newValue}";};}'`,
173193
);
174194
}

package-lock.json

Lines changed: 28 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"typescript": "^5.3.3"
3232
},
3333
"dependencies": {
34+
"debug": "^4.3.4",
3435
"robotjs": "^0.6.0",
3536
"uuid": "^9.0.1",
3637
"ws": "^8.2.3",

src/macos/ATDriverGenericMacOS/ATDriverGenericMacOS.xcodeproj/xcshareddata/xcschemes/ATDriverGenericMacOSExtension.xcscheme

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
savedToolIdentifier = ""
9696
useCustomWorkingDirectory = "NO"
9797
debugDocumentVersioning = "YES"
98-
askForAppToLaunch = "Yes"
9998
launchAutomaticallySubstyle = "2">
10099
<BuildableProductRunnable
101100
runnableDebuggingMode = "0">

0 commit comments

Comments
 (0)