LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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
 
Search this Thread
Old 12-13-2007, 06:13 AM   #1
simopal6
Member
 
Registered: Jun 2006
Location: Italy
Distribution: Slackware 13.1
Posts: 218

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, 01: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: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950Reputation: 1950
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


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


All times are GMT -5. The time now is 09:29 AM.

Main Menu
Advertisement
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