Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Scrot supports capturing a portion of the screen by
allowing the user to use the -s option. I need to
use the command line.
So I installed xdotool to allow me from the command line
to move my mouse, click buttons, type text, select my
I also built a bash script that uses scrot and xdotool
that allows me to select the window that has a firefox
web page displayed. Then I can position the mouse and
do a right button click to position to a data entry box
on the web page. Then I can use xdotool type "my text"
to input the text into the input box. All this works
My problem is the following:
The command "xdotool mousemove x y" does not move relative
to the top left hand corner of the focused window. The command
moves to the absolute x y screen location, not the relative window location.
This happens even though I use the command "xdotool windowfocus
windowid" or command "xdotool windowactivate windowid" to specify
which window I want to use (want in focus).
Does anybody know how to specify that the
"xdotool mousemove x y" is
to move relative to the upper left hand
corner of the currently
in focus window?
By the way, here is my bash script:
# get window id
WIN_ID=`xdotool search --title MyWindow`
# activate window with title MyWindow
xdotool windowactivate $WIN_ID
# move to x, y location -- this is an absolute screen location move
xdotool mousemove $1 $2
# how does one do a relative location move based on focused window?
# do a left button click
xdotool click 1
# type out desired text in $3
xdotool type "$3" && xdotool key Return && sleep 0.2
If you are trying to send key input to a specific window, and it does not appear to be working, then it's likely your application is ignoring the events xdotool is generating. This is fairly common.
Sending keystrokes to a specific window uses a different API than simply typing to the active window. If you specify 'xdotool type --window 12345 hello' xdotool will generate key events and send them directly to window 12345. However, X11 servers will set a special flag on all events generated in this way (see XEvent.xany.send_event in X11's manual). Many programs observe this flag and reject these events.
Some programs can be configured to accept events even if they are generated by xdotool. Seek the documentation of your application for help.
Specific application notes (from the author's testing): * Firefox 3 seems to ignore all input when it does not have focus. * xterm can be configured while running with ctrl+leftclick, 'Allow SendEvents' * gnome-terminal appears to accept generated input by default.