Extending sway monitors
For a laptop, assuming the primary screen is always the one it comes with, an easy approach to position screens relatively left and right of the monitor is:
1# Get display names, -p for plain text
2swaymsg -t get_outputs -p | grep Output
3Output eDP-1 'Chimei Innolux Corporation 0x1417 Unknown' (focused)
4Output DP-1 'Lenovo Group Limited M14 V904H2WF'
5# Center the primary display
6swaymsg 'output eDP-1 position 0 0'
Now we can get the current configuration and move the other screen relative to it.
1# -r for json format
2PRIMARY_WIDTH=$(swaymsg -t get_outputs -r | jq '.[] | select(.name | contains("eDP")) | .["current_mode"].["width"]')
3# Left of primary
4swaymsg "output DP-1 position -${PRIMARY_WIDTH} 0"
5# Right of primary
6swaymsg "output DP-1 position ${PRIMARY_WIDTH} 0"
This can be wrapped into a little helper script.
Comments