i3-project-focus-workflow
Version:
Set of scripts to navigate i3-wm in a multi-monitor setup
32 lines (20 loc) • 725 B
text/coffeescript
exec = require('child_process').exec
_ = require('lodash')
nf = require './necessaryFuncs.coffee'
exec('i3-msg -t get_workspaces', (error, stdout, stderr) ->
wkList = JSON.parse(stdout)
allWKNames = nf.getWKNames(wkList)
currentWK = nf.getFocusedWK(wkList)
currentProj = nf.getProjectFromWKName(currentWK)
if currentProj == undefined
return undefined
currentProjWKs = nf.getWKNamesFromProj(wkList, currentProj)
thisWKPos = currentProjWKs.indexOf(currentWK)
if thisWKPos == -1
return undefined
newWKPos = thisWKPos + 1
if newWKPos == currentProjWKs.length
newWKPos = 0
commandToRun = 'i3-msg "move container to workspace ' + currentProjWKs[newWKPos] + '"'
exec commandToRun
)