Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to read mouse buttons from the console without success. According to man console_codes the Linux console has X10 mouse reporting. This means that after enabling it (printf "\e[?9h") pressed button + mouse position should be reported on stdin with:

\e[M b x y

where b is pressed button + 32 and x, y are mouse coords.

No luck, this only works with xterm alikes. I'm not the only one, please see:

"...Surprisingly, since I read about mouse tracking in a Linux console_codes man page, these escape codes do not work in any Linux console that I have tried..."

Has anybody tried this with success? Is this a bug?

share|improve this question
stdin? You mean stdout. – new123456 Jul 25 '11 at 17:30
Nope, it's stdin, console driver injects \e[M b x y to stdin head, so as to be read by the application. That's how mouse reporting works. – francesc Jul 25 '11 at 21:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.