Personal tools

Xmonad/Config archive/Ray's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
 
(updated my config)
Line 1: Line 1:
 
<haskell>
 
<haskell>
import XMonad
+
import XMonad
import XMonad.Layouts
+
import XMonad.Layouts
import XMonad.Operations
+
import XMonad.Operations
import XMonad.Hooks.DynamicLog
+
import XMonad.Hooks.DynamicLog
import XMonad.Layout.NoBorders
+
import XMonad.Layout.NoBorders
import qualified XMonad.StackSet as W
+
import XMonad.Prompt
import Graphics.X11
+
import XMonad.Prompt.Ssh
import Data.Ratio
+
import XMonad.Prompt.XMonad
+
import qualified XMonad.StackSet as W
main = xmonad $ defaultConfig
+
import Graphics.X11
{ normalBorderColor = "#333333"
+
import qualified Data.Map as M
, focusedBorderColor = "#0000ff"
+
import System.IO.UTF8
, workspaces = ["term", "web"] ++ map show [3..9]
+
import Data.Ratio
, terminal = "rayterm"
+
import Data.Bits
, defaultGaps = [(18,0,0,0)]
+
, modMask = mod4Mask
+
main = xmonad rayConfig
, manageHook = rayManageHook
+
, logHook = dynamicLog
+
rayConfig = defaultConfig
, layoutHook = Layout
+
{ normalBorderColor = "#333333"
$ Mirror (Tall 1 0 (1%2))
+
, focusedBorderColor = "#0000ff"
||| (noBorders Full)
+
, workspaces = ["α","β","γ","δ","ε","ζ"]
}
+
, terminal = "rayterm"
+
, defaultGaps = [(18,0,0,0)]
rayManageHook :: Window -- ^ the new window to manage
+
, modMask = mod4Mask
-> String -- ^ window title
+
, manageHook = rayManageHook
-> String -- ^ window resource name
+
, logHook = dynamicLogWithPP rayPP
-> String -- ^ window resource class
+
, keys = \c -> rayKeys c `M.union` keys defaultConfig c
-> X (WindowSet -> WindowSet)
+
, layoutHook = Layout
rayManageHook w _ _ c | c `elem` floats = fmap (W.float w . snd) (floatLocation w)
+
$ Mirror (Tall 1 0 (1%2))
where floats = ["MPlayer", "Gimp"]
+
||| (noBorders Full)
rayManageHook _ _ _ "Opera" = return $ W.shift "web"
+
}
rayManageHook _ _ _ _ = return $ id
+
  +
rayManageHook :: Window -- ^ the new window to manage
  +
-> String -- ^ window title
  +
-> String -- ^ window resource name
  +
-> String -- ^ window resource class
  +
-> X (WindowSet -> WindowSet)
  +
rayManageHook w _ _ c | c `elem` floats = fmap (W.float w . snd) (floatLocation w)
  +
where floats = ["MPlayer", "Gimp", "xli"]
  +
rayManageHook _ _ _ "Opera" = return $ W.shift "β"
  +
rayManageHook _ _ _ _ = return $ id
  +
  +
rayKeys (XConfig {modMask = modm}) = M.fromList $
  +
[ ((modm , xK_s), sshPrompt defaultXPConfig)
  +
, ((modm .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
  +
]
  +
  +
rayPP = PP { ppCurrent = wrap "^fg(#ff0000)\"" "\"^fg()"
  +
, ppVisible = wrap "^fg(#a00000)\"" "\"^fg()"
  +
, ppHidden = wrap "^fg(#ffffff)\"" "\"^fg()"
  +
, ppHiddenNoWindows = wrap "^fg(#555555)\"" "\"^fg()"
  +
, ppSep = " "
  +
, ppWsSep = ","
  +
, ppTitle = shorten 80
  +
, ppLayout = (++) "layout = "
  +
, ppOrder = (take 2) . workspaceTag
  +
, ppOutput = System.IO.UTF8.putStrLn
  +
}
  +
where workspaceTag (x:xs) = ("workspaces = [" ++ x ++ "]") : xs
 
</haskell>
 
</haskell>

Revision as of 03:59, 9 November 2007

import XMonad
import XMonad.Layouts
import XMonad.Operations
import XMonad.Hooks.DynamicLog
import XMonad.Layout.NoBorders
import XMonad.Prompt
import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import qualified XMonad.StackSet as W
import Graphics.X11
import qualified Data.Map as M
import System.IO.UTF8
import Data.Ratio
import Data.Bits
 
main = xmonad rayConfig
 
rayConfig = defaultConfig
            { normalBorderColor        = "#333333"
            , focusedBorderColor       = "#0000ff"
            , workspaces               = ["α","β","γ","δ","ε","ζ"]
            , terminal                 = "rayterm"
            , defaultGaps              = [(18,0,0,0)]
            , modMask                  = mod4Mask
            , manageHook               = rayManageHook
            , logHook                  = dynamicLogWithPP rayPP
            , keys                     = \c -> rayKeys c `M.union` keys defaultConfig c
            , layoutHook               = Layout
                                         $   Mirror (Tall 1 0 (1%2))
                                         ||| (noBorders Full)
            }
 
rayManageHook :: Window -- ^ the new window to manage
              -> String -- ^ window title
              -> String -- ^ window resource name
              -> String -- ^ window resource class
              -> X (WindowSet -> WindowSet)
rayManageHook w _ _ c | c `elem` floats = fmap (W.float w . snd) (floatLocation w)
                      where floats = ["MPlayer", "Gimp", "xli"]
rayManageHook _ _ _ "Opera"             = return $ W.shift "β"
rayManageHook _ _ _ _                   = return $ id
 
rayKeys (XConfig {modMask = modm}) = M.fromList $
                                    [ ((modm                , xK_s), sshPrompt defaultXPConfig)
                                    , ((modm .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
                                    ]
 
rayPP = PP { ppCurrent         = wrap "^fg(#ff0000)\"" "\"^fg()"
           , ppVisible         = wrap "^fg(#a00000)\"" "\"^fg()"
           , ppHidden          = wrap "^fg(#ffffff)\"" "\"^fg()"
           , ppHiddenNoWindows = wrap "^fg(#555555)\"" "\"^fg()"
           , ppSep             = "   "
           , ppWsSep           = ","
           , ppTitle           = shorten 80
           , ppLayout          = (++) "layout = "
           , ppOrder           = (take 2) . workspaceTag
           , ppOutput          = System.IO.UTF8.putStrLn
           }
    where workspaceTag (x:xs) = ("workspaces = [" ++ x ++ "]") : xs