I want my window to be invisible most of the time, but get to top of
the screen on hotkey and hide again if the user switches to another
application.
In my hotkey handler I use
self.Show()
self.Raise()
self.Iconize(False)
and in my activate message handler
self.Hide()
self.Iconize(True)
but the window pops up on top of the screen, but remains deactivated:
it's title bar colour is a inactive one, and it flashes in the taskbar
as a window requiring my attention and it doesn't get EVT_ACTIVATE. I
tried to add self.SetFocus, but no effect.
I have altered the code
hotkey handler
self.Show()
self.SetFocus()
and in my activate message handler
self.Hide()
and it works okay if I deactivate my window by clicking to another
window, but if I press Alt-Tab and then invoke my window with a hotkey
it doesn't appear on top of the screen but just flashes in the
taskbar. Also I made an ability to hide it by pressing a button on it,
and if I hide it this way, it also doesn't show correctly afterwards
as in the case with Alt-Tab
Try to call self.Raise() too in the handler.
Conrado
···
On Sat, Jun 6, 2009 at 16:29, netimen<netimen@gmail.com> wrote:
I have altered the code
hotkey handler
self.Show()
self.SetFocus()
and in my activate message handler
self.Hide()
and it works okay if I deactivate my window by clicking to another
window, but if I press Alt-Tab and then invoke my window with a hotkey
it doesn't appear on top of the screen but just flashes in the
taskbar. Also I made an ability to hide it by pressing a button on it,
and if I hide it this way, it also doesn't show correctly afterwards
as in the case with Alt-Tab
oh, sorry, stupid of me. Of course I do it, I simply forgot to quote
it in my post. But it doesn't help
···
On 6 июн, 23:37, Conrado Porto Lopes Gouvêa <conrado...@gmail.com> wrote:
On Sat, Jun 6, 2009 at 16:29, netimen<neti...@gmail.com> wrote:
> I have altered the code
> hotkey handler
> self.Show()
> self.SetFocus()
> and in my activate message handler
> self.Hide()
> and it works okay if I deactivate my window by clicking to another
> window, but if I press Alt-Tab and then invoke my window with a hotkey
> it doesn't appear on top of the screen but just flashes in the
> taskbar. Also I made an ability to hide it by pressing a button on it,
> and if I hide it this way, it also doesn't show correctly afterwards
> as in the case with Alt-Tab
Try to call self.Raise() too in the handler.
Conrado
I see...
There's another thing that you should consider. The program should
never "steal" the focus from the program the user is working with (say
you're filling some form, then a program steals the focus, and you end
up typing there instead). Of course, in your scenario, the focus
stealing is legitimate, since the user chose to raise the application
through the hotkey. The problem is, the window manager may not know
that!
On Windows it's easy to implement hotkeys (
RegisterHotKey - wxPyWiki ). Since you register the
hotkey with Windows, when you press the hotkey it lets the application
steal the focus. If you did something similar to you approach, i.e
registering a global listener for key presses, and calling
self.Raise() when the hotkey were pressed, the application would only
flash on the taskbar and would not be able to steal the focus.
On Linux, I don't know if it's possible to make the window manager
aware of the hotkey. Check this post:
http://blogs.gnome.org/metacity/2007/12/24/stacking/
If you find anything please post here, since I'm interested in this too 
Conrado
···
On Sat, Jun 6, 2009 at 16:52, netimen<netimen@gmail.com> wrote:
oh, sorry, stupid of me. Of course I do it, I simply forgot to quote
it in my post. But it doesn't help
Thank you, but I know many applications, who can do this: yakuake —
KDE terminal emulator pops up on F12 and hides on losing focus —
exactly what I needed.
My hotkey is implemented through xlib, and I'm afraid window manager
doesn't know about it.
Certainly it can be done... I've downloaded the yakuake sources, dig
around a little and found that it registers the global hotkey within
KDE:
http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKAction.html#84b70169c75007569613ba14eb7d2ed7
Of course, wxPython is based on GTK so I guess this doesn't help much.
I'd suggest you to search for GTK related stuff on global hotkeys. I
think it's possible to register one with gconf.
Conrado
···
On Sat, Jun 6, 2009 at 19:29, netimen<netimen@gmail.com> wrote:
Thank you, but I know many applications, who can do this: yakuake —
KDE terminal emulator pops up on F12 and hides on losing focus —
exactly what I needed.
Thank you, I'll try. I'm sure this is possible, because there is tilda
— gnome yakuake analog )
···
On 7 июн, 02:55, Conrado Porto Lopes Gouvêa <conrado...@gmail.com> wrote:
On Sat, Jun 6, 2009 at 19:29, netimen<neti...@gmail.com> wrote:
> Thank you, but I know many applications, who can do this: yakuake —
> KDE terminal emulator pops up on F12 and hides on losing focus —
> exactly what I needed.
Certainly it can be done... I've downloaded the yakuake sources, dig
around a little and found that it registers the global hotkey within
KDE:http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKAction.ht…
Of course, wxPython is based on GTK so I guess this doesn't help much.
I'd suggest you to search for GTK related stuff on global hotkeys. I
think it's possible to register one with gconf.
Conrado