Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [xdotool]

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

21
votes
1answer
5k 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 ...
10
votes
1answer
4k 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-...
9
votes
2answers
16k 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 ...
8
votes
1answer
3k 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
4answers
15k 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 ...
7
votes
3answers
11k 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 ...
7
votes
1answer
5k 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.
7
votes
1answer
7k 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), ...
7
votes
1answer
2k 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
5k 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 ...
6
votes
2answers
2k 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 ...
6
votes
3answers
4k 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 ...
6
votes
1answer
3k 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: ~/....
6
votes
1answer
716 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
711 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", ...
5
votes
1answer
4k 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 ...
5
votes
1answer
887 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
183 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
468 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
1k 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
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 ...
3
votes
1answer
1k 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
0answers
80 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, {...
3
votes
0answers
636 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
616 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
1answer
222 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
370 views

How to launch an application as a dock on openbox

If i do obxprop|grep dock and click on gnome-panel for example, my result is : _OB_APP_TYPE(UTF8_STRING) = "dock" For the rest, it's : _OB_APP_TYPE(UTF8_STRING) = "normal" How can i force a ...
2
votes
1answer
455 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 ...
2
votes
1answer
726 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
2answers
402 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
728 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
243 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
412 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
1k 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 ...
2
votes
0answers
843 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 " - ...
1
vote
3answers
3k 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 ...
1
vote
2answers
1k 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 ...
1
vote
1answer
465 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? ...
1
vote
1answer
2k views

Mapping mouse events to key presses using xbindkeys

I want to map various mouse actions to key presses using xbindkeys. All my attempts to do this in my .xbindkeysrc file have failed. Attempts have been made using xte and xdotool. Below is a summary of ...
1
vote
1answer
2k 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) ...
1
vote
1answer
249 views

A tool that let's you draw rectange on screen, gives dimensions + X-Y? [closed]

a tool like: xprop wmctrl xdotool but it needs to permit me to draw a shape on the screen. then it should tell me the dimensions + the x-y coordinates is there such tool ?
1
vote
1answer
696 views

Is it possible to automate clicks with xdotool to control a different GUI session from the one being currently used?

The xdotool command allows us to create scripts controlling the graphical user interface of the system very easily. I can e.g. open my Chrome browser in the following desktop by executing xdotool ...
1
vote
1answer
564 views

Xdotool action without focusing

Is there a way to automatically click at a specific place in specific window without getting the window focused?
1
vote
1answer
375 views

Reactivate stored pid of a window with xdotool

First, I store the pid of an active window. active_window_pid=$(xdotool getactivewindow getwindowpid) Second, I click on another window, which is actually function below. mouse_click 4000 1000 ...
1
vote
0answers
56 views

Eliminate xdotool delay?

I have assigned the key F2 to the command bash -c "sleep 0.1;xdotool type --clearmodifiers $(date +%Y%m%d%H%M%S)" There is a delay of half a second (not because of the sleep 0.1 command that should ...
1
vote
1answer
143 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 ...
1
vote
0answers
426 views

XBindkeys and Mouse key's giving keyboard numbers (0-9)

XINPUT ➜ xinput --list ⎡ Virtual core pointer id=2 [master pointer (3)] ⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)] ⎜ ↳ ...
1
vote
0answers
121 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 ...
1
vote
1answer
843 views

RapidFire input with xdotool and xbindkeys

I'm wondering how it be possible to configure a keybind to use RapidFire with xdotool and xbindkeys to a gamepad input? I have a Logitech F310, and I want to know how I can pass keybinds to simulate ...
1
vote
1answer
667 views

how to determine in what viewport (compiz/unity) a window is placed?

I am writing a script that requires determining in what viewport a window is placed. My desktop is 2x2 (4 viewports), it is usually thought as being 4 virtual desktops but on compiz/unity it is ...