开发者

Sending a keypress to an application

开发者 https://www.devze.com 2023-04-02 22:11 出处:网络
Is there an easy way to make an application think the user has pressed a key? Here\'s why I am trying to do this:

Is there an easy way to make an application think the user has pressed a key?

Here's why I am trying to do this:

I am trying to track down a regression in a Wine application. The bug only seems to show itself when the user presses a specific key (in this case, escape). So I wanted to give git bisect a script that开发者_开发技巧 launches the application, simulates pressing escape, and tells git that that the revision is bad if the program crashes.


Use xdotool: http://www.semicomplete.com/projects/xdotool/


There is some sample code at: http://www.doctort.org/adam/nerd-notes/x11-fake-keypress-event.html

It might be roughly what you need. Also read the comments (there is a sample for selecting a window in a different way).

0

精彩评论

暂无评论...
验证码 换一张
取 消