<commit_before>exec = require('child_process').exec
_ = require 'lodash'
nf = require './necessaryFuncs'

exec('i3-msg -t get_workspaces', (error, stdout, stderr) ->
  wkList = JSON.parse(stdout)
  
  focWkName = nf.getFocusedWK(wkList)

  currentProjName = nf.getProjectFromWKName(focWkName)

  allProjectNames = nf.getListOfProjects(wkList)

  nextProjIndex = allProjectNames.indexOf(currentProjName)

  if nextProjIndex == -1
    return undefined
  if nextProjIndex == (allProjectNames.length-1)
    nextProjIndex = 0
  else
    nextProjIndex += 1

  nxtProjWks = nf.getWKNamesFromProj(wkList, allProjectNames[nextProjIndex])

  visWks = nf.getVisibleWKs(wkList)

  wksToMakeVisible = _.difference(nxtProjWks, visWks)

  parCommToRun = _.map(wksToMakeVisible, (x) -> 'workspace ' + x)
<commit_msg>switchNextProject: switching to the first project even if the current workspace is not on a project<commit_after>exec = require('child_process').exec
_ = require 'lodash'
nf = require './necessaryFuncs'

exec('i3-msg -t get_workspaces', (error, stdout, stderr) ->
  wkList = JSON.parse(stdout)
  
  focWkName = nf.getFocusedWK(wkList)

  allProjectNames = nf.getListOfProjects(wkList)
  
  if allProjectNames.length == 0 || allProjectNames == undefined
    process.exit()

  currentProjName = nf.getProjectFromWKName(focWkName)

  if currentProjName == undefined
    nextProjIndex = 0
  else
    nextProjIndex = allProjectNames.indexOf(currentProjName)

    if nextProjIndex == (allProjectNames.length-1)
      nextProjIndex = 0
    else
      nextProjIndex += 1

  nxtProjWks = nf.getWKNamesFromProj(wkList, allProjectNames[nextProjIndex])

  visWks = nf.getVisibleWKs(wkList)

  wksToMakeVisible = _.difference(nxtProjWks, visWks)

  parCommToRun = _.map(wksToMakeVisible, (x) -> 'workspace ' + x)

{'fraction_non_alphanumeric': 0.105, 'fraction_numerical': 0.006111111111111111, 'mean_word_length': 4.575851393188855, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5707419', 'n_tokens_mistral': 689, 'n_tokens_neox': 642, 'n_words': 120}