Sending keycode to Xorg + wine with bash script

匆匆过客 提交于 2019-11-29 23:33:27

问题


How do I send keycode to currently running application in linux which is running under wine? I would like the it to be under bash for simplicity.


回答1:


Use package called xvkbd. It should be within every linux distribution. Syntax is simple:

xvkbd -text [line of keycodes]

For example running Warcraft 3 game with automatic Battle.net login would be:

#!/bin/bash
cd ~/.wine/drive_c/Program\ Files/Warcraft3/
wine euroloader.exe -opengl > /dev/null 2> /dev/null & # run W3
sleep 5; # wait until animation fades out
xvkbd -text "b" # "b" is for Battle.net
sleep 7;
xvkbd -text "password\r" # password
sleep 3;
xvkbd -text "h" # "h" is for channel
sleep 5;
xvkbd -text "h" # honestly I don't know why, but without this the script might not work
sleep 5;
xvkbd -text "zcu\r" # type in your channel and join the room
sleep 5;
xvkbd -text ".load\r" # I'm using ghost, so I'll ask him what map is loaded


来源:https://stackoverflow.com/questions/954779/sending-keycode-to-xorg-wine-with-bash-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!