XMonad键绑定不起作用

时间:2012-07-04 22:16:30

标签: key-bindings 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按钮)

感谢您的帮助。

1 个答案:

答案 0 :(得分: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)