Tweeking KDE4

From Klaus' wiki
Jump to: navigation, search

KDE is a fine desktop and suits generally my needs. But sometimes it need a bit of tweeking before it is complete.

External monitor on a laptop

Using KDE (and probably also Gnome, which I do not use) on a laptop is sometimes a cumbersome experience. When connecting an external monitor to the laptop the default behaviour for KDE is to show the desktop on the two monitors with one left of the other or above or beneath moving the taskbar to the externally connected monitor. This is fine in some situations, but not always. I prefer to switch of the laptop monitor and only work on the external monitor. To automate this task I dropped this file in ~/.kde/env/monitorsetup.sh (note the extension .sh). The file contains a setup of the monitor environment that I want.

#!/bin/bash
##
## Inspired from the Internet and modified to suit by KK in August 2011
##
 
MONITOR=`xrandr -q|grep "VGA1 connected"`
 
if [ -n "${MONITOR}" ]
then
  # An external monitor is connected
  xrandr --output "LVDS1" --off;
  xrandr --output "VGA1" --pos 0x0 --mode 1920x1080 --refresh 60 --primary;
else
  xrandr --output LVDS1 --auto --primary;
  xrandr --output VGA1 --off;
fi

The reason for placing the file in .kde/env is that KDE runs what ever it finds in this particular directory is executed before loading KDE it self ensuring that the environment is in place when KDE starts.

(Source: [1] and [2])

Connecting a projector

Next problem is to find out how to handle a projector connected to the VGA socket.