Source

shared / .xmonad / xmonad.hs

Full commit
module Main (main) where

import XMonad
import System.Exit
import qualified Data.Map as M
import Graphics.X11.Xlib
import XMonad.Prompt
import XMonad.Prompt.Input
import XMonad.Prompt.Shell
import XMonad.Prompt.Ssh
import XMonad.Prompt.XMonad
import XMonad.Prompt.RunOrRaise
import XMonad.Hooks.Script
import XMonad.Util.EZConfig
import XMonad.Util.Run
import XMonad.Layout.NoBorders
import XMonad.Layout.Tabbed
import XMonad.Layout.Grid
import XMonad.Layout.ShowWName
import XMonad.Hooks.UrgencyHook

myModMask = mod4Mask               -- "windows key"
myNormalBorderColor  = "#4f4fff"
myFocusedBorderColor = "#ff2080"
myBorderWidth = 2
myTerminal = "urxvt"

main :: IO ()
main = xmonad $ withUrgencyHookC myUrgentHook myUrgentConfig $ config
       where config = defaultConfig {
               normalBorderColor  = myNormalBorderColor,
               focusedBorderColor = myFocusedBorderColor,
               keys               = newKeys,
               modMask            = myModMask,
               borderWidth        = myBorderWidth,
               terminal           = myTerminal,
               startupHook        = execScriptHook "startup" >> (checkKeymap config myKeys),
               manageHook         = composeAll manageHooks,
               layoutHook         = myLayoutHook,
               workspaces         = myWorkspaces
               }
             myUrgentHook = SpawnUrgencyHook "~/.xmonad/urgentHook "
             myUrgentConfig = urgencyConfig {
               remindWhen = Every (minutes 1)
               }


newKeys x = M.union (keys defaultConfig x) (mkKeymap x myKeys)
myKeys = [
  ("M1-<F4>", kill),
  ("M-x", spawn "visit"),
  ("M-z", safeSpawn "zsh" ["-c", "sensible-browser"]),
  ("M-0", spawn "popup-notify"),
  --  ("M-S-0", spawn "notify-send \"`date '+%A %Y-%m-%d %T'`\" \"`cal`\""),
  ("M-S-0", spawn "zenity --calendar --text=\"Now: `date`\""),
  ("M-s", inputPrompt defaultXPConfig "Google" ?+ \t -> safeSpawn "search" [t]),
  ("M-S-s", spawn "bash -c 'search \"$(xclip -o)\"'"),
  ("M-g", spawn "sensible-browser --app=http://www.gmail.com"),
  ("M-o", spawn "nautilus --no-desktop"),
  ("M-;", focusUrgent),
  ("<XF86AudioLowerVolume>", spawn "amixer sset -- Master playback 10-"),
  ("<XF86AudioRaiseVolume>", spawn "amixer sset -- Master playback 10+"),
  ("S-<XF86AudioRaiseVolume>", spawn "amixer sset -- Master playback 100%"),
  ("<XF86AudioMute>", spawn "amixer sset -- Master playback 0%"),
  ("M-<F3>", spawn "xbacklight -inc 20"),
  ("M-<F2>", spawn "xbacklight -dec 20")
  ]

manageHooks = [
  className =? "XClock" --> doFloat,
  className =? "Xmessage" -->doFloat,
  className =? "Zenity" -->doFloat,
  className =? "Rhythmbox" -->doShift "music",
  className =? "trayer" -->doShift "misc",
  className =? "skype" -->doShift "skype"
  ]
              
myLayoutHook = showWName $ smartBorders $ (tiled (9/15) ||| Grid ||| Mirror (tiled (13/15)) ||| simpleTabbedBottom ||| Full)
  where tiled      = Tall nmaster inc 
        nmaster    = 1
        inc        = 1/15

myWorkspaces = [
  "web",
  "code",
  "chat",
  "docs",
  "terminals",
  "skype",
  "7",
  "music",
  "misc"
  ]

defaultApps = M.fromList [
  ("web","sensible-browser"),
  ("code","sensible-editor"),
  ("chat","pidgin"),
  ("terminals","urxvt"),
  ("skype","skype"),
  ("music","rhythmbox")
  ]