📜 ⬆️ ⬇️

Setting the resolution on an external monitor (openbox)

image
Recently I moved to OpenBox ( CrunchBang distribution).

I have a laptop, at home I connect an external monitor to it.
Immediately I ran into the problem that after booting the system, a low resolution is placed on the monitor and laptop.
Through grandr expose normal resolution. But after a reboot, all the settings flew off, and I had to put everything in a new one.

Solved the problem like this:

I create a script / usr / local / bin / video_switcher with the following content:
#!/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;


where I check if my external monitor is connected.
If it is connected, then I cut off the monitor on the laptop, otherwise there is not.
')
LVDS - laptop monitor.
TMDS-1 - external monitor.

I give the right 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.

Source: https://habr.com/ru/post/80658/


All Articles