Getting Started¶
Installation¶
The easiest way to install thinkpad-scripts on Ubuntu, Arch Linux, Fedora and openSUSE is with your package manager, as described in From Package. If you are on another distribution, then you can build and install it manually using the instructions in Build Manually.
From Package¶
Ubuntu¶
On Ubuntu and its derivatives, you can install from Martin’s PPA:
$ sudo -s
# add-apt-repository ppa:martin-ueding/stable
# apt-get update
# apt-get install thinkpad-scripts
Fedora¶
I, Martin Ueding, just (2015-01-24) tried out to package this for Fedora using the Open Build Service.
As far as I have understood and tested this, you have to download
home:martinueding.repo
into /etc/yum.repos.d/
. Then you can use yum
to install thinkpad-scripts.
$ sudo -s
# wget http://download.opensuse.org/repositories/home:/martinueding/Fedora_21/home:martinueding.repo -O /etc/yum.repos.d/home:martinueding.repo
# yum install thinkpad-scripts
Warning
I only have a Fedora 21 VM right now, so I could only test it there. The
virtual screen of the virtual machine could not be rotated, so I got an error
message by xrandr
. It seems like it would work on a real machine. I would
be very grateful if somebody could test this and tell me about it.
openSUSE¶
Same as Fedora, I tried to create an RPM package for openSUSE with the Open Build Service. There is a repository on my home project. Feedback is greatly appreciated.
Build Manually¶
First install all the dependencies, listed in Dependencies. Then, you can build and install with:
$ make
# make install
# ./setup.py install
To make the ACPI hooks take effect, you will need to restart acpid
with the
following on SysVinit/Upstart systems:
# service acpid restart
or on systemd systems:
# systemctl restart acpid
Packagers will also need to add the following line, run as root, to their post
installation hook to update the udev hardware database with the information in
90-X2x0T-keyboard.hwdb
:
# udevadm hwdb --update
Alternatively, you can use make full-install
which does that restarting for
you. However, this does not work when DESTDIR
is set to something! For a
direct installation, use make full-install
, for packaging, just use
make install
.
Dependencies¶
These dependencies refer to Debian and Arch Linux packages, but should have
similar names in other distributions. yum
in Fedora and zypper
in
openSUSE have a search for “provides”. In openSUSE, you could use the cnf
tool to find out the package.
Build¶
These programs are needed during the build process.
Needed Program | Debian package | Arch Linux package | Fedora package | openSUSE package |
---|---|---|---|---|
msgfmt | gettext | gettext | gettext | gettext |
python3 | python3 | python | python3-devel | python3-devel |
setuptools | python3-setuptools | python-setuptools | python3-setuptools | python3-setuptools |
sphinx-build | python3-sphinx | python-sphinx | python3-sphinx | python3-Sphinx |
xgettext | gettext | gettext | gettext | gettext |
Run¶
These programs are required for the execution of the scripts.
Needed Program | Debian package | Arch Linux package | Fedora package | openSUSE package | Version |
---|---|---|---|---|---|
acpid | acpid | acpid | acpid | acpid | |
amixer | alsa-utils | alsa-utils | alsa-utils | alsa-utils | |
linux | >= 3.11.0-17 [1] | ||||
python3 | python3 | python | |||
setuptools | python3-setuptools | python-setuptools | python3-setuptools | python3-setuptools | |
udev | udev | systemd | systemd | >= 196 | |
xinput | xinput | xorg-xinput | xinput | xinput | |
xrandr | x11-xserver-utils | xorg-xrandr | xorg-x11-server-utils | xrandr |
[1] | The Ubuntu Kernel with version openSUSE and other distributions are not patching the 3.?.0 kernel, but ship a 3.?.? kernel. So users of distributions other than Ubuntu (maybe even Debian) would have to check whether their kernel has the acpi patch. |
Optional¶
These programs enhance the functionality of the scripts, but are not strictly required.
Needed Program | Debian package | Arch Linux package | For |
---|---|---|---|
gsettings | libglib2.0-bin | glib2 | subpixel anti-alias order with GNOME/XFCE |
kvkbd | kvkbd | kvkbd | virtual keyboard |
lsusb | usbutils | usbutils | docking detection with a USB device |
nmcli | network-manager | networkmanager | changing wifi |
pactl | pulseaudio-utils | libpulse | volume control when docking |
xbacklight | xbacklight | xorg-xbacklight | adjusting brightness |
xsetwacom | xserver-xorg-input-wacom | xf86-input-wacom | Wacom device rotation |
Setup¶
thinkpad-scripts includes files that hook into various hardware events:
- a udeb hwdb file that allows proper operation of the bezel buttons on ThinkPad X220 and X230 Tablet computers
- udev rules to automatically run thinkpad-dock when docking and undocking
- ACPI hooks to automatically call thinkpad-rotate when the screen is rotated/unrotated
All of these files should be installed as part of the installation process. If acpid is not enabled by default on your computer (which is the case for Arch Linux), you need to enable and start it for the ACPI hooks to work. Additionally, after installing thinkpad-scripts, you may need to restart udev and acpid for the new rules and hooks to take effect.
Usage¶
After following the configuration instructions above, you generally will not need to call any of the scripts manually. However, in case you do, this is a synopsis of each command:
thinkpad-dock [on|off]
thinkpad-mutemic
thinkpad-rotate [direction]
thinkpad-touch [on|off]
thinkpad-touchpad
See the Manual Pages for more details.
Configuration¶
You can modify the default configuration for things such as the screen
brightness to set when docking, the relative positions of displays, and the
direction of screen rotation by placing configuration scripts in
$HOME/.config/thinkpad-scripts
. See the Manual Pages for
more details.
You may need to modify some of the parameters depending on your hardware. See Hardware-Specific Configuration for more details.
You can also add scripts that will be called before/after docking or rotating the display. See the man pages for thinkpad-dock and thinkpad-rotate for more details.
Tips¶
thinkpad-scripts fixes the bezel buttons so that they work, but it does not bind
anything to them by default. If you’d like, you can bind the thinkpad-rotate
script (or any other program for that matter) to one of the bezel buttons using
your desktop environment. For example, under GNOME, go to “Settings” →
“Keyboard” → “Shortcuts” → “Custom Shortcuts” and add a new “shortcut”.
thinkpad-scripts includes a script, thinkpad-touch
, to make it easy to toggle the
touchscreen of the X220 Tablet on/off. If you want to disable your touch screen
on startup, use your desktop environment to call thinkpad-touch off
when
starting.
Under KDE, it is convenient to place all of the scripts in a drawer so that you can access them quickly. See Script Drawer For KDE Plasma Panel for instructions to do this.