jeudi 26 mars 2015

How to remotely send a keypress to an X11 application?


I've got an X11 program (Mathematica/Linux) running which contains unsaved data (calculated after I left; unfortunately I didn't have the foresight to programmatically save the data). Now I've gotten an email that the power will be switched off, unfortunately before I'm back. Therefore I want to save the data, which I could do by simply sending a Ctrl-S to the right window (I know how to find the window ID). Unfortunately there's no xdotool or autokey installed, and I don't have root rights to install one of them. So is there a way to do it?


Of course one way would be to write a C program to do it (since the functionality must be there, or those other programs couldn't work), but I've never written anything for X11, so I don't think I'll get it written in time ...


I've got access to the machine with ssh, and can access the display (I can do a screenshot - which shows the lock screen - and I can obtain a window list using xwininfo). So all I need is a way to send a single Ctrl-S to a specific window without previously installing something.



Aucun commentaire:

Enregistrer un commentaire