Does anyone know a way to change the default 80 columns width when starting screen in 'detached' mode (screen -dm) ?

Smart curses apps like htop handle resizing when attaching from a wide terminal later on, but for dumb scripts like this it's too late :

echo "Scanning packages:"    
COLUMNS=132 dpkg -l | tr '\n' '\r'    
echo ""
echo "Done"

Direct screen session (from a wide term) works fine :

$ screen bash -c './myscript ; exec bash'
Scanning packages:
ii  zlib1g-dev:i386             1:1.2.8.dfsg-1ubun i386               compression library - developmentom shell scripts (common f

But in 'detached' mode 80 columns width messes up everything :

$ screen -dm  bash -c './myscript ; exec bash'
$ screen -r
    2.10.1-1ubuntu1    all                X Keyboardii  xloadimage                  4.1-22             i386               Graphics fii  xml-core                    
     0.13+nmu2          all                XML infrasii  xorg                        1:7.7+1ubuntu8     i386               X.Org X Wiii  xorg-docs-core              
      1:1.7-1            all                Core documii  xorg-sgml-doctools          1:1.11-1           all                Common tooii  xserver-common              
       2:1.15.1-0ubuntu2. all                common filii  xserver-xephyr              2:1.15.1-0ubuntu2. i386               nested X sii  xserver-xorg                
        1:7.7+1ubuntu8     i386               X.Org X seii  xserver-xorg-core           2:1.15.1-0ubuntu2. i386               Xorg X serii  xserver-xorg-input-all      

Looks like neither stty, width command or COLUMNS env variable is going to do it here, really need a way to start with a wider term ...

  • Does setting focusminsize in your screenrc help? – jofel Jan 8 '16 at 11:41
  • hmm, no luck with focusminsize so far ... – lemonsqueeze Jan 9 '16 at 0:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.