Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can I configure a shortcut key to send a text string to the current program?

The purpose is to type common entries quicker (email address, street address, phone number, username, favorite quote, etc).

I don't need any further automation than just entering the text.

Gentoo Linux (3.2.12-gentoo) Xfce Desktop Environment (Version 4.8)

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

One simple approach is xdotool, like

xdotool type 'text'
share|improve this answer
    
That's half the solution... how do I assign a keyboard shortcut to run that? Making a shortcut in Xfce 4.8 Settings, Keyboard didn't work. –  Steven Apr 20 '12 at 2:24
    
@Steven Does it work directly from a terminal? –  jw013 Apr 20 '12 at 2:31
    
Yes. Also, 'sleep 5 && xdotool type text' sends the text to the "active" window. –  Steven Apr 20 '12 at 2:35
2  
@Steven I haven't used Xfce in a while, but my next hunch is that when the command is run, the active window is wrong somehow. I'd try running xdotool getwindowfocus both from a terminal and as a keyboard shortcut while the same terminal is open and compare the results for equality. You'll probably have to redirect the keyboard shortcut version to a temporary file in order to see it. –  jw013 Apr 20 '12 at 2:40
2  
I use xbindkeys. –  Mikel Apr 20 '12 at 2:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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