i3: add a binding to move all workspaces to the next output

This commit is contained in:
Vincent Bernat 2023-07-01 17:04:29 +02:00
parent 20c2e3789f
commit e501d8e769
2 changed files with 20 additions and 0 deletions

View file

@ -436,6 +436,25 @@ async def new_workspace(i3, event):
await current.command(f"move container to workspace " f'number "{num}"')
@on(CommandEvent("move-all-workspaces-to-next-output"))
async def move_all_workspaces_to_next_output(i3, event):
"""Move all workspaces from the current output to the next one."""
outputs = await i3.get_outputs()
if len(outputs) < 2:
return
workspaces = await i3.get_workspaces()
try:
focused = [w for w in workspaces if w.focused][0]
except IndexError:
return
output = focused.output
for workspace in workspaces:
if workspace.output == output:
await i3.command(
f"workspace number {workspace.num} ; move workspace to output next"
)
@on(I3Event.WORKSPACE_INIT)
@static(lock=asyncio.Lock())
async def workspace_rename_duplicate(i3, event):

1
config
View file

@ -132,6 +132,7 @@ bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
bindsym $mod+Shift+o move workspace to output next
bindsym $mod+Ctrl+Shift+o nop "move-all-workspaces-to-next-output"
bindsym $mod+Shift+n nop "move-to-new-workspace"
# lock screen