[Xmonad] dragging in X instead of IO

David Roundy droundy at darcs.net
Mon Aug 6 20:17:05 EDT 2007

Hi all,

I've done a bit of xmonad hacking at home recently (where I no longer have
an internet connection), and thought I'd mention what I've done, and see
what other developers think.

Basically, I've been hacking on the dragging code, which seems pretty ugly
to me.  I added a "dragging" datum of type

 Maybe (Position -> Position -> X (), X ())

which is usually Nothing, but if we're in the process of dragging
something, the first is a callback function for motion events, and the
second is a callback for the button release event (which is assumed to
terminate the dragging).

The result is that moving and resizing windows doesn't interrupt xmonad's
regular event loop, and means (among other things) that tabs get redrawn
while moving float windows (for instance if the float window gets moved
over the tab like an eraser).  This is a bugfix, but not of a very relevant

The real motivation is to allow dragging interactions as a first-class UI
citizen.  In particular, I would like to have a draggable version of
TwoPane, which would send special resize Messages as the user drags the
border between the two panes.  This will be particularly helpful with Combo
layouts, since I haven't found a useful way to make the keyboard bindings
for resizing panes work with Combo (no useful way to tell which Layout
you're talking to).  But it's also nice for just a vanilla TwoPane (except
I'm making a new Layout, of course, so you happy TwoPane users won't be
bothered), since the mouse has considerably higher bandwidth than the
keyboard (i.e. there isn't the tradeoff between a high delta so you can
quickly resize and a low delta so you can accurately resize).

It'd also be handy for things like a XMonadContrib floating layout with
title bars on the windows (which would hopefully eventually be a candidate
for replacing the default float layout via Config modification).

Anyhow, since this is a change in a pretty core bit of xmonad, I thought I
should mention it, even though I can't yet send in patches.  Suggestions
will be welcome (or someone who wants to reimplement this
themselves... since I won't be able to read any suggestions at home...).
I'll be back into the world of home internet connectivity after I move in a
couple of weeks, so that's when you can expect to get patches (I could
bring my laptop into work, but I'm really busy just now...).
David Roundy
Department of Physics
Oregon State University

More information about the Xmonad mailing list