Closed phil294 closed 2 years ago
That makes sense to me; feel free to submit a PR with those new APIs.
Just to clarify: is CURRENTWINDOW
a constant/macro provided by libxdo
? If so we should reuse it. I'm a little bit surprised that 0
means "current window" however, since normally that means "root window" in X11 contexts. But who knows!
Just to clarify: is CURRENTWINDOW a constant/macro provided by libxdo?
Yes, it's just a plain #define
. From here by the author:
... I think it's worth noting that doing key --window 0 a will send 'a' to the current window -- I don't know if this is documented, though. There's a special window value xdo uses for knowing when to act on the "current window" and that is 0.
I'll create a PR some time later.
In #10, I mentioned having issues with things like
win.activate!
andtype
. The former was actually my bad, I needed to useraise!()
instead, as bothactivate!
andfocus!
seem to be ignored by Xfwm when the window is minimized.However, typing keys can sometimes fail, even when the window is focussed where it works in xdotool. For example, the editor Mousepad never receives anything when you do
active_window.type "abc"
, even when the window is active. It's a bit more complicated unfortunately, with it being the difference betweenXSendEvent
andXTestFakeKeyEvent
; when the window is active, it should actually fall back to XTest but it doesn't, somehow: https://github.com/jordansissel/xdotool/pull/85#issuecomment-1193615057 <- This not working PR fix is was added on the last day before the previous release, so it's present in both the 2016 and 2021 version.Normal
xdotool
without specifying a--window
will always use XTest, but x_do.cr only ever goes the XSend route. This can be solved by specifyingCURRENTWINDOW
(which is0
) as window instead which xdotool understands as "use XTest to the active window".So maybe we should add new functions inside the
x_do.cr
file such asso you can
which will work fine like xdotool does. This means that the send and key functions all have to be duplicated and such