#!/bin/bash

# Define the file to store the position
POSITION_FILE="/tmp/weirdmouse"

# Initialize position if the file does not exist
if [ ! -f "$POSITION_FILE" ]; then
    echo "0 0" > "$POSITION_FILE"
fi

# Read the current position from the file
read -r x y < "$POSITION_FILE"

# Update the position based on the argument
case "$1" in
    up)
        y=$((y - 10))
        ;;
    down)
        y=$((y + 10))
        ;;
    left)
        x=$((x - 10))
        ;;
    right)
        x=$((x + 10))
        ;;
    *)
        echo "Usage: $0 {up|down|left|right}"
        exit 1
        ;;
esac

# Save the new position to the file
echo "$x $y" > "$POSITION_FILE"

# Move the mouse cursor to the new position
hyprctl dispatch movecursor "$x" "$y"

