Fixed tablet mode

This commit is contained in:
Aqeel Akber
2015-01-04 00:27:30 +10:00
parent d6e3877645
commit ae1b9350cf
7 changed files with 85 additions and 36 deletions
+4 -8
View File
@@ -9,7 +9,7 @@ url="https://github.com/admiralakber/thinkpad-yoga-scripts"
source=('thinkpad-yoga-scripts::git+https://github.com/admiralakber/thinkpad-yoga-scripts')
license=('GPL3')
arch=('any')
depends=('xorg-xrandr' 'acpid' 'xorg-xinput')
depends=('xorg-xrandr' 'xorg-xinput' 'xbindkeys' 'kbd' 'systemd' 'gawk')
optdepends=(
'onboard: onscreen keyboard'
'xf86-input-wacom: for digitizer support'
@@ -24,18 +24,14 @@ pkgver() {
package() {
cd $srcdir/$_gitname
# Disable touchpad when moving to tablet mode
mkdir -p "$pkgdir/etc/acpi/events"
install -m 644 tablet/tablet-mode "$pkgdir/etc/acpi/events"
mkdir -p "$pkgdir/etc/acpi/actions"
install -m 755 tablet/tablet-mode.sh "$pkgdir/etc/acpi/actions"
# Other scripts into /opt
# Install scripts into /opt
mkdir -p "$pkgdir/opt/$_gitname"
## Rotate scripts
cp -r rotate "$pkgdir/opt/$_gitname"
## Wacom scripts
cp -r wacom "$pkgdir/opt/$_gitname"
## Tablet mode
cp -r tablet $pkgdir/opt/$_gitname"
# ThinkPad Yoga Systemd Services
mkdir -p "$pkgdir/usr/lib/systemd/system/"
+22 -8
View File
@@ -1,30 +1,44 @@
thinkpad-yoga-scripts
=====================
A collection of scripts and systemd units to restore functionality of the Lenovo ThinkPad Yoga S1.
A collection of scripts and systemd units to restore functionality of
the Lenovo ThinkPad Yoga S1.
These are different from other scripts in that the screen rotation is
automated with use of the inbuilt accelerometer. Also, acpid is not
used in order to toggle between tablet mode but rather binding to the
inbuilt switches.
Tested on Arch Linux with MATE Desktop Environment.
# Scripts should fix:
- Screen rotation with accelerometer, including touchscreen, Wacom, and Touchpad/TrackPoint geometries
- Screen rotation with accelerometer, including touchscreen, Wacom,
and Touchpad/TrackPoint geometries
- Disabling of Touchscreen with proximity of Wacom digitizer
- Disabling of Clickpad and TrackPoint when moving to tablet mode
# TODO:
- Test on different desktop environments
- Test on different desktop environments (You can help!)
# Dependencies
- xrandr
- acpid
- xinput
- xbindkeys
- kbd
- systemd
- xsetwacom (optional for wacom rotation)
- onboard (optional for onscreen keyboard)
# Manual installation
sudo -s
git clone https://github.com/admiralakber/thinkpad-yoga-scripts /opt/thinkpad-yoga-scripts
cp /opt/thinkpad-yoga-scripts/systemd/* /etc/systemd/system/*
cp /opt/thinkpad-yoga-scripts/tablet/tablet-mode /etc/acpi/events
cp /opt/thinkpad-yoga-scripts/tablet/tablet-mode.sh /etc/acpi/actions
exit
cp systemd/* /usr/lib/systemd/system
systemctl start wacom-proximity@username.service
systemctl start yoga-rotate@username.service
systemctl start yoga-tablet.service
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=[ThinkPad Yoga] Tablet mode
Requires=display-manager.service
After=display-manager.service
[Service]
ExecStart=/usr/bin/bash /opt/thinkpad-yoga-scripts/tablet/tablet-mode.sh
KillMode=process
Environment="DISPLAY=:0"
Type=forking
[Install]
WantedBy=multi-user.target
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
# Simple script to toggle on/off the ThinkPad Yoga's Trackpoint and Clickpad
# and kill/launch. To be binded with switches when switching between tablet/laptop
# modes.
#
# Must be run as user running X11.
#
# https://github.com/admiralakber/thinkpad-yoga-scripts
# Author: AdmiralAkber
#export XAUTHORITY=`ls -1 /home/*/.Xauthority | head -n 1`
#export DISPLAY=":`ls -1 /tmp/.X11-unix/ | sed -e s/^X//g | head -n 1`"
case "$1" in
off)
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0
xinput --set-prop "TPPS/2 IBM TrackPoint" "Device Enabled" 0
sudo -b -u \#1000 onboard
;;
on)
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1
xinput --set-prop "TPPS/2 IBM TrackPoint" "Device Enabled" 1
killall onboard
;;
esac
-2
View File
@@ -1,2 +0,0 @@
event=ibm/hotkey LEN0068:00 00000080 000060c0
action=/etc/acpi/actions/tablet-mode.sh
+14 -18
View File
@@ -1,23 +1,19 @@
#!/bin/bash
# When converted to tablet, switch off touchpad, trackpoint, and launch onboard
# Since opening and closing tabletmode is signaled by the same ACPI event, the script toggles parameters.
#
#
# https://github.com/admiralakber/thinkpad-yoga-scripts
#
# Acknowledgements:
# Modified from source: djahma - https://forum.manjaro.org/index.php?topic=9671.0
# and oggy-/thinkpad-yoga-rotate
# Set tablet/laptop scancodes on ThinkPad Yoga S1 to NoSymbol
# keycodes then run xbindkeys as the appropriate user with
# a custom configuration file.
#
# USAGE: tablet-mode.sh username
export XAUTHORITY=`ls -1 /home/*/.Xauthority | head -n 1`
export DISPLAY=":`ls -1 /tmp/.X11-unix/ | sed -e s/^X//g | head -n 1`"
config='/opt/thinkpad-yoga-scripts/tablet/xbindkeysrc'
user="$(who -u | grep -F \(${DISPLAY}\) | head -n 1 | awk '{print $1}')"
touchpad=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" | awk -F ":" '{print $2}')
if [ $touchpad -eq 1 ]; then
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0
xinput --set-prop "TPPS/2 IBM TrackPoint" "Device Enabled" 0
sudo -b -u \#1000 onboard
else
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1
xinput --set-prop "TPPS/2 IBM TrackPoint" "Device Enabled" 1
killall onboard
fi
# Set scancode to keycodes
setkeycodes e058 85 # Tablet mode
setkeycodes e059 89 # Laptop mode
# Start xbindkeys with configuration file
su $user -c "xbindkeys -f $config"
+6
View File
@@ -0,0 +1,6 @@
"/bin/bash /opt/thinkpad-yoga-scripts/tablet/mouse-toggle.sh off"
m:0x0 + c:93
"/bin/bash /opt/thinkpad-yoga-scripts/tablet/mouse-toggle.sh on"
m:0x0 + c:97