Archivi tag: projector

External monitor/projector with LXDE

A.k.a. “Fn+F8 on my Asus Eee Pc 1215p with Debian testing and lxde doesn’t switch the monitor mode”

Real Programmers ™ set their monitor mode (= screen layout) with the xrandr command; sane people prefer to use keyboard shortcut; here is how this can be achieved on an Eee Pc running Debian. With the wonderful ARandR (sudo apt-get install arandr) create and test and save the monitor modes you like. You’ll end up with some shell scripts in the ~/.screenlayout directory. For instance, I have the file /home/bruno/.screenlayout/extvert.sh containing
bruno@gundam:~$ cat .screenlayout/extvert.sh
#!/bin/sh
xrandr --output LVDS1 --mode 1366x768 --pos 0x1024 --rotate normal --output VGA1 --mode 1280x1024 --pos 0x0 --rotate normal

Executing that script sets the monitor mode to what I refer as “extended vertical”: the thing plugged into the vga is above the laptop screen. I also have the onlylaptop.sh and clone.sh files, which do what their names suggest. Now we need a script to cycle between this modes. This is it

bruno@gundam:~$ cat /mnt/sda6/bruno/shell_scripts/switchmonitor.sh 
#!/bin/sh
file="/tmp/screenlayout"
if [ -f "$file" ]
then
    #echo "$file found."
    LAYOUT=$(cat /tmp/screenlayout)
    if [ $LAYOUT = 0 ]
    then
        /home/bruno/.screenlayout/clone.sh
        echo "1" > $file
    elif [ $LAYOUT = 1 ]
    then
        /home/bruno/.screenlayout/extvert.sh
        echo "2" > $file
    else
        /home/bruno/.screenlayout/onlylaptop.sh
        echo "0" > $file
    fi
else
    #echo "$file not found."
    /home/bruno/.screenlayout/onlylaptop.sh
    echo "0" > $file
fi


It’s a pretty dumb script: it gets the current monitor mode from the /tmp/screenlayout file, it executes one of the arandr made scripts and finally updates the file. The only piece missing now is a way to execute switchmonitor.sh by pressing a shortcut. In my “lxde + openbox environment” one can do this by modifying ~/.config/openbox/lxde-rc.xml . Just scroll to the line and ABOVE IT insert this

    <keybind key="XF86Display">
        <action name="Execute">
            <command>/mnt/sda6/bruno/shell_scripts/switchmonitor.sh
        </action>
    </keybind>


Make this effective giving the command
$ openbox --reconfigure
Now, pressing Fn+F8 the switchimonitor.sh script SHOULD be executed and it SHOULD execute one of the scripts inside the .screenlayout/ directory which SHOULD change your monitor mode.
Good luck :-)

Same stuff as above, Ubuntu style