Detected terminal width always smaller when first opening terminal compared to opening new tmux tabs

I have a few ‘cosmetic’ lines in my .bashrc file, which rely on detecting the current width (i.e. number of columns) on the terminal in order to work properly.

E.g., this one prints a nice ‘banner’ at the top of each terminal window, and relies on detecting the current terminal width in order to ‘center’ the banner properly:

### Custom Greeting with colorful banner ###
GREETING="$(date)"; GREETINGLENGTH="$(( ${#GREETING} + 8 ))"; STARTCOL=$(( ($COLUMNS - $GREETINGLENGTH) / 2 ))
echo && printf " %.0s" $(seq $STARTCOL); printf "e[1me[94m"; printf "*%.0s" $(seq $GREETINGLENGTH) ; printf "e[0m"
echo && printf " %.0s" $(seq $STARTCOL); printf "e[1me[94m"; printf "*** e[92m$GREETINGe[94m ***"; printf "e[0m"
echo && printf " %.0s" $(seq $STARTCOL); printf "e[1me[94m"; printf "*%.0s" $(seq $GREETINGLENGTH) ; printf "e[0m"
echo

I also tend to use a tmux wrapper (byobu), and have configured my terminal of choice (guake) to launch byobu automatically.

The problem I have is that, whenever I open a ‘fresh’ terminal / session (e.g. opening a new “guake” tab using Ctrl+Shift+T) the banner appears significantly to the left, as if the terminal width at the time of running .bashrc for the first time was very small. This happens whether I have byobu auto-enabled in that guake tab or not.

However, from that point on, when I open a new “byobu” tab (or ‘windows’ as tmux prefers to call it), the banners in all new byobu tabs from that point on appear properly centred.

Any idea why this happens and how I can address this problem? I.e. how can I get something to appear centred even in a ‘fresh’ terminal session?