LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 01-23-2021, 12:14 PM   #1
PaulExordium
Member
 
Registered: Dec 2020
Distribution: Debian, Tails, Kodachi, Mint DE
Posts: 92

Rep: Reputation: Disabled
Programmatically moving the mouse with the "xdotool"


After opening a "Mozilla Firefox" window, executing the following script will move the mouse correctly under Debian 9 but not under Debian 10. Any idea why?

Code:
#!/bin/bash

winID=$(xdotool search --name "Mozilla Firefox")
echo $winID
xdotool getwindowname $winID

let x=1
let y=175
let i=1
let j=-1

for (( t=1; t<400; t++ ));
  do
    if [ $t -eq 100 ]; then let j=-$j; fi
    if [ $t -eq 200 ]; then let i=-$i; fi
    if [ $t -eq 300 ]; then let j=-$j; fi

    let x=x+i
    let y=y+j

    xdotool mousemove --sync --window $winID $x $y
  done

exit
 
Old 01-23-2021, 12:34 PM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
you need to check the variables, which one behave differently.
Probably try (for debugging): set -xv
 
Old 01-24-2021, 01:55 AM   #3
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by PaulExordium View Post
After opening a "Mozilla Firefox" window, executing the following script will move the mouse correctly under Debian 9 but not under Debian 10. Any idea why?
What is this script supposed to do? Did you write it? To what purpose?
 
Old 01-24-2021, 10:08 AM   #4
PaulExordium
Member
 
Registered: Dec 2020
Distribution: Debian, Tails, Kodachi, Mint DE
Posts: 92

Original Poster
Rep: Reputation: Disabled
pan64,
thank you for your debugging suggestion, but the variables values are exactly the same on both OS.

It turns out that I didn't have the correct version of "xdotool" on Debian 10. See below.

Code:
Debian 9:
  xdotool_3.20160805.1-3_amd64.deb  

Debian 10:
  xdotool_3.20160805.1-4_amd64.deb
 
Old 01-24-2021, 11:51 AM   #5
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
But they are both at the same version. The only different part is the Debian release, and the changelog doesn't show anything relevant:
Code:
$ apt-get changelog xdotool=1:3.20160805.1-4|sed '/^ --/Q'
Get:1 https://changelogs.ubuntu.com xdotool 1:3.20160805.1-4 Changelog [12,2 kB]
xdotool (1:3.20160805.1-4) unstable; urgency=medium

  * use dep-14 branch names
  * use github for Homepage: and salsa for Vcs-*
  * bump Standards-Version to 4.1.4 (priority: extra → optional)
  * move to debhelper 11
  * d/changelog: remove trailing whitespace
  * -dbg→-dbgsym migration is completed
  * use debian/clean instead of override_dh_clean

Last edited by shruggy; 01-24-2021 at 11:55 AM.
 
Old 01-26-2021, 04:36 PM   #6
PaulExordium
Member
 
Registered: Dec 2020
Distribution: Debian, Tails, Kodachi, Mint DE
Posts: 92

Original Poster
Rep: Reputation: Disabled
shruggy,
you are correct. It is not the version that matters in this case.

To install the new version I used "Synaptic" utility, which under Debian 10 requires the disabling of "Wayland" to install a package. I didn't re-enabled "Wayland" before testing and that led me to the incorrect conclusion.

Without "Wayland" the functions of "xdotool" work properly.
 
Old 01-27-2021, 01:21 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by PaulExordium View Post
Without "Wayland" the functions of "xdotool" work properly.
xdotool is an application that works only under Xorg.
Wayland is a different GUI altogether.

Your comments about wayland & synaptic sound like you only half understand what that means.
Maybe read these:
https://wiki.debian.org/Wayland
https://wiki.debian.org/Xorg
 
Old 01-27-2021, 03:56 PM   #8
PaulExordium
Member
 
Registered: Dec 2020
Distribution: Debian, Tails, Kodachi, Mint DE
Posts: 92

Original Poster
Rep: Reputation: Disabled
ondoho,
thank you for the links you suggested. You are right I have a lot to learn about the vast complexity of a Linux system. That's in part why I am on this site.

What I really would like do to is to programmatically move the mouse in a Debian 10 Live system, similarily to what I was able to do with Tails 4.15 and Debian 9.9 Live.

If "xdotool" is not possible to use in a Debian 10 Live system because of the default configurations, what other tool could you suggest to move the mouse?
 
Old 01-28-2021, 12:51 AM   #9
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by PaulExordium View Post
I have a lot to learn about the vast complexity of a Linux system.
"Vast" is an exaggeration, and you don't need to know all of it anyhow, just get a basic overview of its structure - and more importantly: learn how to research things you don't know.

Quote:
Originally Posted by PaulExordium View Post
If "xdotool" is not possible to use in a Debian 10 Live system
First of all you should ascertain whether that system runs under wayland or Xorg, I'm not so sure about your conclusion:
https://unix.stackexchange.com/quest...-is-being-used
Which Debian Live image are you using? Link please.
 
Old 01-28-2021, 06:13 AM   #10
PaulExordium
Member
 
Registered: Dec 2020
Distribution: Debian, Tails, Kodachi, Mint DE
Posts: 92

Original Poster
Rep: Reputation: Disabled
ondoho,
I had already ascertained that the live OS system (debian-live-10.7.0-amd64-gnome.iso) run under wayland, the default setting. So I reiterate my question: is there another tool that could be used to move the mouse?
 
Old 01-28-2021, 12:39 PM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
https://duckduckgo.com/?q=xdotool+wayland
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] xdotool Error: Can't open display: (null) tonj Linux - Software 1 12-26-2014 06:27 AM
xdotool - intercept keystroke for only one window class. Vryali Linux - Newbie 0 07-27-2012 12:07 PM
xdotool, XSendEvent or something like them jovie Linux - Software 1 01-09-2012 10:06 AM
LXer: Trigger keyboard and mouse actions with your voice and xdotool LXer Syndicated Linux News 0 09-06-2011 02:10 AM
how to send with xdotool a window to another Desktop X number? frenchn00b Linux - General 1 10-23-2009 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 03:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration