Take a look at our
ThinkPads.com HOME PAGE
For those who might want to contribute to the blog, start here: Editors Alley Topic
Then contact Bill with a Private Message

X220 Tablet with Linux (Ubuntu) rotation script

X200/X201/X220 (including equivalent tablet models) and X300/X301 Series
Post Reply
Message
Author
aeharding
Posts: 11
Joined: Mon Dec 26, 2011 2:48 am
Location: Portland, Oregon
Contact:

X220 Tablet with Linux (Ubuntu) rotation script

#1 Post by aeharding » Mon May 28, 2012 7:28 pm

Hi everyone! So, I just installed Ubuntu on my new X220 tablet and I wanted to share a little script that I worked on to make rotation work with the computer, because by default when you rotate the screen orientation the pen, eraser and touch inputs do not rotate as well. So, with this simple script, the screen rotates to the left from default upon clicking it (I'm left-handed; figure it out if you're right-handed) and then back to normal from the left. I did some research in creating the script, but I forgot from where...

Anyways! Put this in a file blah.sh anywhere, and do whatever you want with it! I pinned it to the taskbar thingy in Ubuntu:

Code: Select all

#!/bin/sh

# Find the line in "xrandr -q --verbose" output that contains current screen orientation and "strip" out current orientation.

rotation="$(xrandr -q --verbose | grep 'connected' | egrep -o  '\) (normal|left|inverted|right) \(' | egrep -o '(normal|left|inverted|right)')"

# Using current screen orientation proceed to rotate screen and input tools.

case "$rotation" in
    normal)
    # rotate to the left
    xrandr -o left
    xsetwacom set "Wacom ISDv4 E6 Pen stylus" rotate ccw
    xsetwacom set "Wacom ISDv4 E6 Finger touch" rotate ccw
    xsetwacom set "Wacom ISDv4 E6 Pen eraser" rotate ccw
    ;;
    left)
    # rotate to normal
    xrandr -o normal
    xsetwacom set "Wacom ISDv4 E6 Pen stylus" rotate none
    xsetwacom set "Wacom ISDv4 E6 Finger touch" rotate none
    xsetwacom set "Wacom ISDv4 E6 Pen eraser" rotate none
    ;;
esac
Lastly... To pin to the taskbar takes a little skill. Find a icon online that you want (svg works) and follow this guide to pin it to the Unity bar:
http://itshouldbeuseful.wordpress.com/2 ... ntu-11-04/

Good luck! Hope this helped someone... I didn't look to see if something like this had been posted before. If anyone can get it to run when you press the dedicated rotate button, please let me know!

My Unity screenshot: http://lookpic.com/O/i2/956/Zf0xHxN.png
SVG rotate icon: http://www.clker.com/clipart-rotate-ccw-icon.html


EDIT:: Check out this Github installation using this script and some other cool things made by "the undecided":
https://github.com/martin-ueding/think-rotate
Last edited by aeharding on Mon Jun 11, 2012 6:30 pm, edited 1 time in total.
X220 Tablet | Multitouch display | Intel Core i7-2640M Processor | Win7/8/Ubuntu x64 | 256GB Samsung 830 SSD | 8GB DDR3 1333MHz | WiMAX, Bluetooth, Webcam, Fingerprint
T61 | Intel Core 2 Duo 2.4GHz | Widescreen 14.1" | 320GB 7200rpm HDD | 4GB DDR2 |

the undecided
Posts: 11
Joined: Wed May 23, 2012 2:04 am
Location: Bonn, NRW, Germany

Re: X220 Tablet with Linux (Ubuntu) rotation script

#2 Post by the undecided » Thu May 31, 2012 8:00 am

I'll try it when I get my X220 Tablet.

It would be good if you specify a license instead of the ambigious “whatever you want”. I assume you refer to the Expat License (a.k.a. MIT License).

Since your full name is in the screenshot, I'd recomment to put a “Copyright © 2012 yourname <youremail>” into the beginning of the script as well. So in case somebody has a question, they know that it is from you.

the undecided
Posts: 11
Joined: Wed May 23, 2012 2:04 am
Location: Bonn, NRW, Germany

Re: X220 Tablet with Linux (Ubuntu) rotation script

#3 Post by the undecided » Fri Jun 08, 2012 11:45 am

I used your script and enhanced it a little bit. Now you can specify the new orientation as a parameter as well. And I wrote a little manual page for it as well.

The code and everything else is on GitHub

wolfman
Senior Member
Senior Member
Posts: 841
Joined: Sat Jun 19, 2004 8:40 pm
Location: Pine Grove, PA

Re: X220 Tablet with Linux (Ubuntu) rotation script

#4 Post by wolfman » Fri Jun 08, 2012 8:08 pm

Nice, thanks for sharing that and I like your documentation. Well done.
Thinkpad L14 gen 2 | AMD Ryzen 7 Pro 5850u | 64gb RAM | 1tb SK Hynix P31 Gold | Intel AX210
Desktop: AMD Threadripper 1950x | 64gb RAM | 512gb Samsung 970 Pro + 1tb Crucial SSD | Ubuntu 20.04 LTS | Dell S2721DGF
Previous Thinkpads: A21m, R40, X61, T410, T420, W520

aeharding
Posts: 11
Joined: Mon Dec 26, 2011 2:48 am
Location: Portland, Oregon
Contact:

Re: X220 Tablet with Linux (Ubuntu) rotation script

#5 Post by aeharding » Mon Jun 11, 2012 6:27 pm

Glad you like it wolfman. ;)

Thanks "the undecided"! That implementation rocks and is sure to make it easier to find. :)

I am not going to take credit in copyright because I modified it to the Thinkpad x tablet series (specifically my x220) from some long lost source for some older/different brand touchscreen device.

Also... everyone should see this source for adding the script to physical key execution on the 'tablet rotate' button:
http://forum.thinkpads.com/viewtopic.ph ... 10#p676410
X220 Tablet | Multitouch display | Intel Core i7-2640M Processor | Win7/8/Ubuntu x64 | 256GB Samsung 830 SSD | 8GB DDR3 1333MHz | WiMAX, Bluetooth, Webcam, Fingerprint
T61 | Intel Core 2 Duo 2.4GHz | Widescreen 14.1" | 320GB 7200rpm HDD | 4GB DDR2 |

Post Reply
  • Similar Topics
    Replies
    Views
    Last post

Return to “ThinkPad X200/X201/X220 and X300/X301 Series”

Who is online

Users browsing this forum: No registered users and 52 guests