get mouse click input inside terminal.
mouse_input_gem.mp4
Note
supported in most - Xfce Terminal, GNOME Terminal, Konsole, Alacritty, Kitty, ITerm2, etc
requirement is support for SGR mode(CSI?1006h)
Important
tmux users must :set mouse on to enable mouse mode
Install the gem and add to the application's Gemfile by executing:
bundle add mouse_inputIf bundler is not being used to manage dependencies, install the gem by executing:
gem install mouse_inputafter installing the gem -
run mouse_input in your terminal and click anywhere in terminal
mouse_inputif you see X and Y coordinates printed correctly it works
require 'mouse_input'
coords = MouseInput.Read # listens for mouse click and returns X and Y coords.
pp coords # will print X and Y coordsBug reports and pull requests are welcome on GitHub at https://github.com/XAJX179/mouse_input. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the MouseInput project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.