[xmonad] Re: Emergency terminal
Brent Yorgey
byorgey at gmail.com
Tue Feb 19 17:41:14 EST 2008
On Fri, Feb 15, 2008 at 11:02 PM, Braden Shepherdson <
Braden.Shepherdson at gmail.com> wrote:
> Don Stewart wrote:
> > xmonad-bounces:
> >> The attached message has been automatically discarded.
> >> Date: Fri, 15 Feb 2008 08:45:01 +0200
> >> From: Salvatore Iovene <salvatore.iovene at googlemail.com>
> >> To: xmonad at haskell.org
> >> Subject: Emergency terminal
> >>
> >> Hi all,
> >> sometimes I need to open a terminal window just for a quick task (i.e.
> >> quickly view an image). Using Mod+p and opening a dmenu is not really
> >> good for that (lack of good completation support) and I don't want to
> >> open a new terminal that will change the existing layout (not good on
> >> the eye).
> >>
> >> The ideal solution would be having a special key that'd fire up a
> >> floating terminal on the bottom of the screen, only, say, 5 lines
> >> high, so you could quickly give your command without interfering with
> >> the existing layout.
> >>
> >> Is there anything like this already around?
> >> Thanks!
> >>
> >
> > There's been much talk about a 'scratchpad' terminal.
> > This doesn't exist, but would be easy to implement as
> > an extension -- just open up a terminal with a
> > property set on it, then write a manageHook rule that
> > looks for that property, and positions the window as floating,
> > and with particular geometry.
> >
> > This would be a great extension to have, if someone
> > would like to write it.
> >
> > -- Don
>
>
> This will find its way onto the wiki and/or into Contrib eventually, but
> here's code and instructions for now.
>
This is great! If you're up to it, please package this as a contrib module,
probably in XMonad.Util. If you're not sure how to do that, or need any
help just send an e-mail or ask in the #xmonad channel on irc.freenode.net.
This should definitely go in the xmonad-contrib library as opposed to on the
wiki.
> Add the following manageHook entry:
>
> title =? "scratchpad" --> doRectFloat scratchpadRect
>
You could give this rule a name like 'manageScratchpad' (maybe two versions,
one with a default rectangle and one that takes the rectangle as a
parameter) so users could just drop that into their manageHook.
>
> and the following functions
>
> doRectFloat :: W.RationalRect -> ManageHook
> doRectFloat r = ask >>= \w -> doF (W.float w r)
>
> scratchpadRect :: W.RationalRect
> scratchpadRect = W.RationalRect 0.25 0.375 0.5 0.25
>
doRectFloat should perhaps eventually go into ManageHook in the core, but
for now I think it's fine to put it in a contrib module.
>
> and the following keys entry:
>
> (( modMask, xK_s ), unsafeSpawn $ terminal conf ++ " -title scratchpad")
>
Again, you could define a function that performs this spawn and export it
from the contrib module, so users can just drop it into their keybindings
list with minimal effort.
> I'm not sure how easily this could be bundled into a contrib package. It
> seems like it might be better just as an example minimal config for
> others to merge with their own.
> I'm willing to package it up, but I don't have any experience sending
> darcs patches or uploading to hackage yet.
No uploading to hackage necessary here! =) Just make sure you have the
latest darcs sources (instructions for getting them are on xmonad.org; to
get the latest patches just do a 'darcs pull'). Once you've made the
changes you'd like, do a 'darcs add' to add any new files you created to the
repository, then do 'darcs record' to record your changes into a patch.
Finally, 'darcs send' will send your patch to the mailing list (if you have
a mail agent configured correctly to do this; otherwise you can just do
'darcs send -o /path/to/some/file.dpatch' and then manually attach the
generated file to a message to the list. Again, if you need any help, don't
hesitate to ask!
as are critiques of my code (it seems like my
> doRectFloat should exist in contrib already somewhere, this can't be the
> first time someone's wanted that feature).
>
The code looks great. And you'd be surprised how many obvious, simple, yet
really nice features there are that no one's thought of or wanted yet. =)
-Brent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/xmonad/attachments/20080219/f823dcc1/attachment-0001.htm
More information about the xmonad
mailing list