The i3 FAQ has migrated to All content here is read-only.
Ask Your Question

insert new workspace

asked 2013-09-26 21:31:42 +0000

urban gravatar image

Hi all, I'm a new i3 user. I switched from fluxbox a couple of weeks ago and I'm really happy with i3!

My question: Is it possible to insert a new workspace between existing workspaces? Say I have stuff on workspaces 1, 2, 3 and 4. For some reason I'd like to push some window from workspace 2 to the workspace next to it, i.e. to workspace 3. However, I don't want my new window to be on workspace 3 mixed with all the other junk I had there. Rather I want my new window to be on a clean workspace 3, and the old workspaces 3 and 4 to be renumbered to 4 and 5.


edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-09-27 20:29:35 +0000

urban gravatar image

updated 2013-12-08 22:53:14 +0000

Ok! I'll give it a try and post here once I've sort of got it.

Update! (Dec 8 2013)

Hi again, today I looked into this and wrote the following code using i3-py. It does what I want, but I'm sure it can be done simpler. I haven't used python before why I am appreciating any comments for improving that.

import imp

# get current workspace no
workspaces = i3.get_workspaces()
for workspace in workspaces:
    if (workspace['visible']):

# next workspace no

# get focused windows

# loop over all workspaces with higher number than the current one if
# nextno has windows
if exists
    for workspace in reversed(workspaces):
        if (workspace['num']>currentno):

# move focused windows to next workspace
for window in focused:

# go to next (optional)
edit flag offensive delete link more

answered 2013-09-27 06:15:47 +0000

Michael gravatar image

You can do that using the IPC interface, for example with this sequence of commands:

i3-msg workspace 4
i3-msg rename workspace to 5
i3-msg workspace 3
i3-msg rename workspace to 4
i3-msg workspace 3

Of course you should add some sanity checking and edge case handling, this is only to give you a rough idea.

edit flag offensive delete link more

Question Tools


Asked: 2013-09-26 21:31:42 +0000

Seen: 550 times

Last updated: Dec 08 '13