nibAutoGridLayout is an addon designed to automatically adjust a few Grid Layout settings to match your current situation.
All options can be adjusted in Config.lua
After changing settings, type: /reload ui
BG Layout Size
Automatically set the Battleground Layout size (10, 15, 25, 40 man) to match the battleground you are in.
Especially helpful if you have Grid centered and you don't want your groups appearing off to the sides.
40-man BG width
Set the Width of Grid while in a 40-man battleground.
Grid can grow to be very wide while in a 40-man battleground, so this will allow you to keep Grid at a decent size.
Set Horizontal Groups to be different while in a battleground.
In case you prefer a different group orientation while in a battleground.
Automatically set Grid to show or not to show Pet frames while in a 5-man Party or in an Arena based on whether anyone in the group has a pet.