手机键盘控制电脑 - 通过手机浏览器控制电脑输入
Project description
手机键盘控制电脑
通过手机浏览器访问网页,使用虚拟键盘控制电脑输入。
原理:网页发送键盘按键到电脑,由电脑上的输入法(如搜狗、微软拼音)处理拼音转换。
快速安装
方法一:pip 安装(推荐)
# 安装
pip install screen-keyboard
# 运行
screen-keyboard start
方法二:源码安装
# 克隆或直接下载后
pip install -e .
# 运行
screen-keyboard start
方法三:一行命令安装
curl -sL https://raw.githubusercontent.com/ggengx/screen-keyboard/main/install-one-line.sh | bash
CLI 命令行使用
可用命令
# 启动服务(默认端口 5000)
screen-keyboard start
# 指定端口启动
screen-keyboard start --port 8080
screen-keyboard start -p 8080
# 快速查看局域网 IP
screen-keyboard ip
# 查看本机详细网络信息
screen-keyboard info
# 检查端口是否被占用
screen-keyboard check -p 5000
# 显示帮助信息
screen-keyboard help
screen-keyboard --help
终端图形界面
启动服务时会显示漂亮的终端图形界面:
╔══════════════════════════════════════════════════════════╗
║ ▄▀█║
║ █▀▀ █▀█ █▀▄▀█ █▀▀ ▄▀█ █║
║ █▄▄ █▄█ █░▀░█ ██▄ █▀█ █║
║ █║
║ █▀▀ █▀█ █░█ █▀▀ █▀█ ▄▀█ █░ ▀█║
║ █▄▄ █▄█ ▀▄▀ ██▄ █▀█ █▀█ ▄██ █║
║ █║
╠══════════════════════════════════════════════════════════╣
║ 服务已启动 ║
╠══════════════════════════════════════════════════════════╣
║ 局域网地址: ║
║ http://192.168.1.100:5000 ║
║ ┊ ┊
║ ┊ 其他可用地址: ┊
╠══════════════════════════════════════════════════════════╣
║ 请在手机浏览器访问上述地址 ║
║ 按 Ctrl+C 停止服务 ║
╚══════════════════════════════════════════════════════════╝
使用方法
1. 启动服务
screen-keyboard start
服务端启动后会显示局域网地址,例如:
局域网地址:http://192.168.1.100:5000
2. 手机访问
在手机上连接同一 WiFi,用浏览器访问该地址即可。
功能
- ✅ 全键盘布局(QWERTY)
- ✅ 符号/数字键盘切换
- ✅ Shift 大写切换
- ✅ 特殊按键(回车、退格、空格)
- ✅ 方向键(倒 T 布局)
- ✅ 触控板鼠标控制
- ✅ 摇杆鼠标控制
- ✅ 鼠标左右中键 + 滚轮
- ✅ Win+Space 中英文切换
- ✅ 拖动窗口/文件(双击触控板后拖动)
- ✅ 锁定页面防止误触
说明
- 确保手机和电脑在同一局域网
- 电脑需开启拼音输入法
- 如果防火墙阻止,请开放 5000 端口
开发
# 创建 conda 环境
conda env create -f environment.yml
conda activate screen-keyboard
# 安装依赖
pip install -r requirements.txt
# 运行
python app.py
发布到 PyPI
# 安装构建和发布工具
pip install build twine
# 构建包
python -m build
# 上传到 PyPI
python -m twine upload dist/*
# 或使用发布脚本
chmod +x publish.sh
./publish.sh
首次发布需要配置 PyPI API Token:
# 创建 ~/.pypirc 文件
cat > ~/.pypirc << EOF
[distutils]
index-servers =
pypi
[pypi]
username = __token__
password = pypi-xxxxx # 从 https://pypi.org/manage/account/token/ 获取
EOF
License
MIT License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file screen_keyboard-1.0.7-py3-none-any.whl.
File metadata
- Download URL: screen_keyboard-1.0.7-py3-none-any.whl
- Upload date:
- Size: 19.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a1283df045e3aa50fdf22f716371e1bd00fd25e57de711f2fe517d2703aca0d
|
|
| MD5 |
ce38ff6b72206bbcfeec888ccbc41bc5
|
|
| BLAKE2b-256 |
dab1f0a0343df4cba879eaf923cbd9f9a6a54aa1e4eeb766a0e9dcf793d1b205
|