File: exec-on-click

package info (click to toggle)
pwdsphinx 2.0.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 856 kB
  • sloc: python: 3,793; javascript: 1,001; sh: 238; makefile: 74
file content (21 lines) | stat: -rwxr-xr-x 514 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env sh

# depends on xinput

MOUSEID=$(xinput --list --short | fgrep "Virtual core pointer" | sed 's/.*id=\([0-9]*\).*/\1/')
THIS=$$
# wait until left mouse click
exec 2>/dev/null
xinput --test-xi2 --root $MOUSEID | while true; do
   read -t 1 line
   case "$line" in
      EVENT\ type\ 16\ \(RawButtonRelease\)) 
         read -t 1 line
         read -t 1 details;
         case "$details" in
            detail:\ 1) pkill -P $THIS xinput ; exit ;;
         esac
         ;;
   esac
done
eval "${@}" ;