<commit_before>'use strict';

var shell = require('shelljs');
var log4js = require('log4js');

var logger = log4js.getLogger('wallpaper');

var methods = [
  {
    // GNOME
    command: 'gsettings',
    options: 'set org.gnome.desktop.background picture-uri file://%s'
  }, {
    // GNOME2
    command: 'gconftool-2',
    options: '--set /desktop/gnome/background/picture_filename --type string %s'
  }, {
    // xfce
    command: 'xfconf-query',
    options: '-c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s %s'
  }, {
    // KDE
    command: 'dcop',
    options: 'kdesktop KBackgroundIface setWallpaper %s 1'
  }, {
    command: 'dconf',
    options: 'write /org/mate/desktop/background/picture-filename "%s"'
  }, {
    command: 'feh',
    options: '--bg-scale %s'
  }, {
    command: 'pcmanfm',
    options: '-w %s'
  }
];

exports.set = function (options, callback) {
  var found = false;
  methods.forEach(function (m) {
    if (found) {
      return;
    }
    var file = options.file;
    var commandline = m.command + ' ' + m.options.replace('%s', file);
    shell.exec(commandline, { async: false }, function (code, output) {
      if (code == 0 && typeof callback != 'undefined') {
        found = true;
        callback(true);
      }<commit_msg>I don't want to see a bunch of error messages on linux.<commit_after>'use strict';

var shell = require('shelljs');
var log4js = require('log4js');

var logger = log4js.getLogger('wallpaper');

var methods = [
  {
    // GNOME
    command: 'gsettings',
    options: 'set org.gnome.desktop.background picture-uri file://%s'
  }, {
    // GNOME2
    command: 'gconftool-2',
    options: '--set /desktop/gnome/background/picture_filename --type string %s'
  }, {
    // xfce
    command: 'xfconf-query',
    options: '-c xfce4-desktop -p /backdrop/screen0/monitor0/image-path -s %s'
  }, {
    // KDE
    command: 'dcop',
    options: 'kdesktop KBackgroundIface setWallpaper %s 1'
  }, {
    command: 'dconf',
    options: 'write /org/mate/desktop/background/picture-filename "%s"'
  }, {
    command: 'feh',
    options: '--bg-scale %s'
  }, {
    command: 'pcmanfm',
    options: '-w %s'
  }
];

exports.set = function (options, callback) {
  var found = false;
  methods.forEach(function (m) {
    if (found) {
      return;
    }
    var file = options.file;
    var commandline = m.command + ' ' + m.options.replace('%s', file);
    logger.info('try: ' + commandline);
    shell.exec(commandline, { async: false, silent: true }, function (code, output) {
      if (code == 0 && typeof callback != 'undefined') {
        found = true;
        callback(true);
      }
{'fraction_non_alphanumeric': 0.16755117513267628, 'fraction_numerical': 0.0075815011372251705, 'mean_word_length': 2.696078431372549, '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': '1167019', 'n_tokens_mistral': 926, 'n_tokens_neox': 898, 'n_words': 215}