Giter Site home page Giter Site logo

keyboardmouse's Introduction

使用 libevdev 开发的模拟键盘和鼠标的库

  • 使用用时需要root or input 用户组(ubuntu)权限

运行开发环境:

virtualenv Venv
or
python3 -m venv Venv

# 激活虚拟环境
. Venv/bin/activate

pip install .

运行测试Demo

mouse.py --help
usage: mouse.py [option] <KeyName>

使用C/S做的,虚拟鼠标键盘。使用前需要先启动server端(用户需要在input用户组内或者使用root启动)。

options:
  -h, --help            输出这个帮助信息
  --list                列出一些可以使用和键的示例
  --secret SECRET       指定通信secret
  --server              启动Server需要input用户组或者root权限。
  --key KEY             按下一个键,后松开。
  --keydown KEYDOWN     按下一个键, 不松开。
  --keyup KEYUP         松开一个键。
  --ctrlkey CTRLKEY     按下ctrl键,加上这个键的组合健。
  --altkey ALTKEY       按下alt键,加上这个键的组合健。
  --shiftkey SHIFTKEY   按下shift键,加上这个键的组合健。
  --mouseclick {left,right,wheel}
                        点击鼠标键:必须是:('left', 'right', 'wheel') 之一。
  --mousedown {left,right,wheel}
                        按下鼠标键:必须是:('left', 'right', 'wheel') 之一。
  --mouseup {left,right,wheel}
                        释放鼠标键:必须是:('left', 'right', 'wheel') 之一

查看对应键的键名和键值 运行 input-expoer.py 然后按下键盘上的按键或动下鼠标就可以看到类似如下输出。

InputEvent(EV_KEY, KEY_C, 1) # 按下C键时
InputEvent(EV_KEY, KEY_C, 0) # 松开C键时

InputEvent(EV_KEY, KEY_B, 1) # 按下B键时
InputEvent(EV_KEY, KEY_B, 0) # 松开B键时
  • 在mouse.py --key C
  • 在mouse.py --key B
  • 在mouse.py --shiftkey B # shift+C

keyboardmouse's People

Contributors

calllivecn avatar

Stargazers

 avatar mikigo avatar  avatar

Watchers

James Cloos avatar  avatar

keyboardmouse's Issues

Suggest packaging as WHL

  1. Suggest packaging as WHL,Convenient pip install
python setup.py bdist_wheel  # build
upload dist  xxxx.whl  # upload pip
pip install xxxx.whl  # install 
  1. What operations need to be done from 0 onwards to ReadME
  2. Hope there is a demo script to run the test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.