Back to Home

Setting the resolution on an external monitor (openbox)

linux · openbox · grandr · CrunchBang · screen resolution

Setting the resolution on an external monitor (openbox)

    image
    Recently, he moved to OpenBox ( CrunchBang distribution ).

    I have a laptop, at home I connect an external monitor to it.
    Immediately I ran into a problem that after loading the system, a low resolution is set on the monitor and laptop.
    Through grandr I set the normal resolution. But after a reboot, all the settings flew, and I had to set everything up again.

    I solved the problem like this: I

    create the script / usr / local / bin / video_switcher with the following content: where I check if my external monitor is connected. If connected, I chop off the monitor on the laptop, otherwise not. LVDS - laptop monitor. TMDS-1 is an external monitor.
    #!/bin/bash

    VGASTAT=`xrandr | grep "TMDS-1 connected"`;

    if [ "$VGASTAT" = "" ] ; then
    xrandr --output LVDS --auto;
    else
    xrandr --output LVDS --off;
    xrandr --output TMDS-1 --mode 1440x900;
    fi
    exit 0;








    I give permission to run:
    # chmod +x /usr/local/bin/video_switcher

    and in ~ / .config / openbox / autostart.sh I add my script:
    echo "video_switcher" >> ~/.config/openbox/autostart.sh

    That's how it works for me. Waiting for your comments.

    Read Next