[xmonad] ManageHook and doF
Jan-David Quesel
quesel at gmail.com
Wed Jan 26 11:29:06 CET 2011
On Wed, Jan 26, 2011 at 07:43:27PM +1000, Владимир Байраковский wrote:
> I have manageHook like this:
>
> myManageHook = composeAll [
> className =? "Firefox" --> doF(W.shift "web"),
> className =? "Gajim.py" --> doF(W.shift "chat"),
> className =? "Deadbeef" --> doF(W.shift "music"),
> title =? "Gajim" --> doFloat,
> className =? "MPlayer" --> doCenterFloat,
> ]
>
> so, if some workspace does not exist by some reason, the new window
> will appear on current workspace. How to chek if workspace exists and
> create it before "W.shift" action?
> I think addWorkspace from XMonad.Actions.DynamicWorkspaces can do
> this, but I don't know haskell well to write some function that can be
> used with doF.
Something along these lines should work:
shiftAndcreateIfMissing x = withWindowSet $ \w -> do
when(x `notElem` (map show $ map W.tag $ W.workspaces)) $ addHiddenWorkspace x
W.shift x
and then just do something like
doF(shiftAndcreateIfMissing "web")
for your managehook. (code is untested though...)
You need to import some function from X.A.DynamicWorkspaces and Data.List.
Best regards,
Jan
--
Jan-David Quesel
Carl von Ossietzky Universität Oldenburg
Department of Computing Science
Correct System Design
D-26111 Oldenburg, Germany
Phone: +49 (0)441 798-2376
Fax: +49 (0)441 798-2965
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://www.haskell.org/pipermail/xmonad/attachments/20110126/3723dd40/attachment.pgp>
More information about the xmonad
mailing list