MCPcopy Index your code
hub / github.com/codeaashu/claude-code / isAppleTerminalBellDisabled

Function isAppleTerminalBellDisabled

src/services/notifier.ts:110–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108}
109
110async function isAppleTerminalBellDisabled(): Promise<boolean> {
111 try {
112 if (env.terminal !== 'Apple_Terminal') {
113 return false
114 }
115
116 const osascriptResult = await execFileNoThrow('osascript', [
117 '-e',
118 'tell application "Terminal" to name of current settings of front window',
119 ])
120 const currentProfile = osascriptResult.stdout.trim()
121
122 if (!currentProfile) {
123 return false
124 }
125
126 const defaultsOutput = await execFileNoThrow('defaults', [
127 'export',
128 'com.apple.Terminal',
129 '-',
130 ])
131
132 if (defaultsOutput.code !== 0) {
133 return false
134 }
135
136 // Lazy-load plist (~280KB with xmlbuilder+@xmldom) — only hit on
137 // Apple_Terminal with auto-channel, which is a small fraction of users.
138 const plist = await import('plist')
139 const parsed: Record<string, unknown> = plist.parse(defaultsOutput.stdout)
140 const windowSettings = parsed?.['Window Settings'] as
141 | Record<string, unknown>
142 | undefined
143 const profileSettings = windowSettings?.[currentProfile] as
144 | Record<string, unknown>
145 | undefined
146
147 if (!profileSettings) {
148 return false
149 }
150
151 return profileSettings.Bell === false
152 } catch (error) {
153 logError(error)
154 return false
155 }
156}
157

Callers 1

sendAutoFunction · 0.85

Calls 3

execFileNoThrowFunction · 0.85
logErrorFunction · 0.50
parseMethod · 0.45

Tested by

no test coverage detected