[xmonad] Ratpoison key emulation

Gwern Branwen gwern0 at gmail.com
Sat Sep 20 11:37:56 EDT 2008


On 2008.09.19 15:40:25 -0500, Spencer Janssen <spencerjanssen at gmail.com> scribbled 2.0K characters:
> On Fri, Sep 19, 2008 at 02:33:00PM -0400, Gwern Branwen wrote:
...
> If I might suggest a few name changes:
>     - change sendKeyScreen to sendKey
>     - change sendKeysym to sendKeyWindow

Good suggestions. I've done so. I also did a copy-replace of 'paste' for 'send', to assist people in searching. I suspect many more people will think 'paste' than 'send', even if the low-level X functions are named in terms of the latter.

> > My first question is, is there any way to scrap all the KeyMask plumbing? I looked at the X11 docs, but there doesn't seem to be any null modmask - mod1Mask is Alt, Shift is Shift, and so on.
>
> KeyMask is a bitmask, so 0 is the no modifiers pressed state.  I'd also leave
> the KeyMask argument on sendKeysym and sendKeyscreen -- some users want to send
> keys with modifiers (eg. the person that started this thread).

Ah. I feel a little guilty bypassing the Mod* types to plug in in a 0, but it works, it seems.

> > My second question is, why does 'keysymToKeycode' take a String? I manually played around with it in GHCi and it seems every String which isn't a Char always gets evaluated to '0'.
>
> I assume you mean stringToKeysym.  Try: stringToKeysym "F1".  You should
> probably filter out the 0 results when sending a string, or perhaps throw an
> error.
>
> Cheers,
> Spencer Janssen

Maybe. It's not really an issue for this code, is it? Since the type only takes Char, one cannot make it run stringToKeysym on a invalid string like "foo". And the functions lower down are in terms of Keysyms. (Although I wonder if perhaps that bit of functionality should be explored in the X11 haddocks. I didn't notice anything in particular.)

----

Well, anyway. I've sent in a module if people want to look at it.

--
gwern
Bluebird 5707 Kosovo Zemin XM Guppy Internet NVD ABC SGI
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/xmonad/attachments/20080920/c8dcde00/attachment.bin


More information about the xmonad mailing list