summaryrefslogtreecommitdiffstats
path: root/toggle-mouse-wheel-emulation
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2019-07-14 16:25:17 +0200
committerSebastian Reichel <sre@ring0.de>2019-07-14 16:25:17 +0200
commite52f3cf6837577723240ca0ca0f53f4b4417ff2d (patch)
tree6b54bea32b1a0df17b497875d9514bc11bac6a51 /toggle-mouse-wheel-emulation
parentb0a38d7b72a849f12062cbf2f2d172599a99fd83 (diff)
downloadtp-key-handler-e52f3cf6837577723240ca0ca0f53f4b4417ff2d.tar.bz2
introduce sway supportHEADmaster
Diffstat (limited to 'toggle-mouse-wheel-emulation')
-rwxr-xr-xtoggle-mouse-wheel-emulation29
1 files changed, 22 insertions, 7 deletions
diff --git a/toggle-mouse-wheel-emulation b/toggle-mouse-wheel-emulation
index 88fffe9..ddd524f 100755
--- a/toggle-mouse-wheel-emulation
+++ b/toggle-mouse-wheel-emulation
@@ -1,12 +1,27 @@
#!/bin/sh
-ID=$(xinput --list --id-only "PS/2 Synaptics TouchPad")
-ENABLED=$(xinput list-props $ID | grep -E "Evdev Wheel Emulation \([0-9]*\):" | awk '{print $5}')
+swaymsg -q >/dev/null 2>&1
+SWAY=$?
-if [ $ENABLED = 1 ] ; then
- xinput set-prop $ID --type=int --format=8 "Evdev Wheel Emulation" 0
- echo "disabled"
+if [ $SWAY -ne 0 ] ; then
+ ID=$(xinput --list --id-only "PS/2 Synaptics TouchPad")
+ ENABLED=$(xinput list-props $ID | grep -E "Evdev Wheel Emulation \([0-9]*\):" | awk '{print $5}')
+
+ if [ $ENABLED = 1 ] ; then
+ xinput set-prop $ID --type=int --format=8 "Evdev Wheel Emulation" 0
+ echo "disabled"
+ else
+ xinput set-prop $ID --type=int --format=8 "Evdev Wheel Emulation" 1
+ echo "enabled"
+ fi
else
- xinput set-prop $ID --type=int --format=8 "Evdev Wheel Emulation" 1
- echo "enabled"
+ status=$(swaymsg -rt get_inputs | jq -r '.[] | select(.identifier == "2:10:TPPS/2_IBM_TrackPoint") | .libinput.scroll_method')
+
+ if [ "$status" = 'on_button_down' ] ; then
+ swaymsg input "2:10:TPPS/2_IBM_TrackPoint" scroll_method none
+ echo "disabled"
+ else
+ swaymsg input "2:10:TPPS/2_IBM_TrackPoint" scroll_method on_button_down
+ echo "enabled"
+ fi
fi