diff options
author | Sebastian Reichel <sre@ring0.de> | 2019-07-14 16:25:17 +0200 |
---|---|---|
committer | Sebastian Reichel <sre@ring0.de> | 2019-07-14 16:25:17 +0200 |
commit | e52f3cf6837577723240ca0ca0f53f4b4417ff2d (patch) | |
tree | 6b54bea32b1a0df17b497875d9514bc11bac6a51 /toggle-mouse-wheel-emulation | |
parent | b0a38d7b72a849f12062cbf2f2d172599a99fd83 (diff) | |
download | tp-key-handler-master.tar.bz2 |
Diffstat (limited to 'toggle-mouse-wheel-emulation')
-rwxr-xr-x | toggle-mouse-wheel-emulation | 29 |
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 |