You are not logged in.

#1 2021-03-28 14:20:27

nponeccop
Member
Registered: 2011-09-05
Posts: 15

Mouse in text console through xterm

I found a way to make tmux working with mouse in text mode. IMO it's better than pure gpm/consolation setup, so I wanted to share my way. It's also interesting to know if there are more straightforward ways to get the same result.

End result

ANY application supporting mouse in a xterm can use mouse in Linux console as well. Not only those specifically compiled with gpm support, such as vim. Tmux notably doesn't work with gpm but now it does let you switch panes using mouse in Linux text console.

Pros

- no need for gpm-specfic support any more - so apps such as tmux work with mouse in Linux console

Cons

- gpm-style mouse copy-paste doesn't work

Ingredients

- standard base setup
- consolation (from AUR)
- lcxterm https://gitlab.com/klamonte/lcxterm/-/tags/v0.9.1 (I'm not an author; I have a PKGBUILD if someone wants to try but it's trivial configure/make/make install)

How it works

- lcxterm plugs between agetty and bash and injects xterm mouse escape sequences

Setup to try it

- systemctl start consolation
- in a console:
  - log in
  - run lxcterm
  - run tmux with tmux set mouse on
  - open more than one tmux pane
  - switch between panes using a text mode blocky mouse cursor

vim and nvim work as well, with basic :set mouse=a setup.

What do you think? Is there a way to achieve this with less exotic components?

Note

- it's a simplified non-intrusive setup. The proper way is probably to make agetty running it.
- I tested it in Hyper-V, YMMV

Last edited by nponeccop (2021-03-28 14:26:08)

Offline

Board footer

Powered by FluxBB