Files
dotfiles/hypr/scripts/weirdmouse.sh
2025-06-03 14:16:01 +03:00

40 lines
747 B
Bash
Executable File

#!/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"