Comments (5)
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.
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.
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.
@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.
@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)
- Impossible to chain "open thunderbird" + "resize window" HOT 2
- xdotool mousemove does not work on fc38
- Random mistake with type command
- Trouble getting xdo_click_window() function to work
- xdotool will not launch on Mint 21.2 Cinnamon
- xdotool key Alt+Tab on Ubuntu, not switch app window
- xdotool sets _NET_WM_NAME as a STRING when it needs to be set as UTF8_STRING
- Extremely strange bug - see attached video. HOT 2
- Add various random timing capabilities
- [Feature] Ability to query and change desktop names
- [Feature] Search for windows that are unmapped or visible on all desktops HOT 1
- Latest xdotool version in Ubuntu 22 repos silently fails on Wayland :sob: apt can't upgrade it, and manual doesn't help HOT 2
- Segfault when running over an ssh connection
- set_desktop --relative does not work for -1 HOT 2
- XGetInputFocus returned the focused window of 1. This is likely a bug in the X server. HOT 1
- Search not seeing Steam Input On-Screen Keyboard HOT 7
- The character ":" is typed as "Q" in VM window HOT 1
- Xdotool works in Firefox but not Brave HOT 1
- behave_screen_edge only works with certain open windows
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from xdotool.