<commit_before>var exec = require('child_process').exec;
var enabled = false;

module.exports = {
    /**
     * Activates the package.
     */
    activate: function(state) {
        atom.commands.add('atom-workspace', 'gtk-dark-theme:enable', this.enable);
        atom.commands.add('atom-workspace', 'gtk-dark-theme:disable', this.disable);

        // Automatically enable dark theme if it was enabled last time we ran.
        if (state.enabled) {
            this.enable();
        }
    },

    /**
     * Returns the current state of the package.
     *
     * @return [Object]
     */
    serialize: function() {
        return {
            enabled: enabled
        };
    },

    /**
     * Enables the GTK dark theme.
     */
    enable: function() {
        console.log('Setting GTK theme variant to "dark".');
        setAtomGtkTheme('dark').then(function () {
            enabled = true;
        });
    },

    /**
     * Disables the GTK dark theme.
     */
    disable: function() {
        console.log('Setting GTK theme variant to "light".');
        setAtomGtkTheme('light').then(function () {
            enabled = false;
        });
    }
};


/**
 * Gets the PIDs of all running Atom processes.
 *
 * @return Promise
 */
function getAtomProcessIds() {
    return new Promise(function(resolve, reject) {
        exec('pidof atom', function(error, stdout, stderr) {
            if (error) {
                return reject(error);
            }

            // Get all PIDs for Atom processes.
            var pids = stdout.trim().split(' ').map(parseFloat);
            resolve(pids);
        });
    });
}

/**
 * Gets the handle IDs of all currently open Atom windows.
 *
 * @return Promise
 */
function getAtomWindowHandles() {<commit_msg>Switch to config to store enabled state<commit_after>var exec = require('child_process').exec;

module.exports = {
    config: {
        enabled: {
            type: 'boolean',
            default: true
        }
    },

    /**
     * Activates the package.
     */
    activate: function() {
        atom.commands.add('atom-workspace', 'gtk-dark-theme:enable', this.enable);
        atom.commands.add('atom-workspace', 'gtk-dark-theme:disable', this.disable);

        // Automatically enable dark theme if it was enabled last time we ran.
        if (atom.config.get('gtk-dark-theme.enabled')) {
            this.enable();
        }
    },

    /**
     * Enables the GTK dark theme.
     */
    enable: function() {
        console.log('Setting GTK theme variant to "dark".');
        setAtomGtkTheme('dark').then(function () {
            atom.config.set('gtk-dark-theme.enabled', true);
        });
    },

    /**
     * Disables the GTK dark theme.
     */
    disable: function() {
        console.log('Setting GTK theme variant to "light".');
        setAtomGtkTheme('light').then(function () {
            atom.config.set('gtk-dark-theme.enabled', false);
        });
    }
};


/**
 * Gets the PIDs of all running Atom processes.
 *
 * @return Promise
 */
function getAtomProcessIds() {
    return new Promise(function(resolve, reject) {
        exec('pidof atom', function(error, stdout, stderr) {
            if (error) {
                return reject(error);
            }

            // Get all PIDs for Atom processes.
            var pids = stdout.trim().split(' ').map(parseFloat);
            resolve(pids);
        });
    });
}

/**
 * Gets the handle IDs of all currently open Atom windows.
 *
 * @return Promise
 */
function getAtomWindowHandles() {
{'fraction_non_alphanumeric': 0.1396663839411931, 'fraction_numerical': 0.0, 'mean_word_length': 1.9557226399331662, 'pattern_counts': {'":': 0, '<': 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': '3909856', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1012, 'n_words': 253}