2008. május 31.

How to rotate the display?

ATTENTION! THIS POST IS OUTDATED!
The scripts I use now to rotate the display can be copied from this post.

I found a great soultion on this page!

It needs a little alternation, so I'll copy and modify it here.




xorg.conf
Then you need to update the xorg.conf file:
Code:
sudo nano /etc/X11/xorg.conf
Edit the Device section and add:
Code:
Option    "RandRRotation"    "on"
Option     "NvAGP"     "1"
This enables rotation capabilities. The 2nd line is to help suspend work properly.

Rotation
You will need to install wacom-tools:
Code:
sudo apt-get install wacom-tools
You will need a script and map it to a key.
The script:
Code:
#!/bin/sh

# Change System Input orientation for Tablet Mode
# Depends on wacom-tools from repo

orientation=`/usr/bin/xrandr --query | /bin/grep "Current rotation" | /usr/bin/awk '{print $4}'`
if [ "$orientation" = "normal" ]; then
/usr/bin/xrandr -o right
/usr/bin/xsetwacom set stylus Rotate CW
else
/usr/bin/xrandr -o normal
/usr/bin/xsetwacom set stylus Rotate none
fi
Save it as rotate.sh and put into the /usr/bin/ directory.
Code:
sudo cp rotate.sh /usr/bin

The TC4400 has a 'presentation' key next to the volume adjusting keys. We will use it for screen rotation. To map the key, open the Configuration Editor and browse to /apps/metacity/keybindings_commands. Edit command_1 (or the 1st available command) enter: sh /usr/bin/rotate.sh . Then browse to /apps/metacity/global_keybindings and edit the run_command_1 with 0xcd .

(According to this howto, you can map the rotation to the on-screen rotation button too.)

To open Configuration Editor go to System > Preferences > Menu Editor, look under the section for Applications > System and check in Configuration Editor.

Edit:
... later I realized, that if I simply turn the tablet down, the display will be inverted in front of me, so I modified the script to turn the display around in a normal-right-inverted-normal circle.
Here's the code:
#!/bin/sh

# Change System Input orientation for Tablet Mode
# Depends on wacom-tools from repo

orientation=`/usr/bin/xrandr --query | /bin/grep "Current rotation" | /usr/bin/awk '{print $4}'`
if [ "$orientation" = "normal" ]; then
/usr/bin/xrandr -o right
/usr/bin/xsetwacom set stylus Rotate CW
fi
if [ "$orientation" = "right" ]; then
/usr/bin/xrandr -o 2
/usr/bin/xsetwacom set stylus Rotate 3
fi
if [ "$orientation" = "inverted" ]; then
/usr/bin/xrandr -o normal
/usr/bin/xsetwacom set stylus Rotate none
fi
Even later I started to use Nautilus scripts to rotate the display.

Nincsenek megjegyzések: