You are not logged in.

#1 2011-07-27 17:42:37

pharaooo
Member
Registered: 2011-07-27
Posts: 2

xmonad: initialize workspace

I recently started using xmonad (without proper knowledge of haskell, nevertheless I love it already). I would like to use my function keys F1,..,F12 in the following way:

The first time I press F1,...,F12 they initialize a workspace by launching a program on a workspace and switching to it; all the other times, it has the same behaviour as mod+workspace number, i.e. it simply switches to the workspace. E.g. pressing F1 creates workspace number 1 by starting firefox there, pressing F1 a second times just switches to worskpace nr 1, etc.
My initial try was with additionalKeys

...
main = do
      xmproc <- spawnPipe "xmobar"
      xmonad $ defaultConfig
              { manageHook = myManageHook <+> manageHook defaultConfig
              , layoutHook = avoidStruts  $  layoutHook defaultConfig
              , logHook = dynamicLogWithPP xmobarPP
                              { ppOutput = hPutStrLn xmproc
                              , ppTitle = xmobarColor "green" "" . shorten 50
                              }
              , workspaces = myWorkspaces
              , startupHook= myStartupHook
              , modMask = mod4Mask --rebind windows key                                                                                    
              } `additionalKeysP`
              [ ("<F1>", create_workspace1)
                 ...
              ]

The trouble I have is to define create_workspace1,...,create_workspace12, especially it seems like I need a replacement for counter of the function calls (the first time F1 is pressed it creates the workspace by launching the programs there and all the other it just switch to the workspace)?

Offline

Board footer

Powered by FluxBB