Ubuntu Notes and How-Tos

Wednesday, August 17, 2005

Constraining the stylus to a specific monitor in a dual-headed setup

The setup:
- Notebook (1280x768 res)
- 20" CRT monitor (1024x768 res)
- Xinerama enabled

Xinerama allows you to have an uncluttered view of the second monitor (uncluttered being that there's no top and bottom panels). Therefore, it is extremely convenient to use the extended monitor exclusively for GIMP or Inkscape occupying the whole screen.

Now my problem was that since Xinerama stretches/extends the desktop all the way to the next monitor, my tablet's (a Wacom Graphire) resolution becomes very skewed. In this setup, I'd be editing graphics using only 1/3 of the tablet! Now, wouldn't it be nice if I could have the whole tablet space exclusively for the entire single screen/monitor. I'm much faster anyway using the shortcut keys for the tools and such --especially with Inkscape.

So it turns out (after a couple of hours or so of Googling) that it is indeed possible. In fact, it only needed a single line of code. Here's the whole config file:

/etc/X11/xorg.conf:

Section "Files"
FontPath "unix/:7100" # local font server
# if the local font server has problems, we can fall back on these
FontPath "/usr/lib/X11/fonts/misc"
FontPath "/usr/lib/X11/fonts/cyrillic"
FontPath "/usr/lib/X11/fonts/100dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/75dpi/:unscaled"
FontPath "/usr/lib/X11/fonts/Type1"
FontPath "/usr/lib/X11/fonts/CID"
FontPath "/usr/lib/X11/fonts/100dpi"
FontPath "/usr/lib/X11/fonts/75dpi"
# paths to defoma fonts
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/TrueType"
FontPath "/var/lib/defoma/x-ttcidfont-conf.d/dirs/CID"
EndSection
Section "Module"
Load "bitmap"
Load "dbe"
Load "ddc"
Load "dri"
Load "extmod"
Load "freetype"
Load "glx"
Load "int10"
Load "record"
Load "type1"
Load "vbe"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "pc105"
Option "XkbLayout" "fi"
EndSection
Section "InputDevice"
Identifier "Configured Mouse"
Driver "mouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Emulate3Buttons" "true"
Option "ZAxisMapping" "4 5"
EndSection
Section "InputDevice"
Identifier "Synaptics Touchpad"
Driver "synaptics"
Option "SendCoreEvents" "true"
Option "Device" "/dev/psaux"
Option "Protocol" "auto-dev"
Option "HorizScrollDelta" "0"
Option "SHMConfig" "true"
Option "MaxTapTime" "0"
EndSection
# WACOM GRAPHIRE
Section "InputDevice"
Driver "wacom"
Identifier "cursor"
Option "Device" "/dev/input/event2"
Option "Type" "cursor"
Option "Mode" "Relative"
Option "USB" "on"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "stylus"
Option "Device" "/dev/input/event2"
Option "Type" "stylus"
Option "USB" "on"
Option "Mode" "Absolute"
Option "ScreenNo" "1"
EndSection
Section "InputDevice"
Driver "wacom"
Identifier "eraser"
Option "Device" "/dev/input/event2"
Option "Type" "eraser"
Option "USB" "on"
Option "Mode" "Absolute"
EndSection
#
# VGA PORTS
#
Section "Device"
Identifier "Intel Head 1"
Driver "i810"
BusID "PCI:0:2:0"
Option "XaaNoOffscreenPixmaps"
Option "MonitorLayout" "CRT,LFP"
Screen 0
EndSection
Section "Device"
Identifier "ExternalPort"
Driver "i810"
BusID "PCI:0:2:0"
Option "XaaNoOffscreenPixmaps"
Screen 1
EndSection
Section "Monitor"
Identifier "LCD"
Option "DPMS"
HorizSync 28-49
VertRefresh 43-72
Modeline "1280x768" 80.14 1280 1344 1480 1680 768 769 772 795
EndSection
Section "Monitor"
Identifier "CRT"
Option "DPMS"
HorizSync 27-79
VertRefresh 55-90
Modeline "1280x1024" 110 1280 1328 1512 1712 1024 1025 1028 1054
EndSection

Section "Screen"
Identifier "Default Screen"
Device "Intel Head 1"
Monitor "LCD"
DefaultDepth 16
SubSection "Display"
Depth 16
Modes "1280x768"
EndSubSection
EndSection
Section "Screen"
Identifier "Second Screen"
Device "ExternalPort"
Monitor "CRT"
DefaultDepth 16

SubSection "Display"
Depth 16
Modes "1024x768"
EndSubSection
EndSection
Section "ServerLayout"
Identifier "DefLayout"
Screen "Default Screen"
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
EndSection

Section "ServerLayout"
Identifier "DualHead"
Screen 0 "Default Screen" LeftOf "Second Screen"
Screen 1 "Second Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Configured Mouse"
InputDevice "Synaptics Touchpad"
Option "Xinerama" "false"
EndSection

Section "ServerLayout"
Identifier "DualHeadTablet"
Screen 0 "Default Screen" LeftOf "Second Screen"
Screen 1 "Second Screen" 0 0
InputDevice "Generic Keyboard"
InputDevice "Synaptics Touchpad"
InputDevice "Configured Mouse"
InputDevice "cursor" "SendCoreEvents"
InputDevice "stylus" "SendCoreEvents"
InputDevice "eraser" "SendCoreEvents"
Option "Xinerama" "On"
EndSection

Section "DRI"
Mode 0666
EndSection


I didn't want to include the eraser though coz it's fast and convenient to point and click using a big point so I didn't include it in the config.

Notice that I got three different ServerLayouts. My default is mobile mode (which is the main reason I bought this notebook so that I could take it with me to school, library, or wherever). When I'm at home, I use the DualHead mode so that I could use the extra monitor. But I purposefully disabled the Xinerama because I like to have two distinct desktops (with their own panels, etc) each running different tasks --say browsing in monitor 1 and terminals, IDE's, etc, in monitor 2. In that way, the cognitive demarcation is clear.

For those not so frequent times where I use the graphics softwares, then I use the DualHeadTablet mode. I just 1) 'sudo killall gdm', 2) relogin, then 3) 'startx -- -layout DualHeadTablet'. That's all there is to it. This whole FOSS/GNU/Linux thing rocks!

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home