Xdotool Commands Bound to Key Shortcuts Doesnot Work

xdotool commands bound to key shortcuts doesnot work

I had this same issue, and I realized that you have to tell xdotool to send keyup events for the keys in your keybindings. So for example:

bindsym h exec "xdotool keyup h; xdotool key"

Do that for every binding and I think it will work.

xdotool wont work in i3wm when bound to a key

Your script and i3wm keybinding all look correct. It's strange. When I put sleep 1 before executing bash script. It suddenly works...

bindsym --release $mod+p exec "sleep1; ~/bin/pop_mpv.sh"

How to make xdotool work with matchbow-window-manager?

I got it to work. I eventually found this tutorial and used some ideas from it. I'll post the solutions for the people who may have a similar problem.

This is what i placed in the /home/pi/.xinitrc file:

#!/bin/sh
xset -dpms
xset s off
xset s noblank

// not sure if this is needed.
killall -TERM matchbox-window-manager 2>/dev/null;
killall -9 matchbox-window-manager 2>/dev/null;

exec matchbox-window-manager -use_titlebar no &
iceweasel [someURL] &
sudo /etc/xdo_test.sh

I changed the python script to a shell script an inserted the following code:

sleep 20
$WIN=$(xdotool search --onlyvisible --class Iceweasel|head -1)
xdotool key --window $WIN c

while:
do
sleep 300
done

The while loop at the end is something I added because Xserver crashed from the moment it lost connection to the script. I'm still looking for a cleaner solution to end the script but this works for now. I'll update this awnser when I find one.

Thanks Sebastian Stigler for the help!

Using Fn for shortcuts on OS X impossible?

pqrs.org's Karabiner [formerly known as KeyRemap4MacBook] will let you do this.

key+mouse click simultaneous (xdotool)

In new versions you can do

xdotool keydown N click 1 keyup N

In older versions you can do as you edited:

xdotool keydown N
xdotool click 1
xdotool keyup N

How to send a shortcut by bash to a program?

Now found the bug on bug tracker:

  • https://github.com/jordansissel/xdotool/issues/340

Found the follow bug reason:

"The fact that xdotool doesn't seem to work is probably related to applications detecting and discarding synthesized events:

Sending keystrokes to a specific window uses a different API than simply typing to the active window.

[...]

Many programs observe this flag and reject these events."

Source: Automatic web-page refresh using xdotool - not sending key after window focus

Found the follow solution:

"With that in mind I was able to make it work with the series of commands below. This reloads both Chromium and Firefox.

cwid=$(xdotool getwindowfocus) # Save the current window
twid=$(xdotool search --name somename)
xdotool windowactivate $twid
sleep 0.1 # The key event might be sent before the window has been fully activated
xdotool key --window $twid F5
xdotool windowactivate $cwid # Done, now go back to where we were

"
Source: Automatic web-page refresh using xdotool - not sending key after window focus



Related Topics



Leave a reply



Submit