Closed snippins closed 1 year ago
Hello,
I have noticed this problem too, for example you can't toggle uBlock for a site by keyboard and I think I have found the errors:
The Gui is always created with Gtk. Gtk seems to set override-redirect when you pass the window option accept_focus
, can_focus
or type_hint: tooltip
. It must be either of those because that's what Tooltip
windows have and they don't take away focus. (edit: no, it's actually the window type set to popup
at creation time) As for AHK, this would be Gui, +E0x8000000
as per WS_EX_NOACTIVATE = 0x08000000L
extended-window-styles / Gui, Options
"Unnamed ExStyle". I have to add this to AHK_X11 first where I'm currently working on other stuff, so it will take a few days to weeks.
Apart from that, currently even hotkey presses alone kill popup focus already such as f::Return
because we send an up
event on hotkey press because of https://github.com/jordansissel/xdotool/pull/406#issuecomment-1280013095, so I guess this hack needs to be done only when the first command is a Send
or SendRaw
...
tl;dr thanks for brining this up
FYI I have fixed both of these problems now (locally), finally. However, a third one appeard (yay!): The active window always loses its focus for the duration of any "grabbed" key being held down: https://stackoverflow.com/q/15270420. This is a global problem and has nothing to do with ahk_x11 as can be seen in the upvote ratio of the question. I will try out this workaround https://stackoverflow.com/questions/15270420/why-xgrabkey-generates-extra-focus-out-and-focus-in-events/69216578#69216578 another time, but it might introduce various new bugs so I need to test it out properly first. Thanks for your patience.
There is also the option of using non-grabbing hotkeys (in ahk notation: ~
prefix) so that the original function of the key is not caught/trapped and still recognized by the window. This is rather annoying though, e.g. if you have installed normal Vimium too then an ALTF keypress would trigger both vimiums. You could use another unused hotkey like F8 but that's not quite ergonomic :s
... and there's a fourth bug, running vimium-everywhere on a popup window crashes the entire program, but this will hopefully be a quick fix
Finally fixed! Would be great if you could test it out. https://github.com/phil294/vimium-everywhere/releases
Funnily enough, I posted that solution to stack overflow when writing a project for the same f
shortcut functionality. Cool to see it being used for the same thing!
@rpbritton cool, is that project open source? can you link it or the SO post?
NVM, I found it: https://github.com/rpbritton/goodnight-mouse
I'm really impressed!! I had searched for ages for something like this before starting my project. I will test yours out a bit, figure out the differences (including performance) and add it to the README.
I can invoke extension buttons using vimium-everywhere to open their corresponding popup windows, but try invoke vimium-everywhere again would make the Firefox window lose focus and close the windows.
A possible x11 solution is to create the overlay window with override-redirect flag, so that window managers won't manage the window, thus there is no focus changes and the popup stays open. However, I don't really know how to do that using the ahk scripting language. https://tronche.com/gui/x/xlib/window/attributes/override-redirect.html