From 7389045fe66e5792f02be55ebb4bb3d3116d25db Mon Sep 17 00:00:00 2001 From: wassname Date: Fri, 15 Mar 2019 05:57:15 +0800 Subject: [PATCH] misc --- README.md | 6 +++--- systemd/wacom-proximity@.service | 1 - ...ga-tablet.service => yoga-tablet@.service} | 6 ++++-- tablet/acpi_tablet_monitor.sh | 20 +++++++++---------- 4 files changed, 17 insertions(+), 16 deletions(-) rename systemd/{yoga-tablet.service => yoga-tablet@.service} (55%) diff --git a/README.md b/README.md index 059f4c8..7382488 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,9 @@ For more tweaks for Xubuntu on a Thinkpad x380 yoga see [this gist](https://gist git clone https://github.com/wassname/thinkpad-x380-yoga-scripts /opt/thinkpad-x380-yoga-scripts sudo cp /opt/thinkpad-x380-yoga-scripts/systemd/* /etc/systemd/system/ +sudo systemctl enable yoga-tablet@${USER}.service +sudo systemctl start yoga-tablet@${USER}.service +sudo systemctl status yoga-tablet@${USER}.service sudo systemctl enable wacom-proximity@${USER}.service sudo systemctl start wacom-proximity@${USER}.service @@ -46,9 +49,6 @@ sudo systemctl status yoga-rotate@${USER}.service #sudo systemctl start yoga-backlight.service #sudo systemctl status yoga-backlight.service -sudo systemctl enable yoga-tablet.service -sudo systemctl start yoga-tablet.service -sudo systemctl status yoga-tablet.service ``` # Scripts should fix: diff --git a/systemd/wacom-proximity@.service b/systemd/wacom-proximity@.service index 826cd24..95432a5 100644 --- a/systemd/wacom-proximity@.service +++ b/systemd/wacom-proximity@.service @@ -3,7 +3,6 @@ Description=[ThinkPad Yoga] Wacom digitizer proximity detection Requires=display-manager.service After=display-manager.service - [Service] Type=simple ExecStart=/bin/bash /opt/thinkpad-x380-yoga-scripts/wacom/thinkpad-yoga-prox.sh diff --git a/systemd/yoga-tablet.service b/systemd/yoga-tablet@.service similarity index 55% rename from systemd/yoga-tablet.service rename to systemd/yoga-tablet@.service index f350ddc..5e7c691 100644 --- a/systemd/yoga-tablet.service +++ b/systemd/yoga-tablet@.service @@ -4,9 +4,11 @@ Requires=display-manager.service After=display-manager.service [Service] -ExecStart=/bin/bash /opt/thinkpad-x380-yoga-scripts/tablet/tablet_monitor.sh -KillMode=process Type=simple +ExecStart=/usr/bin/env bash /opt/thinkpad-x380-yoga-scripts/tablet/tablet_monitor.sh +KillMode=process +User=%i +Environment="DISPLAY=:0" "XAUTHORITY=/home/%i/.Xauthority" [Install] WantedBy=multi-user.target diff --git a/tablet/acpi_tablet_monitor.sh b/tablet/acpi_tablet_monitor.sh index 57cdd1b..04f57b6 100755 --- a/tablet/acpi_tablet_monitor.sh +++ b/tablet/acpi_tablet_monitor.sh @@ -4,25 +4,25 @@ while true ; do read ACPI_EVENT case "$ACPI_EVENT" in "ibm/hotkey IBM0068:00 00000080 0000500c") -echo "Stylus removed" + echo "Stylus removed" ;; "ibm/hotkey IBM0068:00 00000080 0000500b") -echo "Stylus replaced" + echo "Stylus replaced" ;; "video/tabletmode TBLT 0000008A 00000001") -xinput disable "ETPS/2 Elantech TrackPoint" -synclient TouchpadOff=1 -nohup onboard >/dev/null 2>&1 & + 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" + xinput enable "ETPS/2 Elantech TrackPoint" + synclient TouchpadOff=0 + killall onboard + echo "Normal mode" ;; *) -echo "Unknown event: '$ACPI_EVENT'" + echo "Unknown event: '$ACPI_EVENT'" ;; esac done