binSeekCursor: working area reset

This commit is contained in:
He4eT 2023-10-20 17:51:49 +03:00
commit 5a82861304

View file

@ -1,5 +1,14 @@
#!/bin/bash
temp_file="/tmp/binSeekCursor"
# Reset working area
if [ "$1" == "reset" ]; then
rm $temp_file
exit 0
fi
# Fail fast: Check 'direction' parameter
if [ "$1" != "up" ] && [ "$1" != "right" ] && [ "$1" != "down" ] && [ "$1" != "left" ]; then
@ -7,10 +16,6 @@ if [ "$1" != "up" ] && [ "$1" != "right" ] && [ "$1" != "down" ] && [ "$1" != "l
exit 1
fi
# Init
temp_file="/tmp/binSeekCursor"
# Current cursor position: $X and $Y
eval $(xdotool getmouselocation --shell)
@ -51,6 +56,7 @@ move_cursor_to_horizontal_center() {
}
# Set the working area borders based on the direction
case "$1" in
"up")
working_area_down=$Y
@ -71,6 +77,7 @@ case "$1" in
esac
# Write timestamp and working area to the temporary file
echo "" > $temp_file
echo "working_area_left=$working_area_left" >> $temp_file
echo "working_area_top=$working_area_top" >> $temp_file