Ninetynine is a creative design & coding agency

Archive for the ‘Dell’ tag

Quick workaround for missing “switch-display”-key or “lcd/crt”-key

with 6 comments

gnome-keybinding-propertiesWhat a wonderful day it is, sir

It’s been a while since I wrote something, but I liked to share this with you all. I bought a new Dell Studio 1558 and all the fn-keys were working except the one to switch the displays…

I enjoy switching between dual-screen, using only my external 22″ or using only my laptop, when I’m on the road. So I was looking for a workaround.

This laptop, is my first machine with Ubuntu that uses an ATI graphics chip, so this was all quite new to me. But I have to say; I’m very very pleased with it.

Ok, so what do you have to do to get things working?

1. Create the script
Create the script, I called it toggleDisplay.sh and this is how it looks in my case:

#!/bin/bash
# Script to toggle display configuration on Dell Studio 1558
# author: Ruben Verhack
 
config="/tmp/display.conf"
current=`cat $config`
 
# Check if config exists
if [ ! -a $config ]
then
   # Empty file executes default
   touch $config;
fi
 
# Check if CRT2 is connected
if xrandr -q | grep "CRT2 connected"
then
   # Toggle between states
   case "$current" in
   '')
      # default
      xrandr --output LVDS --auto --output CRT2 --left-of LVDS --output CRT2 --auto
      echo "dual" > $config
      ;;
   'dual')
      # was dual, now external only
      xrandr --output LVDS --off --output CRT2 --auto
      echo "external" > $config
      ;;
   'external')
      # was external, now laptop only
      xrandr --output LVDS --auto --output CRT2 --off
      echo "laptop" > $config
      ;;
   'laptop')
      # was laptop, now both
      xrandr --output LVDS --auto --output CRT2 --left-of LVDS --output CRT2 --auto
      echo "dual" > $config
      ;;
   esac
else
   xrandr --output LVDS --auto
fi

This toggles your displays from dual screen to external only to laptop only, and from there to dual screen again. Note that my monitors were called LVDS and CRT2, you can easily check how your monitors are called by executing:

xrandr -q

Read the rest of this entry »

Written by ruben

May 21st, 2010 at 9:53 pm

Posted in Ubuntu

Tagged with , ,