about summary refs log tree commit diff
path: root/scripts/toggle-trackpoint.sh
diff options
context:
space:
mode:
authorazahi <azahi@teknik.io>2018-10-13 14:12:30 +0300
committerazahi <azahi@teknik.io>2018-10-13 14:12:30 +0300
commit8e20389ce238d979e6cb9253643bc181d698f5a9 (patch)
treed777052e5ac411cfa79de596ecc99d7d596705d8 /scripts/toggle-trackpoint.sh
parentRework Custom (diff)
Huge update, yet again
Move to ~/.xmonad
Completely redo directory structure
Remove Test.hs with xmonad-ng-test because it breaks cabal
Add headers for new files
Add proper "copyright" entries and mention upstream xmonad developers
Other minor fixes
Diffstat (limited to 'scripts/toggle-trackpoint.sh')
-rwxr-xr-xscripts/toggle-trackpoint.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/scripts/toggle-trackpoint.sh b/scripts/toggle-trackpoint.sh
new file mode 100755
index 0000000..b0b3501
--- /dev/null
+++ b/scripts/toggle-trackpoint.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+
+ID=$(xinput list | grep -Eo 'TrackPoint\s*id\=[0-9]{1,2}' | grep -Eo '[0-9]{1,2}')
+STATE=$(xinput list-props "$ID" | awk '/Device Enabled/ {print $4}')
+
+if [ "$STATE" -eq 1 ]
+then
+    xinput disable "$ID"
+else
+    xinput enable "$ID"
+fi

Consider giving Nix/NixOS a try! <3