Page 1 of 3 123 LastLast
Results 1 to 10 of 32

Thread: [SOLVED] How do I run a key press as a command?

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Beans
    1,152

    [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?

  2. #2
    Join Date
    Dec 2007
    Location
    Sweden
    Beans
    77
    Distro
    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?

  3. #3
    Join Date
    Jul 2006
    Beans
    1,152

    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.

  4. #4
    Join Date
    Jan 2007
    Location
    CA (Canada? I wish.)
    Beans
    79
    Distro
    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.
    Last edited by SoulinEther; January 5th, 2008 at 04:33 AM.
    Cows go moo. Quite a concept, eh?

  5. #5
    Join Date
    Apr 2006
    Location
    York College, PA
    Beans
    116
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    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?

  6. #6
    Join Date
    Jul 2007
    Location
    Magic City of the Plains
    Beans
    Hidden!
    Distro
    Xubuntu Development Release

    Re: How do I run a key press as a command?

    Ancient thread closed.

  7. #7
    Join Date
    Oct 2007
    Location
    Southern Maryland, USA
    Beans
    33
    Distro
    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 05:46 AM. Reason: clarity

  8. #8
    Join Date
    Jul 2005
    Location
    2 exits past crazy
    Beans
    4,222
    Distro
    Lubuntu 12.10 Quantal Quetzal

    Re: How do I run a key press as a command?

    Is btnx what you are looking for?

  9. #9
    Join Date
    Aug 2007
    Location
    Torrington, Wyoming
    Beans
    372
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: How do I run a key press as a command?

    What are you using it for?
    すべてと、そして、すべてへのリナックスは自由を鳴らせました。
    Linux to all, and to all, let freedom ring.

  10. #10
    Join Date
    Jan 2007
    Location
    CA (Canada? I wish.)
    Beans
    79
    Distro
    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?

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •