0

Based on this :

#!/bin/bash

set -x
exec &>/tmp/log

id=$(
    xinput list |
        awk '/Dell USB Keyboard/{print gensub(/.*id=([0-9]+).*/, "\\1", "1")}'
)
xdotool mousedown $1
while IFS= read -r event; do
    if [[ $event == *release* ]]; then
        xdotool mouseup $1
        exit
    fi
done < <(xinput test $id)

This works very well under Debian9 and Cinnamon 3.2.7, but not under Archlinux X86_64 + xfce 4.12.

My tests

The log when I press F1 key to drag & drop the border of a GUI application :

press :

+xinput list
+awk '/Dell USB Keyboard/{print gensub(/.*id=([0-9]+).*/, "\\1", "1")}'
+id=10
+xdotool mousedown 1   # executed, but no action !
+IFS=
+read -r event
+xinput test 10

release key :

+[[ key release 67  == *release* ]]
+xdotool mouseup 1
+exit

The code is ran from xfce4 keyboard shortcuts configuration panel.

What is wrong ?

If I remove code and keep only

xdotool mousedown 1

I can drag & drop ! (but can't release it)

Any idea what's going bad?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.