<commit_before>/** Auto-launching the app on session start.
 *
 * @module gui/js/autolaunch
 */

const AutoLaunch = require('auto-launch')

const opts = {
  name: 'Cozy-Desktop',
  isHidden: true
}

if (process.env.APPIMAGE) {
  opts.path = process.env.APPIMAGE
}

const autoLauncher = new AutoLaunch(opts)
<commit_msg>gui/autolaunch: Use app name for entry on Linux (#1759)<commit_after>/** Auto-launching the app on session start.
 *
 * @module gui/js/autolaunch
 */

const AutoLaunch = require('auto-launch')

const APP_NAME = 'Cozy-Desktop'
const opts = {
  name: APP_NAME,
  isHidden: true
}

if (process.env.APPIMAGE) {
  opts.path = process.env.APPIMAGE
}

const autoLauncher = new AutoLaunch(opts)

if (process.env.APPIMAGE) {
  // Fix issue with `auto-launch` that uses the path instead of the app name
  // when defining the autolaunch entry leading to autolaunch to stop working
  // after an app update.
  // See https://github.com/Teamwork/node-auto-launch/issues/92

  // Check if there is an autolaunch entry with the app's path.
  const pathAutoLaunchEnabled = autoLauncher.isEnabled()
  // Remove it to avoid having multiple entries.
  if (pathAutoLaunchEnabled) {
    autoLauncher.disable()
  }
  // Make sure the autolaunch entry will use the app's name.
  autoLauncher.opts.appName = APP_NAME
  // Create an autolaunch entry with the app's name if there was an entry with
  // the app's path.
  if (pathAutoLaunchEnabled) {
    autoLauncher.enable()
  }
}

{'fraction_non_alphanumeric': 0.10772357723577236, 'fraction_numerical': 0.0040650406504065045, 'mean_word_length': 3.5446153846153847, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '7179876', 'n_tokens_mistral': 501, 'n_tokens_neox': 474, 'n_words': 151}