I have a small problem in GNU screen. A GNU screen session runs on my RaspberryPi. Now sometimes, when I join it, if I click in the terminal (I'm using terminator on Fedora) I see weird characters written. These characters depend on the coordinates of my mouse… Seems like a wrong decoding of the click event sent to GNU Screen. These characters include things like

kM#kM -  Z3#Z3  -  q-#q-


I first thought it was a problem with my tty so I went and opened a new GNU Screen session on my RaspberryPi: no problem at all.
I did a stty -a on both session and saw there were difference. I then did a stty -g > ~/stty-good-settings on the good session and loaded it on the bad one with stty `cat ~/stty-good-settings` (I compared the values after that, the settings were successfully loaded) but I still have the problem in one of the screen sessions and not the other!

I'm not sure what's happening, if this is due to my TERM value (same in both), my tty settings, my terminal…

  • 2
    I see this with tmux from time to time too. At some point the terminal multiplexers seem to go banana and decode the inputs incorrectly (xterm might also have something to say here). reset usually fixes this for me.
    – peterph
    Commented May 21, 2013 at 21:50
  • Indeed, reset works in screen too! Thanks for the fix, however, I'd love some insight as to why... Commented May 21, 2013 at 22:43
  • Me too... :) I suspect it to be some kind of bad interaction between the terminal multiplexers and the containing terminal.
    – peterph
    Commented May 21, 2013 at 23:11
  • I see.. You can answer the question, I'll validate this answer! Commented May 22, 2013 at 14:54

2 Answers 2


Something that runs inside GNU screen decided it was running in an xterm (or similar) instead and enabled Application Mouse mode. (Or something you run in that terminal before you attached to GNU screen, possibly even before ssh, which did not properly reset itself.) This is often the case if $TERM is not “screen” but e.g. “xterm” or “screen.xterm”. The latter is seen on Debian systems (and derivates) that have ncurses-term installed; try purging that package (on host and raspi).

Otherwise, reset (as was already said) or printf \\x033c may help temporarily. Or, of course, the proper escape sequences to tell your terminal emulator to disable mouse mode.

  • reset did the trick. Thanks. Commented Jul 10, 2019 at 8:21
  • for me it was the term type. Thanks! Commented Apr 2, 2020 at 0:49

reset has its place, but clears your screen. If you are running xterm or anything compatible, the shortest, least intrusive thing to use would be

printf '\033[?9l'

That is not explicitly stated in the Mouse Tracking section of XTerm Control Sequences, but xterm allows you to reset (disable) mouse mode by turning off any of the possible modes that might be turned on. Those are documented as named constants:

 #define SET_X10_MOUSE               9
 #define SET_VT200_MOUSE             1000
 #define SET_VT200_HIGHLIGHT_MOUSE   1001
 #define SET_BTN_EVENT_MOUSE         1002
 #define SET_ANY_EVENT_MOUSE         1003

and 9 is the shortest.

Mouse-mode is turned on by many applications. If one exits without turning it off, that produces the odd characters which you saw. ncurses applications turn mouse-mode off in endwin, which all well-behaved curses application call. Other applications may not use (n)curses, or may forget to call endwin.

ncurses applications check if xterm-mouse mode is available by testing for the kmous capability (which is part of the screen terminal description). That has been the standard way to test for the feature since 1999, so it is unlikely that an application turned mouse mode on accidentally. Rather, it indicates an application that forgot to do its job.

There is, by the way, no screen.xterm entry in Debian's ncurses-term package (keeping it is more helpful than removing it). Here is a list of all of the screen-related entries in that package. Most are used for fixing discrepancies in screen behavior for various terminals:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .