2012-07-04 45 views
0

我在使用XMonad配置時遇到問題。XMonad鍵綁定不起作用

你能告訴我這段代碼有什麼問題嗎?它編譯但沒有預期的效果。

我沒有在SO上找到類似的東西。所以在這裏,它是:

 myConfig = azertyConfig { modMask = mod4Mask 
        , layoutHook = myLayoutHook 
        , workspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"] 
        , terminal = "urxvt" 
        , startupHook = setWMName "LG3D" 
        , manageHook = myManageHook <+> manageHook azertyConfig 
        } `additionalKeysP` myKeys 

    myXPConfig = defaultXPConfig 

    myManageHook = composeAll 
      [ className =? "emulator-arm" --> doFloat 
      , className =? "Sylpheed" --> doShift "2:email" 
      , className =? "Pidgin" --> doShift "3:im" 
      , className =? "Opera" --> doShiftAndGo "4:web" 
      , manageDocks 
      ] where doShiftAndGo ws = doF (W.greedyView ws) <+> doShift ws 

    myKeys = [ ("M-p", shellPrompt defaultXPConfig) 

     -- sublayouts 
    , ("M-xK_F10", raiseVolume 4 >> return()) 
    , ("M-xK_F11", lowerVolume 4 >> return()) 
    -- more codes 

    myLayoutHook = avoidStruts $ windowNavigation $ subTabbed $ 
      (smartBorders tall ||| smartBorders threeCol ||| noBorders Full) 
    where 
     tall  = Tall nmaster delta ratio 
     threeCol = ThreeCol nmaster delta ratio 
     nmaster = 1 
     delta = 3/100 
     ratio = 1/2 

    main = xmonad =<< xmobar (withUrgencyHook NoUrgencyHook $ myConfig) 

也試過這個,但它並不編譯:

 , ((modMask, xK_F10), raiseVolume 3 >> return()) 
    , ((modMask, xK_F11), lowerVolume 3 >> return()) 

我得到這個錯誤:

 Couldn't match expected type `[Char]' with actual type `(t0, t1)' 
     In the expression: (modMask, xK_F10) 
     In the expression: (modMask, xK_F10), raiseVolume 3 >> return()) 

而且modMask = modMask4(windows鍵)

感謝您的幫助。

回答

0

找到了解決我的問題..
替換該行

main = xmonad =<< xmobar (withUrgencyHook NoUrgencyHook $ myConfig) 

隨着

main = xmonad =<< xmobar (withUrgencyHook NoUrgencyHook $ myConfig){ keys = 
keys myConfig `mappend` 
\c -> fromList [ 
    ((mod4Mask, xK_F11), lowerVolume 4 >> return()), 
    ((mod4Mask, xK_F10), raiseVolume 4 >> return()) 
] 
} 

也做了必要的進口

import Data.Map (fromList) 
import Data.Monoid (mappend)