how to get MouseMove and MouseClick in bash?

后端 未结 6 781
野的像风
野的像风 2020-11-30 04:19

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.

6条回答
  •  时光说笑
    2020-11-30 04:57

    You can use the command 'xte' from package 'xautomation'.

    apt-get install xautomation
    

    As an example, the following command can be noted:

    xte 'mousemove 200 300'
    

    So, the mouse pointer moves to the width 200 and height 300 of the screen. As an other example, we have:

    xte 'mouseclick 3'
    

    that click the right button of mouse (1: left click, 2: middle click, 3: right click). Moreover you can press the keys on keyboard via shell:

    xte 'keydown Control_L' 'key c' 'keyup Control_L'
    

    This example send ctrl+c to shell.

提交回复
热议问题