Personal tools

Xmonad/Config archive/Ray's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
(new managehook system and type signatures)
(update, again)
 
(2 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.ManageHook
 
import XMonad.ManageHook
Line 9: Line 9:
 
import XMonad.Prompt.Ssh
 
import XMonad.Prompt.Ssh
 
import XMonad.Prompt.XMonad
 
import XMonad.Prompt.XMonad
 +
import XMonad.Util.Run
 +
import XMonad.Actions.NoBorders
 +
import XMonad.Actions.Warp
 
import qualified XMonad.StackSet as W
 
import qualified XMonad.StackSet as W
 
import Graphics.X11
 
import Graphics.X11
Line 16: Line 19:
 
import Data.Bits
 
import Data.Bits
  
main :: IO ()
+
main = do dzenh <- spawnPipe "dzen2 -bg '#333333'"
main = xmonad rayConfig
+
          xmonad $ rayConfig dzenh
  
rayConfig :: XConfig
+
rayConfig h = defaultConfig
rayConfig = defaultConfig
+
              { normalBorderColor        = "#333333"
            { normalBorderColor        = "#333333"
+
              , focusedBorderColor      = "#0000ff"
            , focusedBorderColor      = "#0000ff"
+
              , borderWidth              = 1
            , workspaces              = ["α","β","γ","δ","ε","ζ"]
+
              , workspaces              = ["α","β","γ","δ","ε","ζ"]
            , terminal                = "rayterm"
+
              , terminal                = "rayterm"
            , defaultGaps              = [(18,0,0,0)]
+
              , defaultGaps              = [(18,0,0,0)]
            , modMask                  = mod4Mask
+
              , modMask                  = mod4Mask
            , manageHook              = rayManageHook
+
              , manageHook              = rayManageHook
            , logHook                  = dynamicLogWithPP rayPP
+
              , logHook                  = dynamicLogWithPP $ rayPP h
            , keys                    = \c -> rayKeys c `M.union` keys defaultConfig c
+
              , keys                    = \c -> rayKeys c `M.union` keys defaultConfig c
            , layoutHook              = Layout
+
              , focusFollowsMouse        = False
                                        $  Mirror (Tall 1 0 (1%2))
+
              , layoutHook              = Mirror (Tall 1 0 (1%2))
                                        ||| (noBorders Full)
+
                                          ||| noBorders Full
            }
+
              }
  
rayManageHook :: ManageHook
 
 
rayManageHook = composeAll . concat $
 
rayManageHook = composeAll . concat $
 
                 [ [ className =? c --> doFloat | c <- floats]
 
                 [ [ className =? c --> doFloat | c <- floats]
 
                 , [ className =? "Opera" --> doF (W.shift "β") ]]
 
                 , [ className =? "Opera" --> doF (W.shift "β") ]]
     where floats = ["MPlayer", "Gimp","xli"]
+
     where floats = ["MPlayer", "Gimp","xli","Xmessage"]
  
rayKeys :: XConfig -> M.Map (KeyMask, KeySym) (X ())
 
 
rayKeys (XConfig {modMask = modm}) = M.fromList $
 
rayKeys (XConfig {modMask = modm}) = M.fromList $
 
                                     [ ((modm                , xK_s), sshPrompt defaultXPConfig)
 
                                     [ ((modm                , xK_s), sshPrompt defaultXPConfig)
 
                                     , ((modm .|. controlMask, xK_x), xmonadPrompt 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 :: PP
+
rayPP h = PP { ppCurrent        = wrap "^fg(#ff0000)\"" "\"^fg()"
rayPP = PP { ppCurrent        = wrap "^fg(#ff0000)\"" "\"^fg()"
+
            , ppVisible        = wrap "^fg(#a00000)\"" "\"^fg()"
          , ppVisible        = wrap "^fg(#a00000)\"" "\"^fg()"
+
            , ppHidden          = wrap "^fg(#ffffff)\"" "\"^fg()"
          , ppHidden          = wrap "^fg(#ffffff)\"" "\"^fg()"
+
            , ppHiddenNoWindows = wrap "^fg(#555555)\"" "\"^fg()"
          , ppHiddenNoWindows = wrap "^fg(#555555)\"" "\"^fg()"
+
            , ppSep            = "  "
          , ppSep            = "  "
+
            , ppWsSep          = ","
          , ppWsSep          = ","
+
            , ppTitle          = shorten 80
          , ppTitle          = shorten 80
+
            , ppLayout          = (++) "layout = "
          , ppLayout          = (++) "layout = "
+
            , ppOrder          = (take 2) . workspaceTag
          , ppOrder          = (take 2) . workspaceTag
+
            , ppOutput          = System.IO.UTF8.hPutStrLn h
          , ppOutput          = System.IO.UTF8.putStrLn
+
            }
          }
+
     where workspaceTag (x:xs) = ("workspaces = [" ++ x ++ "]") : xs</haskell>
     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