1

What I'd like to achieve is to be able to press a button (F9 in this case) and for a specific string to be "pasted" into the active window. (It's to save typing a very long password - I know, I'm doing it wrong but the devices in question do not support PKI).

I've tried using xhotkeys, this gives me the ability to execute an arbitrary command on a specific keystroke however I don't seem to be able to find any way to make it "paste" into the active window.

I'm positive there is a way - any help appreciated!

1

Thanks to the hint by @thrig this is now solved!

Turns out "pasting" wasn't really necessary - xdotool provides a "type" function which allows me to send some keystrokes to the active window and also a "key" function allowing me to submit the input. Final gotcha was that you have to add a slight delay for this to work smothly (https://askubuntu.com/questions/212154/create-a-custom-shortcut-that-types-clipboard-contents)

Final solution was to create a custom shortcut (via gnome) that runs the following custom command:

sh -c 'sleep 0.4; xdotool type "secret"; xdotool key Return'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.