Guest User

Untitled

a guest
Jul 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. xev -event button | awk '
  4. BEGIN {
  5. e = 0;
  6. t = 0;
  7. c[0] = "33[31;1m"
  8. c[1] = "33[36;1m"
  9. }
  10. /Press/ {e = 0; printf "down "}
  11. /Release/ {e = 1; printf "up "}
  12. /time/ {
  13. h = c[e];
  14. printf "%s", c[e]
  15. if (e) {
  16. printf "%8d %sn", ($6 - t), strftime("%M:%S")
  17. } else {
  18. printf "%8d %sn", ($6 - t), strftime("%M:%S")
  19. }
  20. t = $6 + 0
  21. }
  22. '
  23.  
  24. In reality: 1 down
  25. down 191 51:12
  26. up 16 51:12
  27. down 36 51:12
  28.  
  29. In reality: 1 down
  30. down 1532 52:21
  31. up 48 52:21
  32. down 16 52:21
  33.  
  34. In reality: 1 down
  35. down 1580 53:03
  36. up 16 53:03
  37. down 16 53:03
  38. up 1189 53:04 (yes, held down button here as well)
  39. down 18 53:04
Add Comment
Please, Sign In to add comment