LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 12-13-2007, 05:13 AM   #1
simopal6
Member
 
Registered: Jun 2006
Location: Italy
Distribution: Slackware 13.1
Posts: 217

Rep: Reputation: 30
Emulating a key press


Hello!

I need a program which emulates a key press, which has to be captured by the foreground application (like virtual keyboards do).

Is this easy to implement?

I thought that it's just a matter of writing to a /dev/something file, but I'm not sure whether this can be done or whether such a device file exists.

Any help is appreciated!
Thanks!
 
Old 12-13-2007, 12:53 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
For a command-line solution, try xvkbd with the -xsendevent flag. You can set up a '-text' event to send keypress combinations.

'xvkbd -xsendevent -text "\Ca"' should send a control+a combination to the focused window.

There are also gui options such as the kde 'input actions' if you want to set up mouse gestures or custom hotkey combos, or something like that.
 
  


Reply

Tags
key


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
key press detecting ilnli Programming 2 07-16-2007 02:24 AM
c++ g++ wait for key press??? blizunt7 Programming 15 07-13-2007 02:09 AM
Key press Majestros Programming 2 02-14-2007 03:42 AM
Key press simulation in FC kiruxa Linux - General 1 11-24-2006 10:00 PM
Double key press on Keyboard Zettai Linux - Newbie 2 03-09-2005 10:59 PM


All times are GMT -5. The time now is 08:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration