Personal tools

Xmonad/Config archive/Ray's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
 
(update, again)
 
(4 intermediate revisions by one user not shown)
Line 1: Line 1:
 
<haskell>
 
<haskell>
import XMonad
+
import XMonad
import XMonad.Layouts
+
import XMonad.Layout
import XMonad.Operations
+
import XMonad.Operations
import XMonad.Hooks.DynamicLog
+
import XMonad.ManageHook
import XMonad.Layout.NoBorders
+
import XMonad.Hooks.DynamicLog
import qualified XMonad.StackSet as W
+
import XMonad.Layout.NoBorders
import Graphics.X11
+
import XMonad.Prompt
import Data.Ratio
+
import XMonad.Prompt.Ssh
+
import XMonad.Prompt.XMonad
main = xmonad $ defaultConfig
+
import XMonad.Util.Run
{ normalBorderColor = "#333333"
+
import XMonad.Actions.NoBorders
, focusedBorderColor = "#0000ff"
+
import XMonad.Actions.Warp
, workspaces = ["term", "web"] ++ map show [3..9]
+
import qualified XMonad.StackSet as W
, terminal = "rayterm"
+
import Graphics.X11
, defaultGaps = [(18,0,0,0)]
+
import qualified Data.Map as M
, modMask = mod4Mask
+
import System.IO.UTF8
, manageHook = rayManageHook
+
import Data.Ratio
, logHook = dynamicLog
+
import Data.Bits
, layoutHook = Layout
+
$ Mirror (Tall 1 0 (1%2))
+
main = do dzenh <- spawnPipe "dzen2 -bg '#333333'"
||| (noBorders Full)
+
xmonad $ rayConfig dzenh
}
+
+
rayConfig h = defaultConfig
rayManageHook :: Window -- ^ the new window to manage
+
{ normalBorderColor = "#333333"
-> String -- ^ window title
+
, focusedBorderColor = "#0000ff"
-> String -- ^ window resource name
+
, borderWidth = 1
-> String -- ^ window resource class
+
, workspaces = ["α","β","γ","δ","ε","ζ"]
-> X (WindowSet -> WindowSet)
+
, terminal = "rayterm"
rayManageHook w _ _ c | c `elem` floats = fmap (W.float w . snd) (floatLocation w)
+
, defaultGaps = [(18,0,0,0)]
where floats = ["MPlayer", "Gimp"]
+
, modMask = mod4Mask
rayManageHook _ _ _ "Opera" = return $ W.shift "web"
+
, manageHook = rayManageHook
rayManageHook _ _ _ _ = return $ id
+
, logHook = dynamicLogWithPP $ rayPP h
</haskell>
+
, keys = \c -> rayKeys c `M.union` keys defaultConfig c
  +
, focusFollowsMouse = False
  +
, layoutHook = Mirror (Tall 1 0 (1%2))
  +
||| noBorders Full
  +
}
  +
  +
rayManageHook = composeAll . concat $
  +
[ [ className =? c --> doFloat | c <- floats]
  +
, [ className =? "Opera" --> doF (W.shift "β") ]]
  +
where floats = ["MPlayer", "Gimp","xli","Xmessage"]
  +
  +
rayKeys (XConfig {modMask = modm}) = M.fromList $
  +
[ ((modm , xK_s), sshPrompt defaultXPConfig)
  +
, ((modm .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
  +
, ((modm , xK_x), spawn "xscreensaver-command -lock")
  +
, ((modm .|. shiftMask , xK_b), withFocused toggleBorder)
  +
, ((modm .|. controlMask, xK_b), warpToScreen 0 1 1)
  +
]
  +
  +
rayPP h = 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.hPutStrLn h
  +
}
  +
where workspaceTag (x:xs) = ("workspaces = [" ++ x ++ "]") : xs</haskell>

Latest revision as of 15:28, 30 January 2008

import XMonad
import XMonad.Layout
import XMonad.Operations
import XMonad.ManageHook
import XMonad.Hooks.DynamicLog
import XMonad.Layout.NoBorders
import XMonad.Prompt
import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import XMonad.Util.Run
import XMonad.Actions.NoBorders
import XMonad.Actions.Warp
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 = do dzenh <- spawnPipe "dzen2 -bg '#333333'"
          xmonad $ rayConfig dzenh
 
rayConfig h = defaultConfig
              { normalBorderColor        = "#333333"
              , focusedBorderColor       = "#0000ff"
              , borderWidth              = 1
              , workspaces               = ["α","β","γ","δ","ε","ζ"]
              , terminal                 = "rayterm"
              , defaultGaps              = [(18,0,0,0)]
              , modMask                  = mod4Mask
              , manageHook               = rayManageHook
              , logHook                  = dynamicLogWithPP $ rayPP h
              , keys                     = \c -> rayKeys c `M.union` keys defaultConfig c
              , focusFollowsMouse        = False
              , layoutHook               = Mirror (Tall 1 0 (1%2))
                                           ||| noBorders Full
              }
 
rayManageHook = composeAll . concat $
                [ [ className =? c --> doFloat | c <- floats]
                , [ className =? "Opera" --> doF (W.shift "β") ]]
    where floats = ["MPlayer", "Gimp","xli","Xmessage"]
 
rayKeys (XConfig {modMask = modm}) = M.fromList $
                                     [ ((modm                , xK_s), sshPrompt defaultXPConfig)
                                     , ((modm .|. controlMask, xK_x), xmonadPrompt defaultXPConfig)
                                     , ((modm                , xK_x), spawn "xscreensaver-command -lock")
                                     , ((modm .|. shiftMask  , xK_b), withFocused toggleBorder)
                                     , ((modm .|. controlMask, xK_b), warpToScreen 0 1 1)
                                     ]
 
rayPP h = 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.hPutStrLn h
             }
    where workspaceTag (x:xs) = ("workspaces = [" ++ x ++ "]") : xs