Questions tagged [xdotool]

a command line tool that can simulate X11 keyboard input and mouse activity and manipulate windows

Filter by
Sorted by
Tagged with
28
votes
1answer
13k views

What are the differences between xdotool and xautomation?

xdotool and xautomation are two command line X11 automation tools. I've used the former for a while and only recently found out about the existence of the latter, and I'm curious to know what someone ...
14
votes
4answers
34k views

xdotool: How to search for window by title and class with different patterns (similar to AutoHotkey)

xdotool lets you search for windows using its search subcommand. I need to locate a window, that has class 'gvim' and title containing word 'TODO'. How do I do this? What I've tried: You can do ...
13
votes
2answers
25k views

How to get window id from xdotool Window Stack

I need id of window which is active or focused. I try to use xdotool command. There is command: xdotool getactivewindow the result is saved to window stack. I want to get widnow id from this window ...
11
votes
3answers
32k views

How to get window ID from process ID

This command will get the PID of the xterm process launched: xterm & export APP_PID=$! How can I get the window ID associated to that process (the xterm window ID)? I mean, the ID that xdotool ...
11
votes
1answer
11k views

`xdotool` does not send keys

I am trying to send keystrokes via xdotool. However, sending does not work properly. Below is the log of a script that should select all the text in Gedit and copy it (but it does nothing instead), ...
11
votes
2answers
7k views

How to copy text from command line to clipboard without using the mouse?

I'm trying to figure out a way to copy the current text in a command line to the clipboard WITHOUT touching the mouse. In other words, I need to select the text with the keyboard only. I found a half-...
10
votes
2answers
9k views

Can I simulate mouse movements via terminal without xdotool?

I would like to write a script to prevent a computer from locking by virtually wiggling the mouse. However, I do not have xdotool on the computer that I am using, and I cannot install since I am not ...
10
votes
2answers
5k views

Keyboard emulation in Wayland

Is there a way to make xdotool or xte or any other alternative to work in Fedora 26? I'm trying to emulate keypresses (using xbindkeys), e.g. pressing Alt+B would emulate pressing Ctrl+Shift+B. But ...
8
votes
1answer
12k views

How can I press the Windows key with xdotool

How can I press the start key with xdotool? By start key, I mean the key with the Windows icon.
8
votes
3answers
6k views

How can I automate window tiling with a custom width? (Cinnamon)

I am running Linux Mint 17 Cinnamon 2.4.8. I really like xdotool, but it conflicts with Cinnamon's awesome snapping/tiling feature. If I run the following command, it does NOT work if the current ...
7
votes
1answer
4k views

Run program on a key press without interupting the key event

Is it possible to bind a (global) key press to some command and still not disrupt the key press from completing? What I mean is, if I try the bindkey solution posted elsewhere here: # In file: ~/....
7
votes
1answer
6k views

emulate key-combination with xdotool

I am using Xephyr as a nested X server. When I am in Xephyr window and pres the key combination Control_L+Shift_L, Xephyr grabs my input (mouse, keyboard). This grab can be released with Control_R+...
7
votes
1answer
3k views

Resizing a maximized window from the command line

The following script fails to resize an already maximized window: wmctrl -i -r :ACTIVE: -b remove,maximized_vert,maximized_horz xdotool windowunmap --sync xdotool windowmap --sync wmctrl -r :ACTIVE:...
6
votes
2answers
872 views

What is the syntax for passing the output of a command to xargs?

As an example I am using xdotool to obtain the list of windows on my desktop, which outputs a list of numbers, one on each line. An example command for that is: xdotool search --name "a_program", ...
6
votes
3answers
10k views

Can xdotool be used on some window not in the front?

On Ubuntu desktop, can I use xdotool to mouse click (e.g. click a link) and press some keys (e.g. ctrl+s) on a window (e.g. Firefox's window) that is not in the front, so that I can work on another ...
6
votes
0answers
1k views

More than one WIDs associated with "Chrome" and with "evince"?

I am running Google Chrome browser with 17 tabs. $ xdotool search --name "Google Chrome" 79691777 Why does the following return 7 WIDs? 7 doesn't match any of the fact that I have 17 tabs in a ...
6
votes
1answer
1k views

xdotool and xbindkeys

I have an Acrobat reader that does not zoom on Control+plus but rather on Control+acute (Control-plus annoyingly rotates the document). I would like to fix this using xbindkeys and xdotool but the ...
5
votes
2answers
2k views

X: Find out if a window is visible to the user i.e. not covered by others

I only want to execute a certain action with xdotool if the window is not visible to the user, this includes minimized windows, but also windows which are 100% covered by other windows (if no ...
5
votes
1answer
760 views

XDoTool Command to Wait For Process to End

I use the program VisiPics to delete dupicate pictures. The processing time for deletion varies dependent on the number of pictures and duplicates. I created an Xdotool command to carry out certain ...
4
votes
1answer
647 views

xdotool - how to get window id given its X and Y?

I can get X and Y of the active window with xdotool getwindowgeometry --shell $(xdotool getactivewindow). How do I do a backwards process - find window id given its X and Y? I'm only interested in the ...
4
votes
1answer
675 views

Command-line tool to get "click and drag" rectangle coordinates from the screen [closed]

I would like to execute a command-line command that activates "click and drag" mouse selection on a single local X11 screen. The goal is to: get the selected rectangle X and Y coordinates, ...
4
votes
1answer
369 views

How to combine conditions with xdotool?

Is it possible to search for both the --class and --name using xdotool? xdotool search --all --onlyvisible --class "some_val" --name "another val" The above returns an error because the first ...
4
votes
1answer
130 views

Parsing "shell friendly" output

I would like to get output from xdotool getactivewindow getwindowgeometry --shell to local variables in bash. Thought I might could do something like: declare -A wp=( $(xdotool getactivewindow ...
4
votes
1answer
2k views

Is there a problem using xdotool to direct keystrokes to Java windows?

I'm running Fedora 22 (Linux) and have a Java application written by others that I want to send keystrokes to. I have tried to use xdotool in various ways, but I can neither set focus to the Java app ...
4
votes
1answer
2k views

Type some text with xdotool independently of the keyboard layout

The command xdotool type "hello" can be used to type the word hello. But only if the keyboard layout is not English, otherwise it will type something else. How can I solve this problem so that ...
4
votes
0answers
362 views

A shrug ¯\_(ツ)_/¯ in awesome key bindings

This is the code I currently have: -- Silly shrug emoji. awful.key({ modkey }, "F12", function () awful.util.spawn("xdotool getactivewindow type '¯\\_(ツ)_/¯'", false) end, {...
4
votes
2answers
2k views

xdotool prints 8 instead of Tab

I'm currently working on a "autotype"-script for pass. In oder to do that, I need to type the username, press 'Tab' and then type the password. For testing I'm using the following code: WID=$(...
3
votes
3answers
7k views

minimizing & raising a window from a shell script

I am trying to run a script that will check internet speed on a linux machine with gui, bring the terminal window down and when the query is finished , the window will come up with the answer. as for ...
3
votes
2answers
4k views

How to set absolute mouse cursor position in Wayland without using mouse?

The question is pretty straight forward. What I would have used under X [xdotool] obviously does not work moving forward, and no obvious new solutions have arisen given the relative new adoption of ...
3
votes
1answer
7k views

run command on user display as root isn't working as expected

I'm trying to execute a xdotool operation (move mouse) on the user's display from a root shell but I get: # DISPLAY=:0 mousemove_relative 1 1 No protocol specified Error:Can't open display: (null) ...
3
votes
2answers
370 views

Bash: How can I check if a website has finished loading?

Problem I am trying to automate a task in my Firefox browser with xdotool. First, I open a new tab in my browser with: firefox -new-tab "www.domain.tld" Then (after the page www.domain.tld ...
3
votes
1answer
223 views

xdotool: How to test if current window is of certain class in bash script?

I want to do some specific things in a bash script if the current window belongs to the Firefox class I am aware of: xdotool getactivewindow and xdotool search -class firefox then I could do some ...
3
votes
1answer
809 views

Why xdotool is not clicking when restoring position?

Why xdotool is not clicking when restoring position? xdotool mousemove --sync 4000 1000 click 1 mousemove restore If I don't restore the position, it works, example: xdotool ...
3
votes
1answer
446 views

Xclip command works in shell but not in keyboard shortcut

I have to paste my email often during the day, and typing it is time consuming. That is why I am searching for a way to do this with a button press. The following command works to place my mail on my ...
3
votes
1answer
2k views

xdotool sleep 1 vs sleep 1, any difference?

Is there any difference between these two sleep commands: Either: xdotool sleep 1 Or: sleep 1 Example: #!/bin/bash while : do xdotool mousemove --sync 1000 500 xdotool click 1 ...
3
votes
1answer
2k views

xdotool messes up keyboard input

I'm trying to create some scripts using xev and xdotool to allow me to record and re-play macros in linux. I've got the recording working with xev, and the replaying mostly works but appears to leave ...
3
votes
0answers
1k views

Keyboard shortcut to open a new terminal if one doesn't exist on this desktop. Otherwise, focus the current one

I would like to create a keyboard shortcut that will open a new terminal window only if none exists on the current desktop. Otherwise, the currently existing one will be focused. I just upgraded from ...
3
votes
0answers
1k views

How to detect whether a window is in focus?

I'm not experienced in scripting but I've made this script: #!/usr/bin/env bash # hint: use "xdotool getmouselocation" to get values if xdotool getwindowfocus getwindowname | grep -Eq " - ...
2
votes
1answer
178 views

How to type anything with xdotool?

I have some input field of printable ASCII characters, excluding whitespace, that I'd like to pass to xdotool to type as if typed by keyboard. My attempts: echo "type lol lol" | xdotool - ...
2
votes
1answer
3k views

xdotool: command to resize current active firefox window?

I have multiple firefox windows, I'd like to use a shortcut of current window manager to resize curent active firefox's window to specific size and position. How xdotool command to achieve this? ...
2
votes
2answers
721 views

Does xdotool have a log?

I'm using xdotool to securely type out a password (as opposed to using the clipboard) from a password manager (pass) and I'm wondering if xdotool has a log somewhere, which would obviously make it ...
2
votes
1answer
2k views

`xdotools type` mangles carriage returns

I would like to setup a paste functionality allowing to paste copied text (like scripts and configuration files) to any kind of application, including virtual guests and remote sessions running ...
2
votes
1answer
952 views

Simulate PrintScreen key press

I want to write a script that changes the window focus, and sends keyboard commands, such as print screen, and arrow keys, to the system. As in I need print screen to capture my desktop, not the ...
2
votes
1answer
302 views

A quit command weaker than windowkill?

Typing in xdotool getwindowfocus windowkill currently terminates the active window and bypasses any safeguards like "would you like to save your work?". Is there a weaker command than windowkill I ...
2
votes
1answer
332 views

Error when automating type option via xdotool

I want to open Chromium browser and then open a couple of web pages, let's say "google.com", and "stackexchange.com". My code for the same is below. #!/bin/bash #website 1 chromium-browser xdotool ...
2
votes
1answer
851 views

Make 'read' work when not focused on terminal

I have the following script which spams a button in a program when the V button is pressed #!/bin/bash winid=$(xdotool search "application name here" | head -n1) while true; do read -rsn1 input if [ "...
2
votes
1answer
23 views

Move window from other (inactive) desktop to current desktop

When using this to fetch window from another desktop to current desktop (which is #0), nothing happens until I focus the desktop with that window - then window immediately moves to the desktop 0. ...
2
votes
0answers
90 views

Unable to send keypress to Xvfb display using XTestFakeKeyEvent in C

Using this short snipped of code I am able to capture events from the keyboard (/dev/input/event1) and print them properly. However, sending them to the Xvfb display using XTestFakeKeyEvent does not ...
2
votes
1answer
119 views

ctrl scroll to zoom terminal emulator using tmux

I am using the following tmux keybindings to zoom using the mouse wheels. # Ctrl Scroll to Zoom bind-key -T root C-WheelUpPane { run-shell "xdotool key Ctrl+plus" } bind-key -T root ...
2
votes
0answers
101 views

key binding running xdotool unexpected behaviour

I've programmed a key to run xdotool when it's pressed. But for some unknown reason xdotool is only sending keystrokes when the binded key is released, except when a non-active window is sent the ...