Skip to content

Instantly share code, notes, and snippets.

@mhdzli
Created August 2, 2020 06:19
Show Gist options
  • Save mhdzli/2195347866adfa9c832d35cccc35016b to your computer and use it in GitHub Desktop.
Save mhdzli/2195347866adfa9c832d35cccc35016b to your computer and use it in GitHub Desktop.
Toggle touchpad in sway
#!/bin/bash
TOUCHPAD_ID="$(swaymsg -t get_inputs | grep 'identifier.*Touchpad' | cut -d'"' -f4)" #give me the touchpad identifier
STATE="$(swaymsg -t get_inputs | jq .[0].libinput.send_events)" #check if touchpad is enabled
[ "$STATE" = '"enabled"' ] && swaymsg input "$TOUCHPAD_ID" events disabled || swaymsg input "$TOUCHPAD_ID" events enabled
@grbll
Copy link

grbll commented Jun 13, 2023

The second line doesn"t work (anymore?). Here a fix:

STATE="$(swaymsg -t get_inputs | jq '.[] | select(.identifier=="'"$TOUCHPAD_ID"'") | .libinput.send_events')" #check if touchpad is enabled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment