-
Notifications
You must be signed in to change notification settings - Fork 319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xdotool not working when invoked as a keyboard shortcut #210
Comments
+1 for redhat 7 |
+1 for manjaro deepin |
That is really strange. Do you know much about the program that manages the shortcuts? Hypothesis: It's possible From the X11 docs:
Examples which are working around this:
So what may be happening is this:
The timeing on each of the above events is likely only milliseconds apart, but if my hypothesis is correct, it explains why your So, my recommendation, try adding a short sleep.
This will cause xdotool to sleep for 100ms before sending the keystroke, and with the right timing (releasing Ctrl+E within 100ms of pressing it), this might work for you. Let me know? |
Thanks @jordansissel !!! That fixed it for me. I had the problem while trying to use xdotool in fvwm. Not sure I understand your explanation, though. In my case, I have the following in the fvwm configuration:
which is meant to remap alt+left/right to alt+prior/next (it is a workaround for a broken keyboard). But why is such a long sleep needed? What could fvwm possibly be doing during that time? Or is xdotool not meant to be used in this context? |
@jordansissel I seem to have had a similar problem, only my shortcut was
Seems to work well. |
@ainar-g thank you! That fixed me for me too. The previous fix I was using (inserting a short sleep) was working but not reliably. Your fix is working much better, and without the delay I was experiencing with the sleep. Thanks! |
@ainar-g - Are you saying you bound Alt+c to If that's it, then does it leave things in a weird state when you finally release the Alt+c? Would you want a |
@DiagonalArg Haven't noticed any weirdness, to be honest. Maybe because I unpress Alt+c very quickly. |
That solution worked for me as well for my purposes (lack of function keys) |
...and it works for me too! After hours of fighting (unfocused windows works, but focused does not), I find your solution (sleep). Thank you so much! |
For CentOS 8, neither approach works, be it relying on |
Just in case this might be useful to anyone who wants to configure shortcuts: |
I managed to find a good solution for my problem: So I mapped (in XFCE keyboard shortcuts settings): |
xdotool sleep 0.100 keydown Alt sleep 0.100 click 4 sleep 0.100 keyup Alt Not working on Linux Mint XFCE. |
can we reopen this? It is not fixed yet (perhaps it isn't even fixable). The proper workaround, as mentioned above, is to do a Problem also discussed recently here. |
For i3wm, using |
xdotool sleep 0.100 keydown Alt sleep 0.100 keydown 2 sleep 0.100 keyup Alt sleep 0.100 keyup 2 |
I have found that this is solvable from an application author's point of view (xdotool source or any other tool using libxdo.keys_up(the-grabbed-hotkey-that-triggered-this, delay: 0)
libxdo.type("hello") I now always do X11.display.grab_keyboard(root_win, owner_events: true, pointer_mode: X11::GrabModeAsync, keyboard_mode: X11::GrabModeAsync, time: X11::CurrentTime)
X11.display.ungrab_keyboard(time: X11::CurrentTime)
libxdo.type("hello") In other languages accordingly. So no more key UP like written by folks above, but a grab/ungrab (regardless of their return codes). Now I can also emulate proper key remapping logic with X11 tooling. I'll try this out an extended time now, but it seems like this is reliable and might be worth considering to add to libxdo directly? |
Hotkey + Send works together great now. ref jordansissel/xdotool#210 (comment), jordansissel/xdotool#406 (comment)
once again to fix jordansissel/xdotool#210
The previous approach (using sendKey) no longer works, because alacritty ignores X11 send_events. alacritty/alacritty#7893 In order to simulate the desired keys using xdotool, we need to first simulate a keyup of the key we actually pressed (c or v), then simulate keystroke of the key we've bound in alacritty.toml (Copy or Paste). jordansissel/xdotool#210
Under 'System Settings' > 'Keyboard' > 'Shortcuts' I have bound the command:
xdotool key --clearmodifiers End
to:Ctrl+E
But when I press the combination e.g. when I'm inside a text editor, nothing happens.
OS: Linux Mint 18
xdotool: v3.20150503.1
The text was updated successfully, but these errors were encountered: