Some games and other full screen applications are not locking my mouse to one screen (like fallout 4 for me). So i wrote a little binding mode to fix this. The idea is to set my right screen diagonal to my left screen. so the mouse cannot get to it. After playing i can go back to my default setting easily.
This way we are locking the mouse to to the screen and thus also to the workspaces on the screen.
If you want to use this mode for yourself, keep in mind that you have to enter your screen, resolution, and orientation manually (you can find more information about this in the wiki).
The binding mode must be added to the sway configuration file.
#isolate screens
set $mode_screeniso (i)solate screens, (d)efault
mode "$mode_screeniso" {
bindsym i exec --no-startup-id output HDMI-A-1 pos 0 0 res 1920x1080 , output HDMI-A-2 transform 270 pos 1920 9999 res 2560x1440 , mode "default"
bindsym d exec --no-startup-id output HDMI-A-1 pos 0 330 res 1920x1080 , output HDMI-A-2 transform 270 pos 1920 0 res 2560x1440 , mode "default"
# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+n mode "$mode_screeniso"