You are not logged in.

#1 2019-02-04 23:47:42

Mévatlavé
Member
Registered: 2019-02-04
Posts: 1

Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

Hi,

I try to click with F1 keyboard key because of finger injury, it works well with cinnamon/Debian9 but not with xfce4 and Archlinux X86_64.

I use code from here.

The code :

#!/bin/bash

set -x
exec &>/tmp/log

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

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)

Last edited by Mévatlavé (2019-02-05 00:14:15)

Offline

#2 2019-02-13 21:49:52

teckk
Member
Registered: 2013-02-21
Posts: 309

Re: Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

Are you trying to move stuff around without the mouse?

If you want to move the mouse curser with xdotool (15 pxl)

up
xdotool mousemove_relative -- 0 -15
down
xdotool mousemove_relative 0 15
right
xdotool mousemove_relative 15 0
left
xdotool mousemove_relative -- -15 0

Click the mouse buttons

xdotool click 1
xdotool click 3
xdotool click 2

Move a window around, try these

xdotool getactivewindow windowmove x 0
xdotool getactivewindow windowmove 10 10
xdotool getactivewindow windowmove --relative 0 -100
xdotool getactivewindow windowmove --relative 0 30
xdotool getactivewindow windowmove --relative -- -30 0
xdotool getactivewindow windowmove --relative -- 30 -30

Simple shell demo

while :; do
    for i in {1..300..10}; do
        xdotool getactivewindow windowmove "$i" "$i"
        sleep .1
    done

    for i in {300..500..10}; do
        xdotool getactivewindow windowmove "$i" 300
        sleep .1
    done

    for i in {300..10..10}; do
        xdotool getactivewindow windowmove 500 "$i"
        sleep .1
    done

    for i in {500..10..10}; do
        xdotool getactivewindow windowmove "$i" 10
        sleep .1
    done
done

Offline

#3 2019-02-13 21:58:10

sputnick
Member
From: Near Paris
Registered: 2009-05-27
Posts: 40

Re: Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

Thanks, but what I try to do is not to move mouse cursor programmaticaly but by moving the mouse and F1 press.

Because of a finger injury, I can't press with my index finger the left clicks

Last edited by sputnick (2019-02-13 21:59:50)

Offline

#4 2019-02-13 22:34:00

N_BaH
Member
Registered: 2015-12-30
Posts: 52

Re: Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

and you've got only one hand with a single injured finger ?

Last edited by N_BaH (2019-02-13 22:34:25)

Offline

#5 2019-02-13 23:39:20

sputnick
Member
From: Near Paris
Registered: 2009-05-27
Posts: 40

Re: Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

Both.

I just try to figure how to map left click on F1 key, I'm pretty sure it's possible.

I don't want to use mouse on left hand, index finger have the same injury smile

Offline

#6 2019-02-14 12:33:56

izmvpt
Member
Registered: 2019-02-14
Posts: 1

Re: Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

Can't you just bind the command: "xdotool click 1" to a key from the keyboard options?

PS: But then you wouldn't be able to drag and drop, sorry I didn't read properly. I will give it another thought.

Last edited by izmvpt (2019-02-14 12:39:43)

Offline

#7 2019-02-14 14:45:54

teckk
Member
Registered: 2013-02-21
Posts: 309

Re: Why this script don't work with Archlinux x86_64 & xfce 4.12 ?

This worked for me.
This gave me a mouse down for 3 secs then mouse up.
I was able to drag/resize a window for 3 secs and then mouse up.

xdotool mousedown 1; sleep 3; xdotool mouseup 1

So...I made an entry in my ~/.fluxbox/keys file.

F1 :Exec (xdotool mousedown 1; sleep 3; xdotool mouseup 1)

I could then position the mouse curser on the corner of the window,
press F1, resize the window back and forth for 3 seconds,
then mouse up.

For moving a window, if I placed the mouse curser on the window
header and then pressed F1, I could move the window but never got a
mouse up. Which is why I suggested post #2 for moving windows.

You should be able to do what you want to do from that.

Launch xterm when the curser is moved to the far left of the screen

xdotool behave_screen_edge --quiesce 750 left exec xterm

Then if you want to close a window/ right click on a menu/ open a link/ ect.. Put your mouse curser on the item and

xdotool click 1
xdotool click 3
xdotool click 2

I'll let you figure out your own window manager. I can do all of that
in fluxbox without xdotool

# Use arrow keys to move-resize.
# Window resize, all except arrow keys disabled. Escape to exit.
Control Mod4 r              :KeyMode ResizeMode
ResizeMode: None Up         :ResizeVertical -8
ResizeMode: None Down       :ResizeVertical +8
ResizeMode: None Left       :ResizeHorizontal -8
ResizeMode: None Right      :ResizeHorizontal +8

# Window move, all except arrow keys disabled. Escape to exit.
Control Mod4 m              :KeyMode MoveMode
MoveMode: None Up           :MoveUp 20
MoveMode: None Down         :MoveDown 20
MoveMode: None Left         :MoveLeft 20
MoveMode: None Right        :MoveRight 20

#Resize on focused window
Mod1 Up :Resize -5% -5%
Mod1 Down :Resize 6% 6%

.........etc

Last edited by teckk (2019-02-14 14:47:50)

Offline

Board footer

Powered by FluxBB