Giter VIP home page Giter VIP logo

Comments (5)

FascinatedBox avatar FascinatedBox commented on June 26, 2024

A couple questions come to mind:

  • How are you finding this window? By name? Id? Classname? Class?
  • Can you paste the result of xprop on the window you're trying to send keys to.

from xdotool.

cepamoi avatar cepamoi commented on June 26, 2024

I find the window for example with the PID (xdotool search --pid XYZ).
The window ID is most probably correct because sending normal keys/chars works fine.
Only sending key combinations or function keys does not work.

Below is the output of xprop:

_NET_WM_USER_TIME(CARDINAL) = 0
_NET_WM_ICON_GEOMETRY(CARDINAL) = 443, 2104, 64, 56
_NET_WM_ALLOWED_ACTIONS(ATOM) = _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_MINIMIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE
_KDE_NET_WM_FRAME_STRUT(CARDINAL) = 0, 0, 41, 0
_NET_FRAME_EXTENTS(CARDINAL) = 0, 0, 41, 0
_NET_WM_DESKTOP(CARDINAL) = 0
_KDE_NET_WM_ACTIVITIES(STRING) = "69948556-27b6-40d0-a20c-9ff567d66f7d"
WM_STATE(WM_STATE):
window state: Normal
icon window: 0x0
_NET_WM_STATE(ATOM) =
_NET_WM_ICON_NAME(UTF8_STRING) =
XdndAware(ATOM) = BITMAP
WM_NAME(STRING) = "untitled.txt*"
_NET_WM_NAME(UTF8_STRING) = "untitled.txt*"
_KDE_NET_WM_USER_CREATION_TIME(CARDINAL) = 30992558
_MOTIF_WM_HINTS(_MOTIF_WM_HINTS) = 0x3, 0x3e, 0x7e, 0x0, 0x0
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_XEMBED_INFO(_XEMBED_INFO) = 0x0, 0x1
WM_CLIENT_LEADER(WINDOW): window id # 0x5000008
WM_HINTS(WM_HINTS):
Client accepts input or input focus: True
window id # of group leader: 0x5000008
WM_CLIENT_MACHINE(STRING) = "kobaia"
_NET_WM_PID(CARDINAL) = 69546
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 83886087
WM_CLASS(STRING) = "application", "Application Example"
WM_PROTOCOLS(ATOM): protocols WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_NORMAL_HINTS(WM_SIZE_HINTS):
user specified location: 908, 494
user specified size: 1364 by 785
program specified minimum size: 252 by 279
program specified resize increment: 2 by 2
program specified base size: 0 by 0
window gravity: Static

from xdotool.

FascinatedBox avatar FascinatedBox commented on June 26, 2024

You're definitely hitting the right window. Suppose you go into xdo.c, specifically _xdo_send_key, and do this:

-  int use_xtest = 0;

-  if (window == CURRENTWINDOW) {
-    use_xtest = 1;
-  } else {
-    Window focuswin = 0;
-    xdo_get_focused_window(xdo, &focuswin);
-    if (focuswin == window) {
-      use_xtest = 1;
-    }
-  }

+  int use_xtest = 1;

On my system, the non-xtest path doesn't even show keycodes being sent to the application. I can tell because I'm having xev watch the window, and it's getting straight nada. The xtest path, however, results in the app seeing keypresses and they don't show up as synthetic. The latter being particularly important because some applications will straight up ignore synthetic keys.

That is, unfortunately, my only guess for it.

from xdotool.

jordansissel avatar jordansissel commented on June 26, 2024

@FascinatedBox If you want to explicitly use XTEST, you shouldn't need to patch xdotool. Instead, setting the window to 0 should suffice with most commands supporting this via --window 0 which will override anything in the window stack (from previous commands) and set it back to the default. (I don't think this is documented, though, and may be something to improve in the docs at some point)

from xdotool.

cepamoi avatar cepamoi commented on June 26, 2024

@FascinatedBox
I tried to patch the code as you suggested. But the key I send is just entered in my terminal instead of the requested window.

@jordansissel
I tried the following command line:
xdotool windowfocus 60817414 key --window 0 ctrl+o
But this does not work neither: the window gets the focus as expected, but the key combination is not sent.

But maybe I did something wrong. Any idea?
Thanks.

from xdotool.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.