diff --git a/README.md b/README.md index 7382488..101fc06 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,20 @@ -further edits to the L380 scripts to fit the x380. This is because there appears to be no tablet mode hotkey for the x380. +This repo is forked from https://github.com/ffejery/thinkpad-l380-yoga-scripts with edits for the x380. Differences are: -Status: +- we don't need to disable the keyboard and buttons depress +- there seems to be no hotkey for tablet mode, so we need a workaround + + +Status: Working! - [x] rotatation - [x] brightness adjustment - [x] turn off touchscreen when using pen -- [ ] turn off touchpad and trackpoint in tablet mode - - [x] Changed to use acpi hook since it lacks hotkey - - [ ] BUG: doesn't always fire - - [x] I'm adding this to startup `/usr/bin/acpi_listen | /opt/thinkpad-x380-yoga-scripts/tablet/acpi_tablet_monitor.sh` - - [x] BUG: touchpad wont enable again, this seems to be a driver bug - -forked from :https://github.com/ffejery/thinkpad-l380-yoga-scripts +- [x] tablet mode turns off touchpad, click buttons, and trackpoint (and turns on screen keyboard) For more tweaks for Xubuntu on a Thinkpad x380 yoga see [this gist](https://gist.github.com/wassname/4aec086afe518dfbceaf00577442c432) # Dependencies - xrandr - xinput -- xbindkeys -- kbd (for setkeycodes) - systemd - gawk - xsetwacom (optional for wacom rotation) @@ -28,9 +24,13 @@ For more tweaks for Xubuntu on a Thinkpad x380 yoga see [this gist](https://gist ```sh +# place it in this exact location git clone https://github.com/wassname/thinkpad-x380-yoga-scripts /opt/thinkpad-x380-yoga-scripts +# copy scripts to systemd sudo cp /opt/thinkpad-x380-yoga-scripts/systemd/* /etc/systemd/system/ + +# enable scripts sudo systemctl enable yoga-tablet@${USER}.service sudo systemctl start yoga-tablet@${USER}.service sudo systemctl status yoga-tablet@${USER}.service @@ -44,10 +44,10 @@ sudo systemctl enable yoga-rotate@${USER}.service sudo systemctl start yoga-rotate@${USER}.service sudo systemctl status yoga-rotate@${USER}.service -# I prefer manual -#sudo systemctl enable yoga-backlight.service -#sudo systemctl start yoga-backlight.service -#sudo systemctl status yoga-backlight.service +# don't run these if you prefer manual backlight control +sudo systemctl enable yoga-backlight.service +sudo systemctl start yoga-backlight.service +sudo systemctl status yoga-backlight.service ``` diff --git a/systemd/yoga-tablet@.service b/systemd/yoga-tablet@.service index 5e7c691..d3cb784 100644 --- a/systemd/yoga-tablet@.service +++ b/systemd/yoga-tablet@.service @@ -5,7 +5,7 @@ After=display-manager.service [Service] Type=simple -ExecStart=/usr/bin/env bash /opt/thinkpad-x380-yoga-scripts/tablet/tablet_monitor.sh +ExecStart=/usr/bin/env bash /opt/thinkpad-x380-yoga-scripts/tablet/acpi_tablet_monitor.sh KillMode=process User=%i Environment="DISPLAY=:0" "XAUTHORITY=/home/%i/.Xauthority" diff --git a/tablet/acpi_tablet_monitor.sh b/tablet/acpi_tablet_monitor.sh index 04f57b6..4e19969 100755 --- a/tablet/acpi_tablet_monitor.sh +++ b/tablet/acpi_tablet_monitor.sh @@ -1,28 +1,36 @@ #!/bin/bash - -while true ; do -read ACPI_EVENT -case "$ACPI_EVENT" in -"ibm/hotkey IBM0068:00 00000080 0000500c") - echo "Stylus removed" -;; -"ibm/hotkey IBM0068:00 00000080 0000500b") - echo "Stylus replaced" -;; -"video/tabletmode TBLT 0000008A 00000001") - xinput disable "ETPS/2 Elantech TrackPoint" - synclient TouchpadOff=1 - nohup onboard >/dev/null 2>&1 & -echo "Tablet mode" -;; -"video/tabletmode TBLT 0000008A 00000000") - xinput enable "ETPS/2 Elantech TrackPoint" - synclient TouchpadOff=0 - killall onboard - echo "Normal mode" -;; -*) - echo "Unknown event: '$ACPI_EVENT'" -;; -esac +acpi_listen | while IFS= read -r ACPI_EVENT; +do + case "$ACPI_EVENT" in + "ibm/hotkey IBM0068:00 00000080 0000500c") + echo "Stylus removed" + ;; + "ibm/hotkey IBM0068:00 00000080 0000500b") + echo "Stylus replaced" + ;; + "video/tabletmode TBLT 0000008A 00000001") + xinput disable "ETPS/2 Elantech TrackPoint" + synclient TouchpadOff=1 + nohup onboard >/dev/null 2>&1 & + echo "Tablet mode" + ;; + "video/tabletmode TBLT 0000008A 00000000") + xinput enable "ETPS/2 Elantech TrackPoint" + synclient TouchpadOff=0 + killall onboard + echo "Normal mode" + ;; + *) + echo "Unknown event: '$ACPI_EVENT'" + ;; + esac + if [ "$line" = "jack/headphone HEADPHONE plug" ] + then + notify-send "headphones connected" + sleep 1.5 && killall notify-osd + elif [ "$line" = "jack/headphone HEADPHONE unplug" ] + then + notify-send "headphones disconnected" + sleep 1.5 && killall notify-osd + fi done diff --git a/tablet/tablet_monitor.sh b/tablet/tablet_monitor.sh deleted file mode 100755 index 8080c79..0000000 --- a/tablet/tablet_monitor.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -/usr/bin/acpi_listen | /opt/thinkpad-x380-yoga-scripts/tablet/acpi_tablet_monitor.sh