In a multiple monitor set-up, is there a way to transfer entire workspaces (as opposed to single applications) to a different monitor?
I3wm: How to move workspaces between monitors
i3multi-monitorwindow-managerworkspaces
Related Solutions
It is (somewhat) possible to emulate this "feature" (For me, the workspace behaviour of i3
is one of the main features, so I do not really recommend to do this unless you really cannot work without workspaces spanning all monitors while still wanting to use i3
).
You can bind multiple commands to shortcuts, so you just can switch workspaces on both monitors at once. For example:
# Default modifier key
set $mod Mod4
# variables for left and right monitor
# (assuming names DP-1 and DP-3 with DP-1 being left of DP-3)
set $monL DP-1
set $monR DP-3
# variables for workpacenames;
set $ws1L 1:A
set $ws1R 11:A
set $ws2L 2:B
set $ws2R 12:B
set $ws3L 3:C
set $ws3R 13:C
# assign workspaces to specific outputs
workspace $ws1L output $monL
workspace $ws1R output $monR
workspace $ws2L output $monL
workspace $ws2R output $monR
workspace $ws3L output $monL
workspace $ws3R output $monR
# do not toggle automatically between the current and previous
# workspace on repeated calls to `workspace NAME` (with identical NAME)
workspace_auto_back_and_forth no
# Toggle between both monitors
# (focus output left wraps from the leftmost to the rightmost output)
bindsym $mod+Tab focus output left
# switch two workspaces at once (the need to be on different outputs)
bindsym $mod+1 workspace $ws1L, workspace $ws1R
bindsym $mod+2 workspace $ws2L, workspace $ws2R
bindsym $mod+3 workspace $ws3L, workspace $ws3R
# move a window to a specific workpace;
# $mod+Shift for left side, $mod+Control for right side
bindsym $mod+Shift+1 move workspace $ws1L
bindsym $mod+Control+1 move workspace $ws1R
bindsym $mod+Shift+2 move workspace $ws2L
bindsym $mod+Control+2 move workspace $ws2R
bindsym $mod+Shift+3 move workspace $ws3L
bindsym $mod+Control+3 move workspace $ws3R
bar {
# [...]
# Do not show workspace numbers (optional)
strip_workspace_numbers yes
}
This uses variables to keep the workspace and output names consistent. The workspace names for the left and right monitor need to be different. In this case I chose to use different numbers because they can be hidden, if so desired. Whith these settings Super+1 will switch to workspace 1:A
on the left monitor and 11:A
on the right monitor. workspace_auto_back_and_forth
should be disabled to avoid possibly confusing and undesired behavior.
Caveats:
- This works only for the keyboard shortcuts, if you click on a workspace button on the i3bar, only the workspace on one monitor will change and not its companion.
- Any command that focuses a window on a currently not visible workspace (
[criteria] focus
) will only focus that workspace without the one on the other output - When switching two workspaces with one binding, the second workspace will always be the focused one (in the above example the right one).
- Focusing and movement across display borders may require different commands/keybindings in some cases. (While this is also the case with non-synchronized workspaces, it may be more noticeable/disrupting when expecting one big workspace)
Some if not all of the caveats could probably be solved by utilizing the IPC interface, for example to automatically switch to the companion workspace, too.
Personally, I would suggest to at least adopt a hybrid approach: Use synchronized workspaces where you absolutely need them for your workflow, but use the default (for i3
) single display approach anywhere else. Otherwise, if you absolutely need/want synchronized workspaces all the time, it might be that i3
is just not the window manager you are looking for.
i3 does not really support key sequences like vim. Any key binding consists of a single key preceded by an optional list of distinct (so no Shift+Shift
) modifiers. And all of the modifiers need to be pressed down at the time the main key is pressed.
That being said, there are two main ways to have a lot of workspaces without having to bind them to long lists of modifiers:
1. Dynamically create and access workspaces with external programs
You can do not have to define a shortcut for every single workspace, you can just create them on the fly by sending a workspace NEW_WS
to i3, for example with the i3-msg
program:
i3-msg workspace NEW_WS
i3-msg move container to workspace NEW_WS
i3 also comes with the i3-input
command, which opens a small input field then runs a command with the given input as parameter
i3-input -F 'workspace %s' -P 'go to workspace: '
i3-input -F 'move container to workspace %s' -P 'move to workspace: '
Bind these these two commands to shortcuts and you can access an arbitrary number of workspaces by just pressing the shortcut and then entering the name (or number) of the workspace you want. (If you only work with numbered workspaces, you might want to use workspace number %s
instead of just workspace %s
)
2. Statically bind workspaces to simple Shortcuts within key binding modes
Alternatively, for a more static approach, you could use modes in your i3 configuration. You could have separate modes for focusing and moving to workspaces:
set $mode_workspace "goto_ws"
mode $mode_workspace {
bindsym 1 workspace 1; mode "default"
bindsym 2 workspace 2; mode "default"
# […]
bindsym a workspace a; mode "default"
bindsym b workspace b; mode "default"
# […]
bindsym Escape mode "default"
}
bindsym $mod+w mode $mode_workspace
set $mode_move_to_workspace "moveto_ws"
mode $mode_move_to_workspace {
bindsym 1 move container to workspace 1; mode "default"
bindsym 2 move container to workspace 2; mode "default"
# […]
bindsym a move container to workspace a; mode "default"
bindsym b move container to workspace b; mode "default"
# […]
bindsym Escape mode "default"
}
bindsym $mod+shift+w mode $mode_move_to_workspace
Or you could have separate bindings for focusing and moving within a single mode:
set $mode_ws "workspaces"
mode $mode_ws {
bindsym 1 workspace 1; mode "default"
bindsym Shift+1 move container to workspace 1; mode "default"
bindsym 2 workspace 2; mode "default"
bindsym Shift+2 move container to workspace 2; mode "default"
# […]
bindsym a workspace a; mode "default"
bindsym Shift+a move container to workspace a; mode "default"
bindsym b workspace b; mode "default"
bindsym Shift+b move container to workspace b; mode "default"
# […]
bindsym Escape mode "default"
}
bindsym $mod+shift+w mode $mode_move_to_workspace
In both examples the workspace
or move
commands are chained with mode "default"
, so that i3 automatically returns back to the default key binding map after each command.
Best Answer
You can define a binding in your i3 config. Note: windows are called "containers", and monitors are called "outputs".
move workspace to output left|right|down|up|current|primary|<output>
Here's what I use in my config:
Strangely, I'd expect the
$mod+Ctrl+greater
to require me to hit Ctrl and Shift at the same time, since you need to press Shift to type<
and>
. However, pressing just mod, Ctrl, and,
works, which is very nice.Note, you can also set a keybinding to send things to a specific monitor by its name.