Personal tools

Xmonad/Config archive/Wfarr's xmonad.hs

From HaskellWiki

< Xmonad | Config archive(Difference between revisions)
Jump to: navigation, search
(Make it)
 
m
 
(2 intermediate revisions by one user not shown)
Line 10: Line 10:
 
import XMonad.Actions.CopyWindow
 
import XMonad.Actions.CopyWindow
 
import XMonad.Actions.CycleWS
 
import XMonad.Actions.CycleWS
  +
import XMonad.Actions.Search
  +
import XMonad.Actions.UpdatePointer
 
import XMonad.Actions.WindowBringer
 
import XMonad.Actions.WindowBringer
  +
import XMonad.Actions.WindowGo
   
  +
import XMonad.Layout.Magnifier
 
import XMonad.Layout.Reflect
 
import XMonad.Layout.Reflect
 
import XMonad.Layout.ResizableTile
 
import XMonad.Layout.ResizableTile
Line 17: Line 21:
   
 
import XMonad.Hooks.DynamicLog
 
import XMonad.Hooks.DynamicLog
  +
import XMonad.Hooks.ManageDocks
 
import XMonad.Hooks.UrgencyHook
 
import XMonad.Hooks.UrgencyHook
   
 
import XMonad.Prompt
 
import XMonad.Prompt
  +
import XMonad.Prompt.Shell
 
import XMonad.Prompt.Theme
 
import XMonad.Prompt.Theme
   
Line 33: Line 39:
 
h <- spawnPipe ("dzen2" ++ " " ++ myDzenFlags)
 
h <- spawnPipe ("dzen2" ++ " " ++ myDzenFlags)
 
xmonad $ myUrgencyHook $ defaultConfig
 
xmonad $ myUrgencyHook $ defaultConfig
{ terminal = "gnome-terminal"
+
{ terminal = "urxvtc"
, borderWidth = 2
+
, borderWidth = 2
, normalBorderColor = "#333333"
+
, normalBorderColor = "#333333"
 
, focusedBorderColor = "#4c7899"
 
, focusedBorderColor = "#4c7899"
, modMask = mod3Mask
+
, modMask = mod3Mask
, defaultGaps = myGaps
+
, layoutHook = myLayout
, layoutHook = myLayout
+
, workspaces = myWorkspaces
, workspaces = myWorkspaces
+
, manageHook = (manageHook defaultConfig <+> myManageHook) <+> manageDocks
, manageHook = manageHook defaultConfig <+> myManageHook
+
, logHook = (dynamicLogWithPP $ myLogHook h) >> updatePointer
, logHook = dynamicLogWithPP $ myLogHook h
 
 
}
 
}
 
`additionalKeysP` myKeys
 
`additionalKeysP` myKeys
   
myKeys = [ ("M-p", spawn "exe=`dmenu_path | dmenu -b` && eval \"exec $exe\"")
+
myKeys = [ ("M-p", shellPrompt myPrompt)
, ("M-e", spawn "emacs")
+
, ("M-f", spawn "firefox-3.0")
+
, ("M-e", runOrRaise "emacs" (className =? "Emacs"))
, ("M-<Return>", spawn "gnome-terminal")
+
, ("M-f", runOrRaise myBrowser (className =? "Firefox"))
+
, ("M-<Return>", spawn myTerm)
  +
 
, ("M-S-m", windows W.swapMaster)
 
, ("M-S-m", windows W.swapMaster)
+
 
, ("M-u", focusUrgent)
 
, ("M-u", focusUrgent)
+
  +
, ("M-b", sendMessage ToggleStruts)
  +
 
, ("M-a", sendMessage MirrorShrink)
 
, ("M-a", sendMessage MirrorShrink)
 
, ("M-z", sendMessage MirrorExpand)
 
, ("M-z", sendMessage MirrorExpand)
 
 
, ("M-s", spawn $ "gnome-terminal --title scratchpad")
+
, ("M-s g", promptSearch myPrompt myBrowser google)
+
, ("M-s h", promptSearch myPrompt myBrowser hoogle)
  +
, ("M-s i", promptSearch myPrompt myBrowser imdb)
  +
, ("M-s w", promptSearch myPrompt myBrowser wikipedia)
  +
 
, ("M-S-<R>", moveTo Next NonEmptyWS)
 
, ("M-S-<R>", moveTo Next NonEmptyWS)
 
, ("M-S-<L>", moveTo Prev NonEmptyWS)
 
, ("M-S-<L>", moveTo Prev NonEmptyWS)
+
 
, ("M-S-t", themePrompt defaultXPConfig)
 
, ("M-S-t", themePrompt defaultXPConfig)
+
 
, ("M-S-g", gotoMenu)
 
, ("M-S-g", gotoMenu)
 
, ("M-S-b", bringMenu)
 
, ("M-S-b", bringMenu)
   
, ("M-c", kill1) -- Removes window from ws if possible, else kills
+
, ("M-c", kill1) -- Removes window from ws if possible, else kills
, ("M-S-k", kill)
 
 
]
 
]
   
Line 76: Line 82:
 
, (f, m) <- [(W.view, ""), (W.shift, "-S"), (copy, "-C-S")]]
 
, (f, m) <- [(W.view, ""), (W.shift, "-S"), (copy, "-C-S")]]
   
myGaps = [(0,16,0,0)]
+
myPrompt :: XPConfig
myDzenFlags = "-e '' -y 1182 -w 900 -ta l"
+
myPrompt = defaultXPConfig { font = "xft:DejaVu Vera Sans Mono:pixelsize=10"
  +
, bgColor = "black"
  +
, fgColor = "#999999"
  +
, fgHLight = "#ffffff"
  +
, bgHLight = "#4c7899"
  +
, promptBorderWidth = 0
  +
, position = Bottom
  +
, height = 18
  +
, historySize = 128 }
  +
  +
myTerm, myBrowser :: String
  +
myBrowser = "firefox"
  +
myTerm = "urxvtc"
  +
  +
myDzenFlags = "-e '' -fn '-*-fixed-medium-r-*--12-*-*-*-*-*-iso8859-1' -y 1186 -w 900 -ta l"
 
myUrgencyHook = withUrgencyHook dzenUrgencyHook
 
myUrgencyHook = withUrgencyHook dzenUrgencyHook
 
{ args = ["-bg", "yellow", "-fg", "black"] }
 
{ args = ["-bg", "yellow", "-fg", "black"] }
Line 86: Line 92:
   
 
myManageHook = composeAll
 
myManageHook = composeAll
 
 
[ -- Organized by the workspace they go to
 
[ -- Organized by the workspace they go to
 
className =? "Nereid" --> doF(copy "2:music")
 
className =? "Nereid" --> doF(copy "2:music")
Line 97: Line 102:
 
]
 
]
   
myLayout = tiled ||| Mirror tiled ||| Full
+
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
 
where
 
where
tiled = windowNavigation (ResizableTall nmaster delta ratio [])
+
tiled = ResizableTall nmaster delta ratio []
 
nmaster = 1
 
nmaster = 1
 
ratio = 1/2
 
ratio = 1/2
Line 122: Line 127:
 
)
 
)
 
}
 
}
  +
 
</haskell>
 
</haskell>
   
Line 133: Line 139:
 
export OOO_FORCE_DESKTOP=gnome
 
export OOO_FORCE_DESKTOP=gnome
 
xsetroot -cursor_name left_ptr
 
xsetroot -cursor_name left_ptr
xmonad-clock | dzen2 -e '' -y 1182 -x 400 -w 1200 -ta r &
+
xmonad-clock | dzen2 -e '' -x 900 -y 1182 -w 700 -ta r &
 
dbus-launch --sh-syntax --exit-with-session $HOME/bin/xmonad
 
dbus-launch --sh-syntax --exit-with-session $HOME/bin/xmonad
 
</haskell>
 
</haskell>

Latest revision as of 02:39, 19 March 2008

This is the ~/.xmonad/xmonad.hs file.

import XMonad
import Control.Monad.Fix
 
import qualified XMonad.StackSet as W
import qualified Data.Map        as M
 
import XMonad.Actions.CopyWindow
import XMonad.Actions.CycleWS
import XMonad.Actions.Search
import XMonad.Actions.UpdatePointer
import XMonad.Actions.WindowBringer
import XMonad.Actions.WindowGo
 
import XMonad.Layout.Magnifier
import XMonad.Layout.Reflect
import XMonad.Layout.ResizableTile
import XMonad.Layout.WindowNavigation
 
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.UrgencyHook
 
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.Theme
 
import XMonad.Util.EZConfig
import XMonad.Util.Run
import XMonad.Util.Scratchpad
import XMonad.Util.Themes
 
import System.Exit
import System.IO
 
main = do
  h <- spawnPipe ("dzen2" ++ " " ++ myDzenFlags)
  xmonad $ myUrgencyHook $ defaultConfig
       { terminal           = "urxvtc"
       , borderWidth        = 2
       , normalBorderColor  = "#333333"
       , focusedBorderColor = "#4c7899"
       , modMask            = mod3Mask
       , layoutHook         = myLayout
       , workspaces         = myWorkspaces
       , manageHook         = (manageHook defaultConfig <+> myManageHook) <+> manageDocks
       , logHook            = (dynamicLogWithPP $ myLogHook h) >> updatePointer
       }
       `additionalKeysP` myKeys
 
myKeys = [ ("M-p", shellPrompt myPrompt)
 
         , ("M-e",        runOrRaise "emacs" (className =? "Emacs"))
         , ("M-f",        runOrRaise myBrowser (className =? "Firefox"))
         , ("M-<Return>", spawn myTerm)
 
         , ("M-S-m", windows W.swapMaster)
 
         , ("M-u", focusUrgent)
 
         , ("M-b", sendMessage ToggleStruts)
 
         , ("M-a", sendMessage MirrorShrink)
         , ("M-z", sendMessage MirrorExpand)
 
         , ("M-s g", promptSearch myPrompt myBrowser google)
         , ("M-s h", promptSearch myPrompt myBrowser hoogle)
         , ("M-s i", promptSearch myPrompt myBrowser imdb)
         , ("M-s w", promptSearch myPrompt myBrowser wikipedia)
 
         , ("M-S-<R>",  moveTo Next NonEmptyWS)
         , ("M-S-<L>",  moveTo Prev NonEmptyWS)
 
         , ("M-S-t", themePrompt defaultXPConfig)
 
         , ("M-S-g", gotoMenu)
         , ("M-S-b", bringMenu)
 
         , ("M-c",   kill1) -- Removes window from ws if possible, else kills
         ]
 
         ++
         -- This enables view switching, window shifting, and window copying
                  [("M" ++ m ++ ('-':k:[]) , windows $ f i)
                       | (i, k) <- zip myWorkspaces ['1'..'9']
                       , (f, m) <- [(W.view, ""), (W.shift, "-S"), (copy, "-C-S")]]
 
myPrompt :: XPConfig
myPrompt = defaultXPConfig { font              = "xft:DejaVu Vera Sans Mono:pixelsize=10"
                           , bgColor           = "black"
                           , fgColor           = "#999999"
                           , fgHLight          = "#ffffff"
                           , bgHLight          = "#4c7899"
                           , promptBorderWidth = 0
                           , position          = Bottom
                           , height            = 18
                           , historySize       = 128 }
 
myTerm, myBrowser :: String
myBrowser = "firefox"
myTerm = "urxvtc"
 
myDzenFlags  = "-e '' -fn '-*-fixed-medium-r-*--12-*-*-*-*-*-iso8859-1' -y 1186 -w 900 -ta l"
myUrgencyHook = withUrgencyHook dzenUrgencyHook
    { args = ["-bg", "yellow", "-fg", "black"] }
 
myWorkspaces :: [String]
myWorkspaces = ["1:main", "2:music", "3:emacs", "4:im", "5:email", "6:web" ]
              ++ map show [7 .. 9 :: Int]
 
myManageHook = composeAll
               [ -- Organized by the workspace they go to
                 className   =? "Nereid"      --> doF(copy "2:music")
               , className   =? "Cowbell"     --> doF(copy "2:music")
               , className   =? "Emacs"       --> doF(copy "3:emacs")
               , className   =? "Empathy"     --> doF(copy "4:im")
               , className   =? "Pidgin"      --> doF(copy "4:im")
               , className   =? "Thunderbird" --> doF(copy "5:email")
               , className   =? "Firefox"     --> doF(copy "6:web")
               ]
 
myLayout = avoidStruts (tiled ||| Mirror tiled ||| Full)
   where
       tiled = ResizableTall nmaster delta ratio []
       nmaster = 1
       ratio = 1/2
       delta = 3/100
 
myLogHook handle = defaultPP
                   { ppOutput = hPutStrLn handle
                   , ppCurrent = dzenColor "white" "#4c7899" . pad
                   , ppVisible = dzenColor "" "" . pad
                   , ppHidden = dzenColor "" "" . pad
                   , ppUrgent = dzenColor "red" "yellow"
                   , ppTitle = dzenColor "" "" . dzenEscape . pad
                   , ppHiddenNoWindows = const ""
                   , ppWsSep    = "|"
                   , ppSep      = "|"
                   , ppLayout   = dzenColor "" "" .
                                  (\ x -> case x of
                                            "TilePrime Horizontal" -> " TTT "
                                            "TilePrime Vertical"   -> " []= "
                                            "Hinted Full"          -> " [ ] "
                                            _                      -> pad x
                                  )
                   }

This is the ~/.xsession file:

# .xsession
xrdb -merge .Xresources
xsetroot -solid '#333333'
xmodmap ~/.xmodmap
export OOO_FORCE_DESKTOP=gnome
xsetroot -cursor_name left_ptr
xmonad-clock | dzen2 -e '' -x 900 -y 1182 -w 700 -ta r &
dbus-launch --sh-syntax --exit-with-session $HOME/bin/xmonad