I\'m wondering how to get the MouseClick and MouseMove events in bash scripting for my own simple OS events.
Please tell me how to get that events.
I made a script to make the command line cursor move on mouse click :
It can be found here : https://github.com/tinmarino/mouse_xterm/blob/master/mouse.sh
Xterm have a mouse tracking feature
echo -e "\e[?1000;1006;1015h" # Enable tracking
echo -e "\e[?1000;1006;1015l" # Disable tracking
\e[<0;3;21M and a release \e[<0;3;21. Where 2 is x (from left) and 22 is y (from top) \e[<64;3;21M\e[<65;3;21MC-v after enabling the mouse tracking to see thatReadline can trigger a bash callback
bind -x '"\e[<64;": mouse_void_cb' # Cannot be put in .inputrc
bind '"\C-h" : "$(date) \e\C-e\ef\ef\ef\ef\ef"' #Can be put in .inputrc
Readline can call multiple functions
# Mouse cursor to begining-of-line before calling click callback
bind '"\C-98" : beginning-of-line'
bind -x '"\C-99" : mouse_0_cb'
bind '"\e[<0;": "\C-98\C-99"'
Readline callback can change cursor (point) position with READLINE_POINT environment variable
bind -x '"\C-h" : xterm_test'
function xterm_test {
echo "line is $READLINE_LINE and point $READLINE_POINT"
READLINE_POINT=24 # The cursor position (0 for begining of command)
READLINE_LINE='coco' # The command line current content
}