Advertisement
Guest User

Untitled

a guest
Oct 30th, 2011
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- The following is required for the configuration of GridSelect
  2. {-# LANGUAGE NoMonomorphismRestriction #-}
  3.  
  4. -- The first three imports are for the viewShift manageHook; see below.
  5. import Control.Monad (liftM2)
  6. import qualified Data.Map as M
  7. import qualified XMonad.StackSet as W
  8. import XMonad
  9. --import XMonad.Actions.DynamicWorkspaces
  10. import XMonad.Actions.GridSelect
  11. --import XMonad.Actions.NoBorders
  12. import XMonad.Hooks.InsertPosition
  13. import XMonad.Layout.Combo
  14. import XMonad.Layout.DragPane
  15. import XMonad.Layout.LayoutCombinators hiding ( (|||) )
  16. import XMonad.Layout.MouseResizableTile
  17. import XMonad.Layout.NoBorders
  18. import XMonad.Layout.SimpleDecoration
  19. import XMonad.Layout.Tabbed
  20. import XMonad.Layout.WindowNavigation
  21. import XMonad.Prompt
  22. import XMonad.Prompt.XMonad
  23. import XMonad.Util.EZConfig
  24. import XMonad.Util.Scratchpad
  25. import System.IO
  26.  
  27. -------------------------------------------------
  28. -- Theme Settings
  29. -------------------------------------------------
  30. myActiveBGColor          = "#333333"
  31. myInactiveBGColor        = "#000000"
  32. myUrgentBGColor          = "#ff0000"
  33. myActiveBorderColor      = "#0077ff"
  34. myInactiveBorderColor    = "#555555"
  35. myActiveTabBorderColor   = myInactiveBorderColor
  36. myInactiveTabBorderColor = myActiveBGColor
  37. myUrgentTabBorderColor   = myUrgentTextColor
  38. myActiveTextColor        = myActiveBorderColor
  39. myInactiveTextColor      = myInactiveBorderColor
  40. myUrgentTextColor        = "#ffffff"
  41. myFontName               = "drift"
  42. myDecoHeight             = 15
  43. myDecoWidth              = 1024
  44.  
  45. -- Window Decoration Config (in simpleDecoration layout)
  46. mySDConfig = defaultTheme { activeColor         = myActiveBGColor
  47.                           , inactiveColor       = myInactiveBGColor
  48.                           , urgentColor         = myUrgentBGColor
  49.                           , activeBorderColor   = myActiveTabBorderColor
  50.                           , inactiveBorderColor = myInactiveTabBorderColor
  51.                           , urgentBorderColor   = myUrgentTabBorderColor
  52.                           , activeTextColor     = myActiveTextColor
  53.                           , inactiveTextColor   = myInactiveTextColor
  54.                           , urgentTextColor     = myUrgentTextColor
  55.                           , fontName            = myFontName
  56.                           , decoHeight          = myDecoHeight
  57.                           , decoWidth           = myDecoWidth
  58.                           }
  59.  
  60. -- Dmenu Config
  61. myDmenuRun = "dmenu_run -i -b -fn '" ++ myFontName ++ "' -nb '"
  62.                                      ++ myInactiveBGColor ++ "' -nf '"
  63.                      ++ myInactiveTextColor ++ "' -sb '"
  64.                      ++ myActiveBGColor ++ "' -sf '"
  65.                      ++ myActiveTextColor ++ "'"
  66.  
  67. -- Colorizer for GridSelect
  68. myColorizer = colorRangeFromClassName
  69.                       (0x00,0x00,0x00) -- lowest inactive bg
  70.                       (0x22,0x22,0x22) -- highest inactive bg
  71.                       (0x33,0x33,0x33) -- active bg
  72.                       (0x55,0x55,0x55) -- inactive fg
  73.                       (0x00,0x77,0xff) -- active fg
  74.    where black = minBound
  75.          white = maxBound
  76.  
  77. -- GridSelect Config
  78. myGSConfig colorizer = (buildDefaultGSConfig colorizer) { gs_cellheight = 30
  79.                                                         , gs_cellwidth  = 300
  80.                                                         , gs_font       = myFontName
  81.                                                         }
  82.  
  83. -- Tab Config (For tabbed layout)
  84. myTabConfig = defaultTheme { activeColor         = myActiveBGColor
  85.                            , inactiveColor       = myInactiveBGColor
  86.                            , urgentColor         = myUrgentBGColor
  87.                            , activeBorderColor   = myActiveTabBorderColor
  88.                            , inactiveBorderColor = myInactiveTabBorderColor
  89.                            , activeTextColor     = myActiveTextColor
  90.                            , inactiveTextColor   = myInactiveTextColor
  91.                            , urgentTextColor     = myUrgentTextColor
  92.                            , fontName            = myFontName
  93.                            , decoHeight          = myDecoHeight
  94.                            }
  95.  
  96. -- Twmnc Config (twmn is a notification program for tiling window managers. Below is a pop-up statusbar which only comes when called.
  97. -- It depends on a program called 'status', but it could also take the output of conky or similar.)
  98. myTwmnOptions = "--fn " ++ myFontName ++ " --pos bottom_right --bg '"
  99.                          ++ myActiveBGColor ++ "' --fg '"
  100.              ++ myActiveTextColor ++ "'"
  101. myTwmnStatus  = "twmnc -d 5000 -c \"$(status)\" " ++ myTwmnOptions
  102.  
  103. -- XMonad Prompt Config
  104. myXPConfig = defaultXPConfig { font = myFontName
  105.                            , bgColor = myInactiveBGColor
  106.                , fgColor = myInactiveTextColor
  107.                , fgHLight = myActiveTextColor
  108.                , bgHLight = myActiveBGColor
  109.                , borderColor = myActiveTabBorderColor
  110.                , promptBorderWidth = myBorderWidth
  111.                , position = Bottom
  112.                , height = myDecoHeight
  113.                            }
  114.  
  115. -------------------------------------------------
  116. -- Other Settings
  117. -------------------------------------------------
  118. -- Borders
  119. myBorderWidth        = 1
  120. myFocusedBorderColor = myActiveBorderColor
  121. myNormalBorderColor  = myInactiveBorderColor
  122. -- Layouts
  123. myLayoutHook         = noBorders (tabbed shrinkText myTabConfig) |||
  124.                        simpleDeco shrinkText mySDConfig (mouseResizableTile) |||
  125.                        --windowNavigation (combineTwo (dragPane Vertical 0.9 0.6) (tabbed shrinkText myTabConfig) (tabbed shrinkText myTabConfig))
  126.                        (simpleDeco shrinkText mySDConfig Full) *||* (tabbed shrinkText myTabConfig)
  127.                        --(tabbed shrinkText myTabConfig) *||* (simpleDeco shrinkText mySDConfig Full)
  128.  
  129. -- Hooks
  130. newManageHook        = insertPosition End Newer <+> myManageHook
  131. myManageHook         = composeAll [ className =? "luakit"  --> viewShift "2:www"
  132.                                   , className =? "Firefox" --> viewShift "2:www"
  133.                   ]
  134.                                 where viewShift = doF . liftM2 (.) W.greedyView W.shift
  135. -- Miscellaneous
  136. myModMask            = mod4Mask
  137. myBrowser            = "lk"
  138. myFirefox            = "twmnc -c 'Starting Firefox...' & ff"
  139. myTerminal           = "urxvtcd -e tmauto"
  140. myOtherTerminal      = "urxvtcd"
  141. myTwmnd              = "if [ -z $(pgrep twmnd) ] ; then (twmnd &) ; fi"
  142. myWorkspaces         = [ "1:term"
  143.                        , "2:www"
  144.                , "3:misc1"
  145.                , "4:misc2"
  146.                ]
  147.  
  148. -- Main Function
  149. main = do
  150.     spawn myTwmnd
  151.     xmonad $ defaultConfig
  152.         { focusedBorderColor = myFocusedBorderColor
  153.         , normalBorderColor  = myNormalBorderColor
  154.         , layoutHook         = myLayoutHook
  155.         , manageHook         = newManageHook
  156.         , modMask            = myModMask
  157.         , terminal           = myTerminal
  158.         , workspaces         = myWorkspaces
  159.         }
  160.         `additionalKeys`
  161.     [ ((myModMask,                  xK_b),      spawn myBrowser)
  162.     , ((myModMask .|. shiftMask,    xK_b),      spawn myTwmnStatus)
  163.     , ((myModMask,                  xK_f),      spawn myFirefox)
  164.         , ((myModMask,                  xK_g),      goToSelected $ myGSConfig myColorizer)
  165.         , ((myModMask .|. shiftMask,    xK_g),      bringSelected $ myGSConfig myColorizer)
  166.     , ((myModMask,                  xK_p),      xmonadPrompt myXPConfig)
  167. --  , ((myModMask,                  xK_w),      selectWorkspace myXPConfig)
  168.     , ((myModMask,                  xK_x),      spawn myDmenuRun)
  169.     , ((myModMask,                  xK_Left),   sendMessage $ Go L)
  170.     , ((myModMask,                  xK_Right),  sendMessage $ Go R)
  171.     , ((myModMask .|. controlMask,  xK_Left),   sendMessage Shrink)
  172.     , ((myModMask .|. controlMask,  xK_Right),  sendMessage Expand)
  173.     , ((myModMask .|. controlMask,  xK_Return), spawn myOtherTerminal)
  174.         ]
  175.     `removeKeys`
  176.     [ (myModMask,               xK_e)
  177.     , (myModMask,               xK_h)
  178.     , (myModMask,               xK_l)
  179.     ]
  180.  
  181.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement