Personal tools

Xmonad/Config archive/Octoploid's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
m
m
 
(11 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.Hooks.ManageDocks
 
import XMonad.Config (defaultConfig)
 
import XMonad.Config (defaultConfig)
  +
import XMonad.Actions.GridSelect
 
import XMonad.Layout.NoBorders
 
import XMonad.Layout.NoBorders
import XMonad.Hooks.DynamicLog
+
import XMonad.Layout.Gaps
import XMonad.Actions.RotView
+
import XMonad.Hooks.ManageHelpers
import Data.Bits
+
import XMonad.Hooks.DynamicLog hiding (xmobar)
  +
import XMonad.Actions.CycleWS
 
import qualified Data.Map as M
 
import qualified Data.Map as M
 
import XMonad.Util.Run (spawnPipe)
 
import XMonad.Util.Run (spawnPipe)
 
import System.IO (hPutStrLn)
 
import System.IO (hPutStrLn)
 
import Graphics.X11
 
import Graphics.X11
  +
   
 
main :: IO ()
 
main :: IO ()
 
main = do
 
main = do
xmobar <- spawnPipe "xmobar"
+
xmobar <- spawnPipe "xmobar"
xmonad defaultConfig
+
xmonad defaultConfig
{ defaultGaps = [(15,0,0,0)]
+
{ normalBorderColor = "#222222"
, normalBorderColor = "#222222"
+
, focusedBorderColor = "#EF2929"
, focusedBorderColor = "#6666ff"
+
, borderWidth = 1
, terminal = "gnome-terminal"
+
, terminal = "konsole"
, logHook = dynamicLogWithPP defaultPP { ppTitle = shorten 160
+
, logHook = dynamicLogWithPP defaultPP { ppTitle = shorten 90
, ppLayout = (\_ -> "")
+
, ppLayout = (>> "")
, ppOutput = hPutStrLn xmobar }
+
, ppOutput = hPutStrLn xmobar }
, modMask = mod4Mask
+
, layoutHook = avoidStruts ( smartBorders (Full ||| Mirror tiled ))
, layoutHook = Layout (smartBorders (tiled ||| Full))
+
, manageHook = composeOne [ isFullscreen -?> doFullFloat,
, keys = \c -> mykeys c `M.union` keys defaultConfig c
+
isDialog -?> doCenterFloat ]
}
+
<+> composeAll [ className =? "fontforge" --> doFloat,
where
+
className =? "MPlayer" --> doFloat,
  +
title =? "glxgears" --> doFloat,
  +
className =? "Gimp" --> doFloat]
  +
<+> manageDocks
  +
, keys = \c -> mykeys c `M.union` keys defaultConfig c
  +
}
  +
where
 
tiled = Tall nmaster delta ratio
 
tiled = Tall nmaster delta ratio
   
Line 34: Line 36:
   
 
-- Default proportion of screen occupied by master pane
 
-- Default proportion of screen occupied by master pane
ratio = 0.618034 --golden
+
ratio = toRational (2/(1+sqrt(5)::Double)) -- golden
   
 
-- Percent of screen to increment by when resizing panes
 
-- Percent of screen to increment by when resizing panes
 
delta = 0.03
 
delta = 0.03
   
mykeys (XConfig {modMask = modm}) = M.fromList $
+
mykeys (XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((controlMask .|. modm, xK_Right), rotView True)
+
[ ((controlMask .|. modm, xK_Right), nextWS)
, ((controlMask .|. modm, xK_Left), rotView False) ]
+
, ((controlMask .|. modm, xK_Left), prevWS)
</haskell>
+
, ((modm, xK_g), goToSelected defaultGSConfig)
  +
, ((modm, xK_b), sendMessage ToggleStruts)
  +
, ((modm, xK_f), spawn "firefox") ]
   
  +
</haskell>
 
[[Category:XMonad configuration]]
 
[[Category:XMonad configuration]]

Latest revision as of 18:56, 26 October 2009

import XMonad
import XMonad.Layout
import XMonad.Hooks.ManageDocks
import XMonad.Config (defaultConfig)
import XMonad.Actions.GridSelect
import XMonad.Layout.NoBorders
import XMonad.Layout.Gaps
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.DynamicLog hiding (xmobar)
import XMonad.Actions.CycleWS
import qualified Data.Map as M
import XMonad.Util.Run (spawnPipe)
import System.IO (hPutStrLn)
import Graphics.X11
 
 
main :: IO ()
main = do
        xmobar <- spawnPipe "xmobar"
        xmonad defaultConfig
         { normalBorderColor  = "#222222"
         , focusedBorderColor = "#EF2929"
         , borderWidth        = 1
         , terminal = "konsole"
         , logHook = dynamicLogWithPP defaultPP { ppTitle  = shorten 90
                                                , ppLayout = (>> "")
                                                , ppOutput = hPutStrLn xmobar }
         , layoutHook = avoidStruts ( smartBorders (Full ||| Mirror tiled ))
         , manageHook = composeOne [ isFullscreen -?> doFullFloat,
                                     isDialog     -?> doCenterFloat ]
                        <+> composeAll [ className =? "fontforge" --> doFloat,
                                         className =? "MPlayer"   --> doFloat,
                                         title     =? "glxgears"  --> doFloat,
                                         className =? "Gimp"      --> doFloat]
                        <+> manageDocks
         , keys = \c -> mykeys c `M.union` keys defaultConfig c
         }
  where
     tiled   = Tall nmaster delta ratio
 
     -- The default number of windows in the master pane
     nmaster = 1
 
     -- Default proportion of screen occupied by master pane
     ratio   = toRational (2/(1+sqrt(5)::Double)) -- golden
 
     -- Percent of screen to increment by when resizing panes
     delta   = 0.03
 
     mykeys (XConfig {XMonad.modMask = modm}) = M.fromList $
             [ ((controlMask .|. modm, xK_Right), nextWS)
             , ((controlMask .|. modm, xK_Left),  prevWS)
             , ((modm, xK_g), goToSelected defaultGSConfig)
             , ((modm, xK_b), sendMessage ToggleStruts)
             , ((modm, xK_f), spawn "firefox") ]