create new tag
, view all tags
I've been looking for a utility to support keyboard macros (as available in Windows).

Aside: Maybe I'm using the wrong words -- I mean the ability to have a keyboard shortcut enter an arbitrary string into the application with the current "focus". Starting an application or running a script are fine, but not quite what I'm looking for. I guess a script could be set up to paste a string of text into a specific application (using dcop) -- hmm, I wonder if dcop can paste to the current application? (The one with the current focus -- maybe I'm closer than I think.)

Keyboard accelerators: is another term sometimes used for what I call keyboard shortcuts. I might have said that it is a Linux term, and maybe it is, but I have a vague recollection that Microsofties might also use the term, specially in conjunction with menus, and the "F&ile" syntax often used to define a keyboard shortcut on a (Windows) menu.

Now I see two possibilities, both part of the KDE project -- khotkeys and klipper. UPDATE: Dann Washko of the LVLUG has made me aware of a third possibility -- Xcb, which exists and works now, although not quite everything I'd like.

kde has been very responsive to my requests, I've included copies of (most of) the email correspondence between Lubos Lunak (KHotKeys) and Carsten Pfeiffer (Klipper) on this page.

UPDATE (17 Sept 2002): Still no luck. I've joined a few additional mail lists (kernelnewbies, xpert and newbie on XFree86.org) with the intent of gathering information and considering writing my own program. Have investigated Xmodmap and the "console" counterpart of it (can't recall the name offhand) -- AFAICT, neither one allows assigning more than one "keysym" to a "keycode" (I should probably double check Xmodmap). Found screen (and wxsh -- see also Q.904 - Can I customise the keyboard for O (SGI) with their "bindkey" facilities. Mandrake (7.2 and 8.2) seem to use screen for something (not sure how extensive) but haven't gotten any results from setting bindkey -t foo stuff foobar in my ~/.screenrc file (and restarting X) -- tried typing foo<space> at the konsole command line and in nedit and konqueror (editing a textarea) started from that console. Sent questions to several mail lists, few responses.

UPDATE (19 Sept 2002): Ok, I'm going to dig into (somewhat) seeing if I can write something myself -- initially focusing on something in X, maybe modifying xlib or something like that. (It appears that may already have been done for the Apple thingie -- OS10 or whatever they call it. But, I'll start one or more new pages to record my findings / efforts, starting with KeyboardMacrosInX.

UPDATE (24 Feb 2003): "xterm*VT100.Translations: #override \ F17: string("next")" -- read XKeyCaps Manual which says what I want to do is not possible in X (~"X doesn't work that way") and has the tidbit above for doing it in specific apps (on an app by app basis)

UPDATE (12 Mar 2003) - Raphael Finkel has suggested using XIM -- will send me some C code, looks somewhat promising except that:

  • It sounds like a programming "method" rather than a user product
  • Instead of just a single keystroke (sort of, like <ctrl><alt>s, you need three -- start Xim (<shift><space), the "macro key" (s), stop Xim (<shift><space)
Regardless, it's still worth investigating.

UPDATE (26 Aug 2007) - Rasmus Hansen suggests using xvkbd--see xvkbd -xsendevent -text 'something\tor\tother', below


  • AboutThesePages
  • KeyboardMacrosInX - which includes a reference to a statement that X doesn't work like that
  • XKeyCaps -- a dead end
  • KeyboardMapping -- different topic -- inputting things like the inverted question mark ( <right_alt><shift>0) and degree sign ( <right_alt><shift>0), which don't seem to work in IE/TWiki.
  • Xim -- my latest great white hope



See http://dforce.sh.cvut.cz/~seli/en/khotkeys/ -- not sure that it's made it into a recent release -- the author, Lubos Lunak (l.lunak@kdePLEASENOSPAM.org) described is as vaporware in a recent (20020114 interview), even though some older versions exist as tarballs.

See also:

  • Secret Tools, by Paul Evans on Linuxgazette for an article explaining that Khotkeys does exist on kde2, and with examples of how to use (unfortunately, the examples don't seem to support a keyboard macro, but only other capabilities of khotkey).
  • Internet Keyboards and KDE, Posted on 2002-01-20 18:15:01 by Linegod, but still no information on a keyboard macro.
  • Warped Systems: Internet Keyboards and KDE; 2002-01-20; Linegod -- example uses keyboard shortcuts to raise and lower mixer volume by running some scripts, for example:

aumix -v +5 -S

Now, if I could write scripts to put arbitrary strings into various applications at the current location of the cursor, that would be a step forward (but probably the long way around, as I might need a different script for each application (for each string). Ahh, but dcop might work in any kde application, and any non kde application written to handle dcop commands -- could be workable.


I had written to the developer of Klipper suggesting three enhancements, including assigning a macro key to each of the buffers in Klipper to allow easy selection and pasting. When I find the email I'll update this. He did seem to indicate he'd work on one of the suggestions -- a means to prevent a particular selection from being stored in Klipper, so you can avoid having your selections "scrolled" out of Klipper.


See Xcb

Some Emails re KHotKeys and Klipper

Email from Lubos Lunak

"out of the blue" I got an email from Lubos -- seems like kde makes an effort to pay attention to their "customers" (the reply from Carsten Pfeiffer reinforces the same idea)

Subject: keybindings - khotkeys stuff - volume control -a solution?
   Date: Tue, 22 Jan 2002 10:23:04 +0100
  From:  Lubos Lunak <l.lunak@sh.cvut.cz>
    To:  rhkramer@fast.net


somebody pointed me to the article at http://www.warpedsystems.sk.ca/article.php?thold=0&mode=nested&order=0&sid=475 and following some links from there, I've also found your post at

The version of KHotKeys shipped with KDE2.x (and KDE3.0) can only work in 
cooperation with KMenuEdit (or if you edit the config file directly), and
it can only launch commands. There's a new version under development, snapshot is available at http://dforce.sh.cvut.cz/~seli/en/khotkeys, and it will (hopefully and finally) be in KDE3.1. It includes all features from KDE1.x version (launching commands, activating windows, simulating keyboard input).
The snapshot is still for KDE2, but it's not yet in the shape it should be and it's quite poorly documented (there's an example config file for it though). You can try it if you want, but please read the README file first, which, even though a bit outdated, also describes how to install it over the version from kdebase. Once again, it's an unstable snapshot, so you'd be using it on your own risk, and in case you do, backup your old version including the configuration file.

 Feel free to forward this to the list if you want.

 Lubos Lunak
 l.lunak@email.cz ; l.lunak@kde.org

Email reply to Klipper Maintainer / Author Carsten Pfeiffer

Subject: Re: RFEs for Klipper -- Where Can I Send / Post Them?
Date:    Thu, 22 Nov 2001 11:46:19 -0500
From:    Randy Kramer <rhkramer@fast.net>
To:      Carsten Pfeiffer <carpdjih@sp.zrz.tu-berlin.de>
References: 1 , 2

Carsten Pfeiffer wrote: <br />
> sure. You could also use bugs.kde.org, but mailing me is just fine. Sorry for
> replying so late, I was kept too busy with others things the last weeks.

Not any problem at all -- thanks very much for the response!

All of your proposals sound wonderful -- I do have a comment on the
first (below).

> I could add a shortcut to enable/disable clipboard changes. Will do that
in a
> minute.

That is wonderful, but eventually you may want to take an approach that Windows users are more used to -- only add stuff to the clipboard when an explicit action (like <ctrl>c for copy or <ctrl>x for cut) is taken.  (Wish I had suggested that in my first response, and nothing wrong with what you are doing, it just may be more intuitive for (soon to be ex- ;-) )Windows users the other way -- maybe even eventually an option.)  (A discussion of cut and paste in Linux and Windows came up on abiword-dev which made me think I should mention this.)

_Aside: I don't know what happened somewhere about here to make all text after this italic.  Suspect it was a side effect of a cut and paste in Mozilla 0.9.8 that pasted my text in the wrong location.  Anyway, I'm not going to look for it, maybe this will fix it, and come on Mandrake 9.0._

> >       * Keyboard shortcuts automatically assigned to the different
> > "buffers" in Klipper, so I could select (and paste) the text from
> > different buffers with a single keyboard shortcut (<alt><1>, 2, 3, ...,
> > for example)
> Good idea. Selecting is easy, pasting not as easy. I could investigate
> the XTest extension to send a fake "paste" event to the currently focused
> window.

This would be wonderful!!

> I always wanted to add a listbox to kicker, where you could add strings
> would be kept (i.e. not not rotated away with subsequent clipboard
> Adding shortcuts to those should be easy.

This would be even more wonderful!!!  (Aside: I can imagine using a lot
of these strings, eventually more than one hundred.  Eventually it would

be nice to make the shortcuts configurable, allow more than one for the
same string, and have one allowed shortcut of the form (something like)
<ctrl><alt>nnn (like <ctrl><alt>124).  Even nicer if it allowed
<ctrl><alt>27 and did not require <ctrl><alt>027, but that's probably

> Certainly not like a rant, rather like some feature requests :)

Good!  (I do feel I should have done something more than just copying
and pasting what I wrote on twiki.)

> Actually, many other applications are starting to adopt DCOP as well. I
> xmms has some dcop plugin, an Afterstep author contacted the KDE team
> he wanted to add DCOP support, etc. KDE 3.0 will offer much easier and
> complete DCOP bindings, btw.

> I'll have a look at adding those features to KDE3's klipper.

I look forward to trying them -- maybe I'll even know how to update
Mandrake 7.2 to KDE3 by the time KDE3 is released!

Thanks very much for looking into these!

Randy Kramer

Carsten Pfeiffer's Reply to Me

< I saved it, but I haven't found it at this time -- the gist of it can be gotten from above.>

My Original Email to Carsten Pfeiffer

Subject: RFEs for Klipper -- Where Can I Send / Post Them?
   Date: Thu, 15 Nov 2001 10:48:38 -0500
  From:  Randy Kramer <rhkramer@fast.net>
    To:  carpdjih@cetus.zrz.TU-Berlin.DE


Sorry to approach you this way, but I've had trouble finding where
exactly to submit RFEs for Klipper.  Since I found your name associated
with Klipper I thought I'd try you.  

Oops, Ok, I found the place to submit bugs, but it doesn't want me to
submit any unless I update beyond KDE 2.1, which I won't do until I
upgrade my entire Linux installation (now Mandrake 7.2 with MandrakeFreq
update).  (I'm a Linux newbie -- I tried once to upgrade KDE on Mandrake
using RPMS -- it was not fun.)

So, I send this to you for what it's worth. 

Randy Kramer

(Aside: This was written as a comment on the twiki.org site, 
http://twiki.org/cgi-bin/view/Codev/TaggingRelatedTopics,  but I really
wanted to get it in front of the KDE developers.)

Thanks! I use Klipper in KDE -- it's nice, but not everything I'd hoped
for. Some problems off the top of my head (why I'm writing this here, I
don't know -- should send it to the KDE people -- I'll have to do that): 

   * (one is a "generic" problem with the default Cut and Paste method
in Linux) -- every time I select some new text, it "scrolls" the
selections in Klipper -- too often, by the time I'm ready to paste, the
selection I wanted to paste is either out of the buffer altogether, or
not at the top of the stack, so I have to switch to klipper, reselect
the selection I want to paste, and then paste. Three things would help: 

      * A means to (optionally) require that I do something besides
select text to have it placed in the Klipper buffer. 
      * Keyboard shortcuts automatically assigned to the different
"buffers" in Klipper, so I could select (and paste) the text from
different buffers with a single keyboard shortcut (<alt><1>, 2, 3, ...,
for example) 
      * The ability (or a different utility) to assign arbitrary strings
of text to keyboard shortcuts so the arbitrary text could be entered
into any application. I made a halfhearted effort to see if I could do
this with the built in Linux "utilities" (keymodmap or some such
things), but could not find a way to assign strings (multiple
characters) to a single keystroke (clearly, I could assign "commands"
(in one of the KDE utilities) or alternate keystrokes (in what ever it
was, the keymod thingie)), but not strings to be entered into

Anyway, thanks, didn't mean to make this sound like a rant. Guess I'll
go to KDE, try to check their bug database, see if these things are
already entered, and if not add them. (Unless they're already
implemented in KDE 2.2.) At least I've already got the text of my
request(s) written out. 

I did think about trying to do this with dcop, but, at the time, I
couldn't learn enough about dcop to see how to do this (or even be sure
it could be done), and, I think dcop would limit the use to just kde
applications (or other applications specifically written to utilize

xvkbd -xsendevent -text 'something\tor\tother'

An email (or rather, my reply to) "Rasmus Hansen" <morgengry@gmail.com>, on 08/25/07 at 01:49 pm:


Thanks, I appreciate the feedback!

Did you somehow use keyboard shortcuts to issue that command? (I'm guessing (but don't know for sure) that I might be able to do something along those lines by using kde's Keyboard Shortcuts (under Configure your Desktop) (I'm not sure if that is the facility provided by KHotKeys or something else).

I don't have much time at the moment--I may update that wiki page by simply pasting in my reply (which quotes your email)--if you object to that, let me know (I'll probably do it immediately), so later (you or I) will have to edit it appropriately to remove your words (but leave the thought) if you do object.

regards, Randy Kramer

On Saturday 25 August 2007 01:49 pm, you wrote: > I read you post at
> http://twiki.org/cgi-bin/view/Wikilearn/KeyboardMacrosInLinux and i realize
> its been a while since that post, but it still expressed the same problem
> that i had. I solved my problem using the program "xvkbd -xsendevent -text
> 'something\tor\tother'". Just a heads up if this is still an issue for you
> or if you want to edit your post or anything.

Things That Are Not What I'm Looking For


Scott Granneman (scott@grannemanPLEASENOSPAM.com) has asked that I notify him in the event I find something more. I'll send him a note today to look at this page again re xcb.


  • RandyKramer - 14 Jan 2002
  • <If you edit this page, add your name here, move this to the next line>
Edit | Attach | Watch | Print version | History: r14 < r13 < r12 < r11 < r10 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r14 - 2007-08-26 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look