mirror of
https://github.com/wassname/thinkpad-x380-yoga-scripts.git
synced 2026-09-11 12:51:55 +08:00
Fixed tablet mode
This commit is contained in:
@@ -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/"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Executable
+26
@@ -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
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
event=ibm/hotkey LEN0068:00 00000080 000060c0
|
||||
action=/etc/acpi/actions/tablet-mode.sh
|
||||
+14
-18
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user