You are not logged in.
Hi.
I'm trying to create a script that inserts some text in different editors. I'm using xdotool, but after the text is pasted, the screen freezes for a second. That happens when the default xfce compositor is on.
For example: copy any text and then launch the next code in the terminal:
sleep 4 && xdotool key ctrl+v
Then quickly start to type something in any editor or erase the text.
With the compositor off, typing is smooth without freezing.
Maybe somebody knows another tool for emulating key pressing that feels more native for pasting (or typing) with the xfce compositor on?
I tried autokey. It works fine. The only thing I don't like is the process that always in the background consuming memory.
Offline
What if you write your own app?
You will need Xlib and XTest extension
In Debian these dev libraries are needed to compile: libx11-dev libxt-dev libxext-dev
Will also need gcc.
Save next as tehkopaste.c and comile in the same folder with:
gcc tehkopaste.c -o tehkopaste -lX11 -lXtst -lXext
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/XTest.h>
static void SimKey (Display * disp,
KeySym keysym,
KeySym modsym){
KeyCode keycode = 0, modcode = 0;
keycode = XKeysymToKeycode (disp, keysym);
modcode = XKeysymToKeycode(disp, modsym);
XTestGrabControl (disp, True);
XTestFakeKeyEvent (disp, modcode, True, 0);
XTestFakeKeyEvent (disp, keycode, True, 0);
XTestFakeKeyEvent (disp, keycode, False, 0);
XTestFakeKeyEvent (disp, modcode, False, 0);
XSync (disp, False);
XTestGrabControl (disp, False);
}
int main (){
Display *disp = XOpenDisplay (NULL);
SimKey (disp, XK_V, XK_Control_L);
XCloseDisplay(disp);
}
When a binary is created up run:
sleep 4 && tehkopaste
And then, if you wish so, drop by to tell us how tehkopasting goes.
Last edited by Misko_2083 (2021-11-11 00:47:25)
Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c
Offline
Save next as tehkopaste.c and comile in the same folder with:
And then, if you wish so, drop by to tell us how tehkopasting goes.
Cool name but it's got nothing on "ganknkill.c".
Remember to edit the subject of your topic to include the [SOLVED] tag once you're satisfied with the answers or have found a solution (in which case, don't forget to share it as well), so that other members of the community can quickly refer to it and save their time. Pretty please!
Offline
Misko_2083, I tried your solution. It feels the same like xdotool script. I mean when text is pasted and I start to erase it, the screen' freezing. It's not the same when I physically press ctrl+v.
Autokey somehow solved it.
Offline
[ Generated in 0.013 seconds, 7 queries executed - Memory usage: 533.56 KiB (Peak: 534.41 KiB) ]