disableAudioBellForProfile function

Future<bool> disableAudioBellForProfile(
  1. String profileName
)

Disable audio bell for a Terminal.app profile.

Implementation

Future<bool> disableAudioBellForProfile(String profileName) async {
  var result = await Process.run('/usr/libexec/PlistBuddy', [
    '-c',
    "Add :'Window Settings':'$profileName':Bell bool false",
    getTerminalPlistPath(),
  ]);

  if (result.exitCode != 0) {
    result = await Process.run('/usr/libexec/PlistBuddy', [
      '-c',
      "Set :'Window Settings':'$profileName':Bell false",
      getTerminalPlistPath(),
    ]);
    if (result.exitCode != 0) return false;
  }
  return true;
}