[xmonad] Fwd: How to use onScreen function on startup?

kevind256 kevind256 at gmail.com
Sun Dec 12 14:19:12 CET 2010


As far as I understand it, you're shifting windows to different
workspaces upon these applications' startup. What I wanted is to
assign a workspace to a screen at xmonad's startup. So I do not see
connection between this and your example. ManageHook (apparently)
isn't used at xmonad startup, instead just 'main' is called, but
something's wrong with my understanding of this all. Thank you for
responce anyway.

On 12/12/10, Felix Blanke <felixblanke at gmail.com> wrote:
> Hi,
>
> I'm not that familiar with  haskell or xmonad, but I can tell you how I do
> that :)
>
> -- Hooks --
> manageHook' :: ManageHook
> manageHook' = composeAll .concat $
> [ --app placement
>     [   className =? c --> doF (W.shift "2-web")        | c <- webApps
> ]
>     , [ className =? c --> doF (W.shift "3-mail")       | c <- mailApps
> ]
>     , [ resource  =? c --> doF (W.shift "4-multimedia") | c <-
> multimediaApps ]
>     , [ className =? c --> doF (W.shift "5-IM")         | c <- imApps
> ]
>     , [ className =? c --> doF (W.shift "6-windows")    | c <- windowsApps
> ]
>     ]
>
> webApps     = ["Opera"]
> mailApps    = ["Claws-mail", "mutt"]
> multimediaApps = ["mocp"]
> windowsApps = ["VirtualBox"]
> imApps      = ["Skype"]
>
>
>
> I think that isn't that hard to understand :)
>
> "W" comes from "import qualified XMonad.StackSet as W"
>
>
> Then just load that ManageHook in your main.
>
> If you have any further question feel free to ask.
>
>
> Felix
>
>
>
> On 12. December 2010 - 09:34, kevind256 wrote:
>> Date: Sun, 12 Dec 2010 09:34:46 +0300
>> From: kevind256 <kevind256 at gmail.com>
>> To: xmonad at haskell.org
>> Subject: [xmonad] Fwd: How to use onScreen function on startup?
>>
>> ---------- Forwarded message ----------
>> From: kevind256 <kevind256 at gmail.com>
>> Date: Sat, 11 Dec 2010 13:37:55 +0300
>> Subject: How to use onScreen function on startup?
>> To: xmonad at haskell.org
>>
>> Hi,
>>
>> Sorry to ask question out of total lack of knowledge of Haskell, but
>> how do I use a function (in this case onScreen from
>> XMonad.Actions.OnScreen) at xmonad startup? I's like to assign the
>> last workspace to second screen by default, since it's really
>> secondary in my setup (music player is there usually).
>>
>> I tried putting this in main = do { ... } section:
>> onScreen 1 "9";
>>
>> but got this long error message (till end of this post):
>> Error detected while loading xmonad configuration file:
>> /home/kevin/.xmonad/xmonad.hs
>>
>> xmonad.hs:30:1:
>>     Couldn't match expected type `IO a'
>>            against inferred type `i
>>                                   -> XMonad.StackSet.StackSet i l a1
>> [Char] sd
>>                                   -> XMonad.StackSet.StackSet i l a1
>> [Char] sd'
>>     In a stmt of a 'do' expression: onScreen 1 "9"
>>     In the expression:
>>         do { xmproc <- spawnPipe "xmobar";
>>              onScreen 1 "9";
>>                xmonad
>>              $   defaultConfig
>>                    {normalBorderColor = "black", focusedBorderColor =
>> "red2",
>>                     borderWidth = 2, modMask = modm, focusFollowsMouse =
>> False,
>>                     manageHook = manageDocks <+> manageHook defaultConfig,
>>                     layoutHook = avoidStruts $ simpleTabbed ||| Tall 1
>> 5.0e-2 0.5,
>>                     logHook = dynamicLogWithPP
>>                             $ xmobarPP
>>                                 {ppOutput = hPutStrLn xmproc,
>>                                  ppTitle = xmobarColor "white" "" .
>> shorten 100}}
>>                `additionalKeys`
>>                  [((modm, xK_a), spawn "aumix -v-2"),
>>                   ((modm, xK_f), spawn "aumix -v+2"), ....] }
>>     In the definition of `main':
>>         main = do { xmproc <- spawnPipe "xmobar";
>>                     onScreen 1 "9";
>>                       xmonad
>>                     $   defaultConfig
>>                           {normalBorderColor = "black",
>> focusedBorderColor = "red2",
>>                            borderWidth = 2, modMask = modm,
>> focusFollowsMouse = False,
>>                            manageHook = manageDocks <+> manageHook
>> defaultConfig,
>>                            layoutHook = avoidStruts $ simpleTabbed |||
>> Tall 1 5.0e-2 0.5,
>>                            logHook = dynamicLogWithPP
>>                                    $ xmobarPP
>>                                        {ppOutput = hPutStrLn xmproc,
>>                                         ppTitle = xmobarColor "white"
>> "" . shorten 100}}
>>                       `additionalKeys`
>>                         [((modm, xK_a), spawn "aumix -v-2"), ....] }
>>
>> Please check the file for errors.
>>
>> _______________________________________________
>> xmonad mailing list
>> xmonad at haskell.org
>> http://www.haskell.org/mailman/listinfo/xmonad
> ---end quoted text---
>



More information about the xmonad mailing list