Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Perl/TK KeyPress/Release minimized

by ldln (Pilgrim)
on Mar 23, 2008 at 00:00 UTC ( [id://675701]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl/TK KeyPress/Release minimized
in thread Perl/TK KeyPress/Release minimized

Zentara, I think he was after a global hotkey, which works regardless of which app has focus. AFAIK there is no uniform way of doing this on linux, it depends on the window manager in use.
  • Comment on Re^2: Perl/TK KeyPress/Release minimized

Replies are listed 'Best First'.
Re^3: Perl/TK KeyPress/Release minimized
by Anonymous Monk on Mar 24, 2008 at 14:46 UTC
    Zentara, Thank you for the example. It doesn't quite do the trick though. I need something that allows me to open another application even when this is running and your example does not seem to allow this. Let me explain exactly what I'm trying to do: I have a Pan/Tilt/Zoom camera control application built with Perl/Tk. I need to use it with a web browser opened to a webcam site. Everything works very well except that when the control application looses focus, the bindings to the keys (up, down, left, right arrows) stop working until the application gets focus again. A hotkey won't work either unless I change my application to run as a daemon so it can listen to external commands as far as I can tell. I don't want more that one application to run as I'd like to keep it simple and easily portable to other machines.
      I don't know how you could do what you want. You seem to want to override the basic window focus mechanism. You essentially would be creating a keystroke logger. I just saw PyKeyLogger I was wondering how to convert that to Perl?

      The best solution is to build a single app, that incorporates the browser view and the pan controls... see embedding Dillo Html browser in a Tk app. I havn't had much luck with it, but Gtk2 has a MozEmbed library, which supposedly lets you embed applications with Mozilla. This is where Java has a great advantage over Perl, with it's java brower plugin. Maybe switch to java, or write a Flash program that can be run in the browser?

      Another suggestion is google for "xbindkeys", and setup a daemon to intercept the keys, or google for "xvkdb"... the X virtual keyboard.

      Is it possible to use the "tab focus shift" mechanism (or whatever your window manger uses to shift focus by the keyboard) to toggle focus between the browser and Tk app?

      Is it really that hard to move the mouse back and forth between the browser and Tk window? There are ways to keep the Tk window "on top" if your window manager hides it when out of focus.


      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
        I found a .c program that will listen and react to the KeyPress and KeyRelease events in the background and I guess I can make it work with a Perl daemon, but it seems so simple that I wish Perl/tk could handle it. I really need it to work the way I described so that it can be used with a lot of different web based camera applications.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://675701]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-18 23:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found