keyboardwindow-managersxdotooli3

xdotool wont work in i3wm when bound to a key


I have made a script where it uses xdotool to do some keyboard inputs.
You can find the script here (The script is called pop_mpv.sh).

The script works perfectly when I run it from a terminal, but it does not work properly when I have the script bound to a key.

This is what I put into my i3 config:

bindsym --release $mod+p exec bash ~/bin/pop_mpv.sh

According to the i3wm user guide, I have to use --release because I am using xdotool. https://i3wm.org/docs/userguide.html#keybindings

I tried what suggested in this question, but it did not work.

EDIT I forgot to add to script that you need xclip for it run


Solution

  • 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"