Simulating key press using bash
13,881
Xdotool (no idea what happened to the webpage, here is its source) is great for that:
xdotool key k
And with gedit:
gedit & sleep 2; xdotool key k;
Author by
abilash
Updated on June 25, 2022Comments
-
abilash almost 2 years
I try to run gedit from terminal and type some text in a file opened there, but have no success. I try to use
gedit; sleep 2; xte -x display 'key k';
command but this one run gedit only(without typing the k char). Can some one chip in me? -
abilash over 11 yearsI've tried it, but during compiling there is an error appeared. fatal error: X11/Xlib.h: No such file or directory. I use Ubuntu 12.04 32 bits system. How can I fix it?
-
BeniBela over 11 yearsPerhaps you need libx11-dev? But somewhere there are binaries (perhaps even in the Ubuntu repository)
-
abilash over 11 yearsI install it, but i have the same problem for this util. When I use gedit; sleep 2; xdotool key k; command line it runs gedit only(without typing symbols), and only after closing gedit it types k char in terminal. But how can I force this util to type chars into gedit opened file???
-
BeniBela over 11 yearsperhaps i should have actually read your question... See the edit