Initial commit
This commit is contained in:
commit
dcd87d509a
2 changed files with 43 additions and 0 deletions
43
antisub.sh
Executable file
43
antisub.sh
Executable file
|
@ -0,0 +1,43 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
max_speed=20
|
||||||
|
function handleKeys() {
|
||||||
|
input_time=$(($(date +%s%N)/1000))
|
||||||
|
while true; do
|
||||||
|
|
||||||
|
end=$(($input_time + 1000000))
|
||||||
|
inputs=0
|
||||||
|
|
||||||
|
while [[ "$input_time" -lt "$end" ]]; do
|
||||||
|
time_sec=$(od -An -t u8 -N 8)
|
||||||
|
time_ms=$(od -An -t u8 -N 8)
|
||||||
|
|
||||||
|
# Time of the input in usec
|
||||||
|
input_time=$(($time_ms+$time_sec*1000000))
|
||||||
|
|
||||||
|
key_type=$(od -An -t u2 -N 2)
|
||||||
|
code=$(od -An -t u2 -N 2)
|
||||||
|
value=$(od -An -t u4 -N 4)
|
||||||
|
|
||||||
|
if [[ $key_type -eq 1 ]]; then
|
||||||
|
if [[ $value -eq 1 ]]; then
|
||||||
|
inputs=$(($inputs+1))
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "--------------------------------"
|
||||||
|
echo $inputs over the last second
|
||||||
|
if [[ $inputs -gt $max_speed ]]; then
|
||||||
|
if [ -z "$var" ]; then
|
||||||
|
swaylock -c 000000 -i "./whatthefuckispleadingface.jpg" -s fit
|
||||||
|
else
|
||||||
|
# Haven'y actually tested outside of sway but it should work
|
||||||
|
output=$(mktemp XXXXXXXX.jpg)
|
||||||
|
convert -resize $(xdpyinfo | grep dimensions | cut -d\ -f7 | cut -dx -f1) "./whatthefuckispleadingface.jpg" "$output"
|
||||||
|
i3lock -c 000000 -i "$output"
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
done;
|
||||||
|
}
|
||||||
|
|
||||||
|
sudo cat /dev/input/event0 | handleKeys
|
BIN
whatthefuckispleadingface.jpg
Normal file
BIN
whatthefuckispleadingface.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 63 KiB |
Loading…
Reference in a new issue