Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
2
answers
4174
views
Install problem for xdotool
Since I have problems with my Internet connection I'm not able to always run command `apt-get install xdotool` in Terminal, so I would like to download the **xdotool** package manually from website in .zip or .deb format and then install it manually every time I need it. (I'm using Usb Live Kali Lin...
Since I have problems with my Internet connection I'm not able to always run command
apt-get install xdotool
in Terminal, so I would like to download the **xdotool** package manually from website in .zip or .deb format and then install it manually every time I need it. (I'm using Usb Live Kali Linux 2016.2-amd64 and every time I reboot it deletes all files).
I've tried to download xdotool from https://github.com/jordansissel/xdotool at the right side in green box "Clone or download" there is option download ZIP. After that I extract all files in Home folder and then open it in Terminal.
in README file there are instructions like this:
> See the website for more up-to-date documentation
> http://www.semicomplete.com/projects/xdotool/ or the manpage listed
> below.
>
> Compile: make
> Install: make install
> Remove: make uninstall
>
> You may have to set 'PREFIX' to the location you want to install to.
> The default PREFIX is /usr/local
>
> For packagers, there's also support for DESTDIR for staged install.
I type in make
then make install
and it always outputs me this error:
root@kali:~/xdotool-master# make
cc -pipe -O2 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -Wno-missing-field-initializers -g -std=c99 -I/usr/X11R6/include -I/usr/local/include -fPIC -c xdo.c
xdo.c:29:34: fatal error: X11/extensions/XTest.h: No such file or directory
#include
^
compilation terminated.
Makefile:124: recipe for target 'xdo.o' failed
make: *** [xdo.o] Error 1
root@kali:~/xdotool-master# make install
install -d /usr/local
cc -pipe -O2 -pedantic -Wall -W -Wundef -Wendif-labels -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Winline -Wdisabled-optimization -Wno-missing-field-initializers -g -std=c99 -I/usr/X11R6/include -I/usr/local/include -fPIC -c xdo.c
xdo.c:29:34: fatal error: X11/extensions/XTest.h: No such file or directory
#include
^
compilation terminated.
Makefile:124: recipe for target 'xdo.o' failed
make: *** [xdo.o] Error 1
root@kali:~/xdotool-master#
What I'm doing wrong?
Can you suggest me other methods of installation of xdotool (but without Internet connection)?
user219258
Mar 29, 2017, 06:03 PM
• Last activity: Aug 3, 2025, 05:58 PM
6
votes
4
answers
10452
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 the time being- i can take the window down, but not up. #!/bin/bash xdotool getactivewindow windowmi...
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 the time being- i can take the window down, but not up.
#!/bin/bash
xdotool getactivewindow windowminimize
#xdotool set_window --name speedy
#xdotool set_window --icon-name speedy
speedtest-cli --simple
if [ $? -eq 0 ]
then
#xdotool windowactivate speedy
xdotool windowfocus #speedy
xdotool key "F11"
fi
exec $SHELL
soBusted
(941 rep)
Aug 31, 2016, 08:28 AM
• Last activity: Jul 31, 2025, 09:08 AM
1
votes
1
answers
2508
views
How can I bind "modifier + arrow" keys to home/end/pageup/pagedown under X?
I have a new 60% keyboard (NuPhy Air60), but it does not have any way to trigger pageup/pagedown or home/end keys. My goal is to recover these commands with a custom keybinding, using a modifier key like `hyper` or `alt`, in combination with the arrow keys. For my preference, something like: - alt +...
I have a new 60% keyboard (NuPhy Air60), but it does not have any way to trigger pageup/pagedown or home/end keys.
My goal is to recover these commands with a custom keybinding, using a modifier key like
hyper
or alt
, in combination with the arrow keys. For my preference, something like:
- alt + arrowup = pageup
- alt + arrowdown = pagedown
- alt + arrowleft = home
- alt + arrowright = end
I tried to use xmodmap
to make the bindings -- but unfortunately due to a years-old known chromium bug, my bindings there did not work in Chrome or VSCode.
What else can be done?
ChaseMoskal
(111 rep)
Mar 13, 2023, 12:08 AM
• Last activity: Jul 6, 2025, 07:08 AM
0
votes
1
answers
2092
views
Bind mouse click on key including mouseclick hold function
For health reasons, i mapped the mouse buttons on keys on keypad. This helps me, but I have solved the bindings via xdotool in KDE Custom shortcuts. With e.g. `xdotool click 1` you can simulate simple mouse clicks, but I would also like to drag a window when the mouse button is permanently pressed....
For health reasons, i mapped the mouse buttons on keys on keypad. This helps me, but I have solved the bindings via xdotool in KDE Custom shortcuts. With e.g.
xdotool click 1
you can simulate simple mouse clicks, but I would also like to drag a window when the mouse button is permanently pressed. Under windows this was possible with AutoHotKey. Is there an option to set this up in linux as well? I use Kubuntu 20.04 and KDE 5.
CampingCow
(1 rep)
May 6, 2022, 06:47 AM
• Last activity: Apr 15, 2025, 08:00 AM
4
votes
1
answers
12194
views
how do I make xdotool press ctrl c and ctrl v
`xdotool key ctrl+v` or `ctrl+c` does not work.
xdotool key ctrl+v
or ctrl+c
does not work.
Pixelmelt
(43 rep)
Dec 24, 2018, 12:01 AM
• Last activity: Mar 24, 2025, 09:31 PM
0
votes
2
answers
2487
views
Can't have the --window option work with xdotool click
I'm trying to make an autoclicker (for a farm) in a video-game (Minecraft if you want to know) that works even if the window is in the back. I disabled the game auto-pause upon losing window focus successfuly and then tried to use ``` xdotool click --repeat 100000000000 --delay 1000 1 --window $(xdo...
I'm trying to make an autoclicker (for a farm) in a video-game (Minecraft if you want to know) that works even if the window is in the back. I disabled the game auto-pause upon losing window focus successfuly and then tried to use
xdotool click --repeat 100000000000 --delay 1000 1 --window $(xdotool search --name --onlyvisible Minecraft)
or simply
xdotool click --repeat 100000000000 --delay 1000 1 --window WINDOW_ID
where WINDOW_ID
is the ID of the game window that I manually fetched. But both commands completely ignore the --window
option and act as
xdotool click --repeat 100000000000 --delay 1000 1
i.e. it clicks where the mouse is currently pointing.
Am I doing something wrong or is there some technical limitation that I'm not aware of?
maximumevil
(1 rep)
Mar 16, 2021, 12:16 PM
• Last activity: Feb 9, 2025, 08:57 PM
6
votes
2
answers
2470
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 `xdotool` will always type hello in any layout. I use the latest `xdotool` in Ubuntu 14.04 repo.
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
xdotool
will always type hello in any layout.
I use the latest xdotool
in Ubuntu 14.04 repo.
user69453
(295 rep)
Jun 30, 2014, 02:10 PM
• Last activity: Jan 10, 2025, 06:24 PM
1
votes
0
answers
54
views
Moving floating windows around with keyboard shortcuts
I'm currently using a Linux Mint 22 Cinnamon 6.2.9 installation that is a couple days old and I want to use some features I had on a previous tiling window manager with XFCE. In particular, I want to move floating windows around with shortcuts. In order to do that I made this brief Bash script: ```...
I'm currently using a Linux Mint 22 Cinnamon 6.2.9 installation that is a couple days old and I want to use some features I had on a previous tiling window manager with XFCE. In particular, I want to move floating windows around with shortcuts. In order to do that I made this brief Bash script:
#!/bin/sh
win_id=xdotool getactivewindow
u=xwininfo -id $win_id | grep 'Absolute upper-left X' | cut -c27-35
v=xwininfo -id $win_id | grep 'Absolute upper-left Y' | cut -c27-35
(( u+=150, v=$v-86 ))
xdotool getactivewindow windowmove $u $v
It intends to move a floating window 150 px along the X-axis only (the 86 pixels that I subtract from the Y-axis are the window's upper decoration which is considered by xwininfo
but not by windowmove
.
When I execute it in the terminal, it works fine, but when I try to bind it to some keyboard shortcut (e.g., Super + G), the selected window moves only +86 px on the Y-axis.
Can anyone replicate this? What could be the cause of this inconsistency? I already have verified that other kind of key-bind scripts executes well (like open other programs).
Absl Lidenbrock
(11 rep)
Dec 30, 2024, 03:22 AM
• Last activity: Dec 30, 2024, 03:29 AM
11
votes
4
answers
21068
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 different window which may need to lie on top of the other windows, while at the same time, let `...
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 different window which may need to lie on top of the other windows, while at the same time, let xdotool
to work on a hidden window?
Thanks.
Tim
(106420 rep)
May 5, 2015, 06:40 AM
• Last activity: Oct 12, 2024, 12:19 AM
2
votes
2
answers
352
views
Send a mouseclick to an X window in the background, without bringing it to the foreground
How do I send a mouseclick action / hold mousebutton to a window in the background, without bringing the window to the front? I want to be able to interact with other windows while holding down a mousebutton in a specific application.
How do I send a mouseclick action / hold mousebutton to a window in the background, without bringing the window to the front?
I want to be able to interact with other windows while holding down a mousebutton in a specific application.
Valentin Metz
(153 rep)
Sep 1, 2024, 07:34 PM
• Last activity: Sep 6, 2024, 03:16 AM
1
votes
3
answers
133
views
why my shell script generates zombies and sometimes works weird
I have a simple script for the i3 window manager that shows an i3bar at the bottom of the screen when you touch its edge with the mouse. It **almost** always works fine. However, after it quits, there is **always** a zombie process. And the more this script is called, the more zombies there are. Als...
I have a simple script for the i3 window manager that shows an i3bar at the bottom of the screen when you touch its edge with the mouse. It **almost** always works fine. However, after it quits, there is **always** a zombie process. And the more this script is called, the more zombies there are.
Also, for some unknown reason, the script sometimes either does not work at all, or works with a long delay.
#!/bin/sh
# i3 config:
# exec --no-startup-id xdotool behave_screen_edge --quiesce 300 bottom exec ~/.config/i3blocks/bar-toggle.sh
# shows bar
i3-msg bar hidden_state show
CURSOR_STILL_NEAR_BOTTOM=1
# We want bar to stay open until cursor moves away from its top edge
TOP_OF_BOTTOM_EDGE=735
while [ "$CURSOR_STILL_NEAR_BOTTOM" -eq 1 ];
do
eval $(xdotool getmouselocation --shell)
if [ "$Y" -lt "$TOP_OF_BOTTOM_EDGE" ]; then
CURSOR_STILL_NEAR_BOTTOM=0
else
# time before panel hides
sleep 0.5
fi
done
# hides bar
i3-msg bar hidden_state hide
I can't understand what I'm doing wrong.
Everything is running in Virtualbox 7.0 (Debian 12 testing installed)
Anton Vakulenko
(23 rep)
Aug 5, 2024, 04:19 PM
• Last activity: Aug 7, 2024, 08:07 PM
24
votes
5
answers
58762
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 `xdotool search --name --class`, but it would only accept _one_ pattern for both name and title. * xdoto...
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
xdotool search --name --class
, but it would only accept _one_ pattern for both name and title.
* xdotool supports command chaining, but I could not find a way to chain two search calls -- the second one simply overrides first one.
t7ko
(545 rep)
Jan 12, 2016, 10:02 AM
• Last activity: May 14, 2024, 11:46 PM
1
votes
0
answers
133
views
xfce4 shortcuts (mostly) not working with xdotool
I want to make a keyboard shortcuts for automatically entering predefined texts with xdotool. I made a shell script file and want to run it through the keyboard. When i assign shortcut throught xfce4's application shortcuts, most combinations don't work. The only ones that work properly are CTRL, AL...
I want to make a keyboard shortcuts for automatically entering predefined texts with xdotool.
I made a shell script file and want to run it through the keyboard. When i assign shortcut throught xfce4's application shortcuts, most combinations don't work. The only ones that work properly are CTRL, ALT and SHIFT (both L and R works), but when i assign combinations like LCTRL+P, SUPER+ENTER etc.. i doesn't work properly. If i continously press the combinatins that don't work, sometimes(like 10% of the time) it outputs the last one or two letters but never the full text.
shell script example:
xdotool key m+y+t+e+x+t+KP_Enter
it works perfectly when i run it in terminal or with the above mentioned shortcuts but i want to be able to assign combination shortcuts.
Oğuz Güven
(11 rep)
Apr 22, 2024, 01:05 PM
11
votes
2
answers
10038
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 apparently neither `xdotool` nor `xte` work in Wayland (for security reasons [?]) Is there a w...
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 apparently neither xdotool
nor xte
work in Wayland (for security reasons [?])
Is there a workaround? Otherwise how do I rebind keys to other keys?
iLemming
(543 rep)
Jul 26, 2017, 06:19 AM
• Last activity: Mar 15, 2024, 03:27 PM
7
votes
4
answers
17818
views
How to create a keyboard shortcut to play/pause any audio/video running in the background?
So I bought this keyboard for my laptop that doesn't have media keys on it and I am very used to pressing the play/pause button on my laptop to pause any media playing in the background. With this keyboard however I have to create my own keyboard shortcuts to do that because of the absence of media...
So I bought this keyboard for my laptop that doesn't have media keys on it and I am very used to pressing the play/pause button on my laptop to pause any media playing in the background. With this keyboard however I have to create my own keyboard shortcuts to do that because of the absence of media keys. Till now I have managed to make keyboard shortcuts for volume control.
Research and my attempts:
1. I found this page which shows a command to simulate media keys from the terminal.
.
The command is
xdotool key XF86AudioPlay
but when I make a keyboard shortcut out of this by going to **Settings > Keyboard > Application Shortcuts**. It doesn't seem to work.
1. When I press the keyboard shortcut which I have set to *Super+F11* my CPU usage rises a bit which means that the shortcut is working. I confirmed this by changing the command the shortcuts executes to exo-open --launch WebBrowser
which as you might have thought opens my web browser when I press *Super+F11*.
1. Now because I knew a bit of C/C++ I created this wrapper program which does exactly the same thing
#include
int main() {
system("xdotool key XF86AudioPlay");
}
and mapped the shortcut to execute this program but Alas!! it still doesn't work.
How do I get the command that XFCE executes when I press the default play/pause button on my laptop keyboard because that seems to play/pause any media playing in the background.
I use XFCE on Arch Linux.
I usually listen to music on rhytmbox music play.
Mayank Shigaonker
(171 rep)
Aug 10, 2020, 09:25 AM
• Last activity: Feb 29, 2024, 08:41 AM
5
votes
1
answers
1889
views
Command-line tool to get "click and drag" rectangle coordinates from the screen
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, - get the rectangle **width** and **height**, - output these values to **stdout**, - (optional) draw...
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,
- get the rectangle **width** and **height**,
- output these values to **stdout**,
- (optional) draw a selection border while dragging the mouse.
user218169
Feb 27, 2017, 10:11 AM
• Last activity: Feb 14, 2024, 04:39 PM
1
votes
0
answers
56
views
Map alt-e to ctrl-Tab. Mint, Xfce
I have Linux Mint, Xfce. I want to change tabs in Firefox by pressing Alt-e, rather than the default Ctrl-Tab. In order to do that I must remap those keys in the Xfce UI. In Xfce I can map a key to run a bash script here: https://docs.xfce.org/xfce/xfce4-settings/keyboard The bash script then runs x...
I have Linux Mint, Xfce.
I want to change tabs in Firefox by pressing Alt-e, rather than the default Ctrl-Tab.
In order to do that I must remap those keys in the Xfce UI.
In Xfce I can map a key to run a bash script here:
https://docs.xfce.org/xfce/xfce4-settings/keyboard
The bash script then runs xdotool, in order to press ctrl+Tab. The key mapping that runs bash script works. Now how to write the actual xdotool script, that seems to be no small feat. The following code freezes the system, needing a reboot: xdotool keydown ctrl+Tab; xdotool keyup Tab; I have tried many other configurations, following forums found via googling. I tried adding sleep 0.1 infront and in between. As well as the xdotool --delay option. Nothing seems to work. How do I do this xdotool mapping?
https://docs.xfce.org/xfce/xfce4-settings/keyboard
The bash script then runs xdotool, in order to press ctrl+Tab. The key mapping that runs bash script works. Now how to write the actual xdotool script, that seems to be no small feat. The following code freezes the system, needing a reboot: xdotool keydown ctrl+Tab; xdotool keyup Tab; I have tried many other configurations, following forums found via googling. I tried adding sleep 0.1 infront and in between. As well as the xdotool --delay option. Nothing seems to work. How do I do this xdotool mapping?
john-jones
(1766 rep)
Dec 18, 2023, 04:16 PM
• Last activity: Dec 18, 2023, 05:03 PM
4
votes
2
answers
3966
views
Script/keyboard shortcut to minimize all other windows
I would like a global keyboard shortcut super + down to minimize all windows except the active one, so that I can see that window with just the desktop in the background. A nice extra would be to simultaneously position the window to the center of the screen. I am on Kubuntu 19.10 with Plasma 5.18.3...
I would like a global keyboard shortcut super+down to minimize all windows except the active one, so that I can see that window with just the desktop in the background. A nice extra would be to simultaneously position the window to the center of the screen.
I am on Kubuntu 19.10 with Plasma 5.18.3.
I am aware of the "Shake" KWin script, but I want a keyboard shortcut.
My idea was to write a script to minimize all windows, then bring the last active window back to focus and center it via keystrokes using
xdotool
, then configure a custom shortcut to run this script.
My script is as follows:
#!/bin/bash
active=$(xdotool getactivewindow) # remember active window
xdotool key super+shift+d # minimize all windows
xdotool windowactivate $active # bring back last active window
xdotool key super+c # center active window
super+shift+d is a global shortcut I configured for the KWin script "Minimize all" I previously activated, super+c the one for the "Move window to Center" KWin script I installed and activated as well. Individually, these key combinations work, both when hitting them manually and when simulating them with xdotool.
**My custom shortcut does actually start the script; however, it will only minimize the windows and not bring the last window back to focus.**
Running the script from the terminal and inserting echo
statements between the lines reveals that the script runs through until the end, just that the last two lines don't seem to have any effect, but without giving any error message. Running the commands echo $(xdotool getactivewindow)
and xdotool windowactivate 150994951
individually did what they were supposed to as well, so my best guess is that I did something wrong about passing the active
variable to the windowactivate
command, but I can't figure out what.
What did I do wrong?
Is there a more elegant way to define a custom shortcut for the procedure described above?
Natalie Clarius
(369 rep)
Apr 28, 2020, 12:15 PM
• Last activity: Jul 19, 2023, 12:44 PM
1
votes
0
answers
374
views
xdotool does not work for terminal window copy paste
I'm using Ubuntu 22 and i have set up two custom shortcuts via settings (works for all windows i have tested so far). xdotool getactivewindow key ctrl+c (-> super+c) xdotool getactivewindow key ctrl+v (-> super+v) Then changed the terminal shortcuts of copy to `Ctrl+C` and paste to `Ctrl+V`. Now, wh...
I'm using Ubuntu 22 and i have set up two custom shortcuts via settings (works for all windows i have tested so far).
xdotool getactivewindow key ctrl+c (-> super+c)
xdotool getactivewindow key ctrl+v (-> super+v)
Then changed the terminal shortcuts of copy to
Ctrl+C
and paste to Ctrl+V
.
Now, when i press super+v
with an active terminal open nothing happens. However, i would expect that it pastes my text into the terminal. When pressing ctrl+v
it works. How can i make this work?
Furthermore i have changed the terminal interruption signal to Strg+I
with stty intr ^I
.
I also disabled the super
key default behaviour when pressed to nothing with gsettings set org.gnome.mutter overlay-key '' t
.
AliceTheCat
(111 rep)
Jul 4, 2023, 08:52 AM
1
votes
0
answers
1000
views
ydotool: first, backend unavailable, then crash on connection
I'm using the Linux Mint Debian Edition 5 Linux distro. I'm usually satisfied of `xdotool` I use since years on linux but since few weeks by using it with a browser (chromium, firefox), for long times hours scripting (low-level value tasks), it appears that it's crashing the browser, either FF/chrom...
I'm using the Linux Mint Debian Edition 5 Linux distro.
I'm usually satisfied of
xdotool
I use since years on linux
but since few weeks by using it with a browser (chromium, firefox), for long times hours scripting (low-level value tasks), it appears that it's crashing the browser, either FF/chrome/qutebrowser.
xdotool
, especially because it is specific to X11, might be depreciated in favor of the newer tool ydotool
, which works on both xorg and wayland. So, I'm trying to use ydotool
After added my user to INPUT
group with a specific module.d
file added,
Then, I launch the ydotool
daemon, as root
:
ydotoold
and it starts.
I just run few times the different commands within the main page of [ydotool
github page](https://github.com/ReimuNotMoe/ydotool) :
ydotool key 56:1 62:1 62:0 56:0
ydotool: notice: ydotoold backend unavailable (may have latency+delay issues)
but suddently:
ydotoold: listening on socket /tmp/.ydotool_socket
ydotoold: accepted client
Erreur de segmentation [segmentation fault] (core dumped)
How do I make it work?
lm2
(11 rep)
May 12, 2023, 04:58 PM
• Last activity: May 12, 2023, 05:58 PM
Showing page 1 of 20 total questions