[xmonad] Re: two beginner's questions on XMonad config

Brent Yorgey byorgey at seas.upenn.edu
Fri Dec 12 18:59:54 EST 2008


On Fri, Dec 12, 2008 at 12:53:15AM +0000, Riccardo Murri wrote:
> Riccardo Murri <riccardo.murri at ...> writes:
> > 1) Since I have no modifier keys left on my laptop, and I'm an Emacs
> > user (which takes away many C- and M- keybindings), I'd like to bind
> > most XMonad actions with "C-z" as a prefix (using EZConfig).
> > 
> > Is there a way to bind a key so that "C-z C-z" sends a C-z to the
> > currently focused window? (Ratpoison has a similar feature for C-t)
> > 
> 
> I did some googling and found out that:
> 
> 1) the quickest solution is to use "xdotool"
> [http://www.semicomplete.com/projects/xdotool/], which can (among
> other nifty things), send a fake keypress to the currently focused
> window::
> 
>   ("C-z C-z", spawn "xdotool key ctrl+z")
> 

Nifty!  Would you mind adding this to the FAQ page on the wiki as a
lightweight solution?  Many people have asked for this.

> 
> 2) According to:
> 
>   http://www.handhelds.org/moin/moin.cgi/GeneratingSyntheticX11Events
> 
> there are two Xlib programmatic solution, one using the XTest
> extension (recommended), and one using XSendEvent().  As far as I
> understand, there are no bindings for XTest in the Graphics.X11
> module, so one has to code using sendEvent...
> 
> With the following code, I have been able to send a Ctrl+Z to urxvt
> and "xev" windows directly from XMonad::

I could have sworn there was already a contrib module that does this,
using code similar to what you wrote.  But I can't find it.  Perhaps
it just got kicked around on the ML but never actually made it into
the repo.  Anyway, the xdotool is a nice solution regardless.

-Brent


More information about the xmonad mailing list