diff --git a/bin/i3-companion b/bin/i3-companion index 2a7e48e..26c0ad1 100755 --- a/bin/i3-companion +++ b/bin/i3-companion @@ -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): diff --git a/config b/config index 8e01034..64245df 100644 --- a/config +++ b/config @@ -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