Skip to content

Instantly share code, notes, and snippets.

@seveibar
Created June 29, 2015 18:13
Show Gist options
  • Save seveibar/a32252deaac9a5bf749b to your computer and use it in GitHub Desktop.
Save seveibar/a32252deaac9a5bf749b to your computer and use it in GitHub Desktop.
i3-rename-workspace
import subprocess
import json
import sys
workspaces = json.loads(subprocess.check_output("i3-msg -t get_workspaces", shell=True));
activeWorkspaceNum = None
activeWorkspaceName = None
for workspace in workspaces:
if workspace["visible"]:
activeWorkspaceNum = workspace['num']
activeWorkspaceName = workspace['name']
if activeWorkspaceName:
cmd = "i3-msg 'rename workspace \"" + activeWorkspaceName + \
"\" to \"" + str(activeWorkspaceNum) + ": " + \
" ".join(sys.argv[1:]) +"\"'"
print cmd
subprocess.check_output(cmd, shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment