Skip to content

Instantly share code, notes, and snippets.

@lidgnulinux
Created February 5, 2024 02:32
Show Gist options
  • Save lidgnulinux/33a28be6a1352cb84d7c6c8b63b5a5c2 to your computer and use it in GitHub Desktop.
Save lidgnulinux/33a28be6a1352cb84d7c6c8b63b5a5c2 to your computer and use it in GitHub Desktop.
How to get cursor's coordinate on wayland.
#!/bin/bash
# Dependencies :
# - slurp (https://wayland.emersion.fr/slurp/).
# - awk.
# - cut.
# - sed.
# - Wayland compositor with layer_shell support.
# How to use :
# - Run this script on terminal !
# - Click wherever spot you want !
coordinate=$(slurp -b 00000000 -p | awk '{print $1}')
x_cord=$(echo $coordinate | cut -d ',' -f 1)
y_cord=$(echo $coordinate | sed -e 's/^.*,//g')
echo "$x_cord" "$y_cord"
@lidgnulinux
Copy link
Author

@D4llo
Copy link

D4llo commented Apr 3, 2024

You may only need to run $> slurp -p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment