Reputation: 679
I am currently coding a node.js program relating to mouse coordinates. Is there a way to see the mouse position in the terminal in Node.JS?
I've tried the ways beginning in \e
but they only list the cursor position. How do I get the mouse position in the terminal?
Is there a way to get said position in the "Row/Column" or "Column/Row" format? If there is no way, what about using child_process
?
Upvotes: 0
Views: 1079
Reputation: 679
I have solved my problem.
To get events, the bash escape load ESC[?100Xh
, replacing X with a number. The events will then be logged to the console.
Upvotes: 0
Reputation: 11
You can take a look at RobotJS it can show you where the mouse position is. You can use 'getmousepos' function to get the X and Y coordinates of the mouse on the screen
NPM: https://www.npmjs.com/package/robotjs
Doc: https://robotjs.io/docs/syntax#getmousepos
Upvotes: 1