C Program to read mouse in console via GPM

/ Published in: Pascal
Save to your folder(s)

Install GPM using installer such as apt or dnf

All you have to do is save code with mouse.c file name and compile it : gcc -o mouse mouse.c -lgpm

and you got a "mouse" program that executes l.sh on left, r.sh on right and m.sh on middle mouse button click.

You will also have to install gpm daemon (and run it) and libgpm.

There is one issue, I can't get mouse wheel work whit libgpm. libgpm have very poor documentary so maybe someone knows how to read wheel events?

URL: https://www.linuxquestions.org/questions/linux-software-2/capture-or-monitor-mouse-button-events-in-console-703018/

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.