'Is there a way to get the mouse position within the terminal?
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
?
Solution 1:[1]
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.
Solution 2:[2]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | awesomemaker3000 |
Solution 2 | Faisal Khalid |