Skip to content

Commit

Permalink
Merge pull request #366 from Ikaros-521/owner
Browse files Browse the repository at this point in the history
提供多按键映射的配置实例;修复多按键映射bug
  • Loading branch information
Ikaros-521 authored Oct 15, 2023
2 parents 85443dc + 2527e1f commit 368db25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@
"动作1"
],
"keys": [
"ctrlleft",
"1"
],
"similarity": 1
Expand Down
2 changes: 2 additions & 0 deletions utils/my_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -1273,6 +1273,7 @@ def key_mapping_handle(self, data):
Returns:
bool: 是否正常触发了按键映射事件,是True 否False
"""
# 官方文档:https://pyautogui.readthedocs.io/en/latest/keyboard.html#keyboard-keys
if My_handle.config.get("key_mapping", "enable"):
content = data["content"]
# 判断命令头是否匹配
Expand All @@ -1292,6 +1293,7 @@ def key_mapping_handle(self, data):
# 触发对应按键按下释放
for key in key_mapping_config["keys"]:
pyautogui.keyDown(key)
for key in key_mapping_config["keys"]:
pyautogui.keyUp(key)

logging.info(f'【触发按键映射】关键词:{keyword} 按键:{key_mapping_config["keys"]}')
Expand Down

0 comments on commit 368db25

Please sign in to comment.