<commit_before>import manifest from '../../../../package.json';
import filePaths from '../../utils/file-paths';
import appleScript from 'applescript';

import BaseAutoLauncher from './base';

class DarwinAutoLauncher extends BaseAutoLauncher {

  enable(hidden = false, callback) {
    const props = {
      path: filePaths.getAppDir(),
      name: manifest.productName,
      hidden: hidden
    };

    const cmd = [
      'tell application "System Events" to',
      'make login item at end with properties',
      JSON.stringify(props).replace(/"(\w+)":/g, '$1:')
    ].join(' ');

    this.disable(function() {
      // ignored err
      log('making system login item with cmd', cmd);
      appleScript.execString(cmd, callback);
    });
  }

  disable(callback) {
    const name = '"' + manifest.productName + '"';
    const cmd = [
      'tell application "System Events" to',
      'delete login item',<commit_msg>Typo in auto-launcher impl-darwin<commit_after>import manifest from '../../../../package.json';
import filePaths from '../../utils/file-paths';
import appleScript from 'applescript';

import BaseAutoLauncher from './base';

class DarwinAutoLauncher extends BaseAutoLauncher {

  enable(hidden = false, callback) {
    const props = {
      path: filePaths.getAppDir(),
      name: manifest.productName,
      hidden: hidden
    };

    const cmd = [
      'tell application "System Events" to',
      'make login item at end with properties',
      JSON.stringify(props).replace(/"(\w+)":/g, '$1:')
    ].join(' ');

    this.disable(function() {
      // ignore err
      log('making system login item with cmd', cmd);
      appleScript.execString(cmd, callback);
    });
  }

  disable(callback) {
    const name = '"' + manifest.productName + '"';
    const cmd = [
      'tell application "System Events" to',
      'delete login item',
{'fraction_non_alphanumeric': 0.15153143471252015, 'fraction_numerical': 0.0010746910263299302, 'mean_word_length': 2.831275720164609, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2273929', 'n_tokens_mistral': 538, 'n_tokens_neox': 528, 'n_words': 150}