[xmonad] Re: Emergency terminal
Braden.Shepherdson at gmail.com
Fri Feb 15 23:02:30 EST 2008
Don Stewart wrote:
>> 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?
> 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.
Add the following manageHook entry:
title =? "scratchpad" --> doRectFloat scratchpadRect
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
and the following keys entry:
(( modMask, xK_s ), unsafeSpawn $ terminal conf ++ " -title scratchpad")
to your xmonad.hs.
This assumes you have StackSet imported as W. If you don't, you'll have
to change the qualifier (or remove it) as necessary.
If you use urxvt, rxvt or xterm, they support the -title parameter. Most
others probably will as well, following xterm's lead.
Then mod+s should spawn a floating terminal window in the center of the
active workspace, half-screen wide and quarter-screen tall. This sizing
and position can be customized by modifying scratchpadRect.
I'm still learning Haskell, and just getting my feet wet hacking xmonad.
I learned a good bit doing this, and I'm also going to keep this live in
my config; it's really handy.
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. Though I suppose I have to
learn some time.
Advice on whether this is better submitted as a contrib patch or a wiki
entry is most welcome, 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).
More information about the xmonad