[Xmonad] darcs patch: add XSelection.hs

Gwern Branwen gwern0 at gmail.com
Sun Oct 21 16:01:38 EDT 2007


On 2007.09.29 13:07:51 +0200, Andrea Rossato <mailing_list at istitutocolli.org> scribbled 0 lines:
> Hi Gwern,
>
> first of all sorry if I come back to our Xselection stuff so late, but
> the new class branch was quite a huge job form me (I also need to get
> to understand what I'm doing before actually doing it, and that
> unusually takes more time then the actual getting things done, if you
> know what I mean.. :)
>
> On Sat, Sep 22, 2007 at 04:11:49PM -0400, Gwern Branwen wrote:
> > > we should at least share the copyright...;-)
> >
> > Well, like I've said before: I'm not a huge fan of copyright, and I
> > put everything into the public domain. So no need to credit me.
>
> Well, me too (I'm a lawyer after all), but I don't want to take
> credits for others' job. Anyway I'll respect your decision here.
>
> >  import Control.Exception as E (catch)
> > ...
> >  ty ??? E.catch
> >                (E.catch
> >                      (internAtom dpy "sTring" False)
> >                      (??_ ??? internAtom dpy "COMPOUND_TEXT" False???
> >              (??_ ??? internAtom dpy "UTF8_STRING" False)
>
> This seems fine to me.
>
> > I mean, this seems to compile and to do the right thing, but it
> > looks kind of ugly. Does this actually help for anything? What
> > systems that could run XMonad wouldn't return some sort of UTF-8
> > string?
>
> Well, as far as I know, and if I understand the point you are making,
> it is the application that must provide the UTF8_STRING property.
> Since we call internAtom with a False, if that application doesn't
> provide an UTF8_STRING, xmonad is going to crash - am I right here?
> I'm thinking about legacy application some user may be running, and
> then she comes up with a bug you cannot even chase..:)
>
> But I repeat it, I may be wrong.
>
> > I recently thought of another thing, though. I use Surfraw elvi
> > (<https://secure.wikimedia.org/wikipedia/en/wiki/Surfraw>) a lot for
> > running Wikipedia and Google searches, and wayback even when I was
> > using Ratpoison lo those many years ago, I had problems with my
> > queries sometimes containing shell metacharacters. This was a
> > problem with ratpoison, StumpWM and XMonad all because the obvious
> > and easy way is to go through whatever their equivalent of 'spawn'
> > is.
> >
> > So I wrote a 'safeSpawn' which avoids the shell:
> >
> >  safeSpawn :: FilePath -> String -> X ()
> >  safeSpawn prog arg = io (try (forkProcess $ executeFile prog True [arg] Nothing) >> return ())
>
> There's a module I contributed, RunInXTerm. I'm wondering if this
> function wouldn't be perfect for that module (function to be exported
> for other to use) more then in Xselection.
...

Yes, I've been thinking about that a lot lately. I recently sent some patches in for XMonadContrib which implements that suggestion.

--
gwern
Centro RPC RAID piz Scully Fiel Fiel CTP GCHQ IWG
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20071021/b7841ee8/attachment.bin


More information about the Xmonad mailing list