سؤال

I'm having trouble with XMonad configuration.

Could you tell me what's wrong with this code? It compiles but it doesn't have the desired effects.

I didn't find anything similar on SO. So here it is:

     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)

Also tried this, but it doesn't compile:

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

I get this error:

      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 ())

And modMask = modMask4 (windows button)

Thanks for your help.

هل كانت مفيدة؟

المحلول

Found a solution to my problem..
Replaced this line

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

With

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

Also made the necessary imports

import Data.Map    (fromList)
import Data.Monoid (mappend)
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top