-- XMonad Core import XMonad hiding ((|||)) import XMonad.Operations import qualified XMonad.StackSet as S -- GHC hierarchical libraries import Data.Bits ((.|.)) import qualified Data.Map as M import Data.Ratio import IO import Data.List import Data.Maybe -- Contribs -- Layouts import XMonad.Layout.LayoutCombinators import XMonad.Layout.Tabbed import XMonad.Layout.IM import XMonad.Layout.PerWorkspace import XMonad.Layout.DecorationMadness import XMonad.Layout.Grid import XMonad.Layout.Decoration -- Utils import XMonad.Util.EZConfig import XMonad.Util.Run (spawnPipe) -- Actions import XMonad.Actions.DwmPromote import XMonad.Actions.CycleSelectedLayouts import XMonad.Actions.UpdatePointer -- Hooks import XMonad.Hooks.DynamicLog import XMonad.Hooks.ManageDocks -- Prompt import XMonad.Prompt import XMonad.Prompt.Shell -- workspace names wsMain = "1:main" wsBook = "5:book" wsIrc = "6:irc" wsTorr = "7:torrent" wsIm = "8:im" wsWeb = "9:web" wslist = [wsMain, "2:work", "3:work", "4:work", wsBook, wsIrc, wsTorr, wsIm, wsWeb] -- entry point main = xmonad $ defaultConfig { logHook = dynamicLogWithPP myPP >> updatePointer (Relative 0.5 0.5) , workspaces = wslist , layoutHook = myLayouts , manageHook = myManageHook <+> manageDocks , borderWidth = 0 , focusFollowsMouse = False } `additionalKeys` myKeys -- custom keybindings; are added to defaults from Config.hs and can overwrite them myKeys = [ ((0, xK_F2 ), spawn "exec rxvt") , ((mod4Mask, xK_r ), spawn "exec iceweasel http://www.google.com/reader") , ((mod4Mask, xK_o ), spawn "exec /usr/bin/konqueror") , ((mod4Mask, xK_i ), spawn "exec iceweasel") , ((mod4Mask, xK_k ), spawn "exec kmymoney") , ((mod4Mask, xK_q ), spawn "cd ~/images/photo; exec gqview") , ((mod4Mask, xK_t ), spawn "exec rxvt -e mutt") , ((mod4Mask, xK_g ), spawn "exec gvim") , ((mod4Mask, xK_z ), silent "exec xmms2 prev") , ((mod4Mask, xK_x ), silent "exec xmms2 play") , ((mod4Mask, xK_c ), silent "exec xmms2 pause") , ((mod4Mask, xK_v ), silent "exec xmms2 stop") , ((mod4Mask, xK_b ), silent "exec xmms2 next") , ((mod4Mask, xK_Up ), silent "exec xmms2 volume +5") , ((mod4Mask, xK_Down ), silent "exec xmms2 volume -5") , ((mod1Mask, xK_F4 ), kill) , ((mod1Mask, xK_Return), dwmpromote) , ((mod1Mask, xK_b ), sendMessage ToggleStruts) , ((0, xK_F4 ), shellPrompt defaultXPConfig) , ((mod1Mask, xK_c ), spawn "gvim ~/.xmonad/xmonad.hs") , ((mod1Mask, xK_r ), spawn "randr") , ((mod1Mask, xK_a ), sendMessage NextLayout) , ((mod1Mask, xK_space ), cycleThroughLayouts ["Tabbed Simplest", "DefaultDecoration Grid"]) , ((mod1Mask, xK_s ), cycleThroughLayouts ["DefaultDecoration Mirror Tall", "DefaultDecoration Tall"]) ] ++ [((m .|. mod1Mask, key), screenWorkspace sc >>= flip whenJust (windows . f)) | (key, sc) <- zip [xK_e, xK_w] [0..] , (f, m) <- [(S.view, 0), (S.shift, shiftMask)]] where silent = spawn.(++" > /dev/null") -- available layouts myLayouts = avoidStruts $ onWorkspace wsIm (withIM (1%7) ((ClassName "Tkabber") `Or` (Role "buddy_list")) Grid) $ tabbed shrinkText myTabConfig ||| decoGrid ||| tallDefault shrinkText myTabConfig ||| mirrorTallDefault shrinkText myTabConfig where tiled = Tall nmaster delta ratio nmaster = 1 ratio = 1/2 delta = 3/100 decoGrid = decoration shrinkText myTabConfig DefaultDecoration Grid myTabConfig = defaultTheme { activeColor = "#6666cc" , activeBorderColor = "#000000" , inactiveColor = "#666666" , inactiveBorderColor = "#000000" } -- configuration of DynamicLog (i.e. what xmobar shows) myPP = defaultPP { ppCurrent = xmobarColor "yellow" "" , ppTitle = xmobarColor "green" "" . shorten 40 , ppVisible = xmobarColor "cyan" "" } -- rules for some programs myManageHook = composeAll [ className =? "Chat" --> moveTo wsIm , className =? "Kpdf" --> moveTo wsBook , className =? "Djview4" --> moveTo wsBook , className =? "Ktorrent" --> moveTo wsTorr , className =? "Akregator" --> moveTo wsWeb , className =? "Xchat" --> moveTo wsIrc , className =? "Tkabber" --> moveTo wsIm ] where moveTo = doF . S.shift