Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Community Discussions > The Community Cafe
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Ubuntu 9.10 is out!!!

When downloading Ubuntu 9.10 please consider using bittorrent to get your copy of Ubuntu.

The Ubuntu Developers Summit for Lucid Lynx will be held the week of 16-Nov-2009 till 20-Nov-2009 in Dallas, TX USA. Visit the the Ubuntu wiki for more information about UDS and how to participate remotely.

The Community Cafe
The Community Chat area is for lighthearted and enjoyable discussions, like you might find around a water cooler at work.

Almost any non-tech-support topic may be discussed here. Discussions on religion and politics are not allowed, except for politics directly related to free and open source issues. Any topic or discussion that causes problems or drama will be closed. This area is intended for fun and community building, not arguments. Please take those elsewhere. Thanks!

 
Thread Tools Display Modes
Old January 4th, 2008   #1
urukrama
Dark Roasted Ubuntu
 
urukrama's Avatar
 
Join Date: Jul 2006
Beans: 1,008
[SOLVED] How do I run a key press as a command?

I am not looking to assign commands to keyboard keys, but rather the other way round. I am looking for an application that allows me to run the pressing of a key on my keyboard as a command. In other words, that if I run command xyz it is the equivalent of pressing key a.

I've been looking for it on these and other Linux forums, and on Google, but haven't had much success yet. I hope it is possible, as every key has a unique code that could perhaps be simulated on the command line by a particular application.

Any suggestions anyone?
__________________
Openbox Guide | Blog
urukrama is offline   Reply With Quote
Old January 4th, 2008   #2
scizzo
Just Give Me the Beans!
 
scizzo's Avatar
 
Join Date: Dec 2007
Location: Sweden
Beans: 78
Ubuntu Jaunty Jackalope (testing)
Re: How do I run a key press as a command?

Sounds like you are trying to create a macro on the keyboard. So that for example: Ctrl+Alt+F1 is equivalent to Ctrl+F1

Am I right?

https://help.ubuntu.com/community/MultimediaKeys

that link might help?
scizzo is offline   Reply With Quote
Old January 4th, 2008   #3
urukrama
Dark Roasted Ubuntu
 
urukrama's Avatar
 
Join Date: Jul 2006
Beans: 1,008
Re: How do I run a key press as a command?

Quote:
Originally Posted by scizzo View Post
Am I right?
No. I want to use a command for a keypress, not a keypress for another keypress or command.
__________________
Openbox Guide | Blog
urukrama is offline   Reply With Quote
Old January 4th, 2008   #4
SoulinEther
Just Give Me the Beans!
 
SoulinEther's Avatar
 
Join Date: Jan 2007
Location: CA (Canada? I wish.)
Beans: 79
Xubuntu 7.10 Gutsy Gibbon
Re: How do I run a key press as a command?

I am screaming at my keyboard "NO! NO!" when I read scizzo's response.

I am looking for the EXACT same thing!! If you find it, I want to know about it!

Hey, just got a thought.... maybe we should look at the source code for the gnome on screen keyboard....

Edit: Looking at onboard's source... it's not very clear to me... it uses GDK...and some object oriented programming that I don't understand in python yet.
__________________
Cows go moo. Quite a concept, eh?

Last edited by SoulinEther; January 4th, 2008 at 11:33 PM..
SoulinEther is offline   Reply With Quote
Old January 5th, 2008   #5
Crashmaxx
A Carafe of Ubuntu
 
Crashmaxx's Avatar
 
Join Date: Apr 2006
Location: York College, PA
Beans: 116
Ubuntu 7.10 Gutsy Gibbon
Send a message via AIM to Crashmaxx Send a message via MSN to Crashmaxx Send a message via Yahoo to Crashmaxx
Re: How do I run a key press as a command?

Why do you need to output key presses? Why not just run the command you want from the command line? Or output the text you want if that is what you are trying to do?
Crashmaxx is offline   Reply With Quote
Old January 5th, 2008   #6
cwej
5 Cups of Ubuntu
 
cwej's Avatar
 
Join Date: Oct 2007
Location: Southern Maryland, USA
Beans: 33
Ubuntu 7.10 Gutsy Gibbon
Re: How do I run a key press as a command?

You want to trigger a keypress event, right? What programming language (makes a difference)? Does this link help? http://www5.experts-exchange.com/Pro..._20460831.html

Last edited by cwej; January 5th, 2008 at 12:46 AM.. Reason: clarity
cwej is offline   Reply With Quote
Old January 5th, 2008   #7
yabbadabbadont
Loony Lycanthrope
 
yabbadabbadont's Avatar
 
Join Date: Jul 2005
Beans: 6,863
Re: How do I run a key press as a command?

Is btnx what you are looking for?
yabbadabbadont is offline   Reply With Quote
Old January 5th, 2008   #8
Lostincyberspace
Ubuntu Extra Shot
 
Lostincyberspace's Avatar
 
Join Date: Aug 2007
Location: Torrington, Wyoming
Beans: 376
Ubuntu 8.10 Intrepid Ibex
Send a message via AIM to Lostincyberspace Send a message via MSN to Lostincyberspace Send a message via Yahoo to Lostincyberspace
Re: How do I run a key press as a command?

What are you using it for?
__________________
Quote:
すべてと、そして、すべてへのリナックスは自由を鳴らせました。
Linux to all, and to all, let freedom ring.
Lostincyberspace is offline   Reply With Quote
Old January 5th, 2008   #9
SoulinEther
Just Give Me the Beans!
 
SoulinEther's Avatar
 
Join Date: Jan 2007
Location: CA (Canada? I wish.)
Beans: 79
Xubuntu 7.10 Gutsy Gibbon
Re: How do I run a key press as a command?

K, well, for me... it's probably best that I don't use it to issue a keyboard command, but I just wanted it as a bandaid solution.

I want to make a new Xfce panel that displays the name of the active window (this part i have not figured out...), and provides functionality to close, minimize, restore, etc the active window.

Xfce's default shortcuts are like Alt+F5 to grow/shrink, Alt+F8 to minimize, etc..... Because I don't want to go through the hell of figuring out how to directly call for the minimizing of the current window, (though i'm sure it's closely related to finding out what the title of the active window is), I wanted this bandaid solution to just press Alt+F5 on launching a script or quick program.

I think it would involve the use of GDK, at least for GTK purposes....

Or does someone know how to make direct X event calls or whatever?
..

(and for that matter, on the side, preferrably in python, could someone help me with how to manipulate an active window ? lol.)

Thanks.
__________________
Cows go moo. Quite a concept, eh?
SoulinEther is offline   Reply With Quote
Old January 5th, 2008   #10
popch
Skinny Soy Caramel Ubuntu
 
Join Date: Jul 2007
My beans are hidden!
Ubuntu 8.04 Hardy Heron
Re: How do I run a key press as a command?

In that case I find the cure (simulating key strokes) worse than the ailment (wanting to manipulate a window), because I am sure that there must be an API do to just that.

However, I think there are solutions out there which do simulate keystrokes.
__________________
ch
In Switzerland we make it other
with apologies to Gerard Hoffnung

popch is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -4. The time now is 01:48 AM.


vBulletin ©2000 - 2009, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry