1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | import XMonad
import Data.Monoid
import System.Exit
import Text.Regex.Posix ((=~))
import qualified XMonad.StackSet as W
import XMonad.Actions.CycleWindows
import qualified Data.Map as M
import XMonad.Util.Scratchpad (scratchpadSpawnAction, scratchpadManageHook, scratchpadFilterOutWorkspace)
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.NoBorders
import XMonad.Util.Run (hPutStrLn, spawnPipe, runInTerm)
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Prompt.Theme
import XMonad.Layout.SimpleFloat
import XMonad.Layout.Grid
import XMonad.Layout.Named
import qualified XMonad.Layout.Magnifier as Mag
import XMonad.Layout.LayoutHints
import XMonad.Layout.PerWorkspace (onWorkspace)
import XMonad.Layout.Spacing
import XMonad.Layout.IM
import XMonad.Layout.WindowNavigation
import XMonad.Layout.Reflect
import Data.Ratio ((%))
import XMonad.Actions.Search
import XMonad.Util.NamedScratchpad
import qualified XMonad.Prompt as P
import qualified XMonad.Actions.Submap as SM
import qualified XMonad.Actions.Search as S
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Actions.UpdatePointer
import XMonad.Util.WorkspaceCompare
q ~? x = fmap (=~ x) q
myTerminal = "urxvtc"
myFocusFollowsMouse = True
myBorderWidth = 1
myModMask = mod4Mask
myWorkspaces = ["1","2","3","4","5"] ++ map show [6..9]
myNormalBorderColor = "#3f3f3f"
myFocusedBorderColor = "#f0dfaf"
myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((modm .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf)
, ((modm, xK_p ), spawn "/home/paul/scripts/launcher")
, ((modm, xK_d ), spawn "/home/paul/scripts/todo1")
, ((modm .|. shiftMask, xK_d ), spawn "/home/paul/scripts/delete-prompt-history.sh")
, ((modm, xK_c ), spawn "chromium")
, ((modm, xK_f ), spawn "firefox")
, ((modm, xK_t ), spawn "thunar")
, ((modm, xK_v ), spawn "vlc")
, ((modm, xK_r ), spawn "urxvtc -e ranger")
, ((modm, xK_m ), spawn "urxvtc -e mc -S nicedark")
, ((modm, xK_q ), spawn "obshutdown")
, ((modm .|. shiftMask, xK_n ), spawn "mpd && urxvtc -e ncmpcpp")
, ((modm .|. shiftMask, xK_s ), scratchpadSpawnAction defaultConfig { terminal = myTerminal })
, ((modm, xK_s ), SM.submap $ searchEngineMap $ S.promptSearchBrowser paulXPConfig "chromium")
, ((modm, xK_a ), shellPrompt paulXPConfig)
, ((modm .|. shiftMask, xK_c ), kill)
, ((modm, xK_Return), spawn myTerminal)
, ((modm, xK_space ), sendMessage NextLayout)
, ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf)
, ((modm, xK_n ), refresh)
, ((modm, xK_j ), windows W.focusDown)
, ((modm, xK_k ), windows W.focusUp )
, ((modm .|. shiftMask, xK_j ), windows W.swapDown )
, ((modm .|. shiftMask, xK_k ), windows W.swapUp )
, ((modm, xK_h ), sendMessage Shrink)
, ((modm, xK_l ), sendMessage Expand)
, ((modm, xK_comma ), sendMessage (IncMasterN (1)))
, ((modm, xK_period), sendMessage (IncMasterN (-1)))
, ((modm .|. shiftMask, xK_q ), io (exitWith ExitSuccess))
, ((modm .|. shiftMask, xK_r ), spawn "xmonad --recompile && xmonad --restart")
]
++
[((m .|. modm, k), windows $ f i)
| (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
, (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]]
++
[((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
| (key, sc) <- zip [xK_w, xK_e, xK_r] [0..]
, (f, m) <- [(W.view, 0), (W.shift, shiftMask)]]
paulXPConfig = defaultXPConfig
{ font = "xft:arial:bold:size=9"
, bgColor = "snow1"
, fgColor = "#505050"
, fgHLight = "#505050"
, bgHLight = "snow1"
, promptBorderWidth = 1
, position = Bottom
, height = 19
, historySize = 32
, defaultText = []
}
searchEngineMap method = M.fromList $
[ ((0, xK_g), method S.google)
, ((0, xK_w), method $ S.searchEngine "Wikipedia" "http://en.wikipedia.org/w/index.php?title=Special:Search&redirs=0&search=")
, ((0, xK_i), method $ S.searchEngine "Imdb" "http://www.imdb.com/find?s=all&q=")
, ((0, xK_y), method S.youtube)
, ((0, xK_d), method S.dictionary)
, ((0, xK_b), method $ S.searchEngine "archbbs" "http://bbs.archlinux.org/search.php?action=search&keywords=")
, ((0, xK_t), method $ S.searchEngine "Rotten" "http://www.rottentomatoes.com/search/?search=")
, ((0, xK_r), method $ S.searchEngine "archwiki" "http://wiki.archlinux.org/index.php/Special:Search?search=")
, ((0, xK_p), method $ S.searchEngine "Play" "http://www.play.com/Search.aspx?searchtype=allproducts&searchstring=")
, ((0, xK_a), method $ S.searchEngine "Amazon" "http://www.amazon.co.uk/s/ref=nb_ss?url=search-alias%3Daps&field-keywords=")
, ((0, xK_u), method $ S.searchEngine "Urban" "http://urbandictionary.com/define.php?term=")
, ((0, xK_e), method $ S.searchEngine "Epguides" "http://www.google.com/search?hl=en&q=allintitle%3A&q=site%3Aepguides.com&q=")
]
myLayout = avoidStruts $ windowNavigation $ onWorkspace "1" webLayout
$ onWorkspace "2" webLayout
$ windowNavigation $ onWorkspace "3" fileLayout
$ onWorkspace "4" imLayout
$ windowNavigation $ onWorkspace "5" magLayout
$ standardLayout
where
imLayout = IM (1%5) (Or (Title "Buddy List") (And (Resource "main") (ClassName "pidgin")))
fileLayout = tiled ||| simpleFloat ||| Grid
screenLayout = Full
webLayout = Full ||| spaced
magLayout = named "Grid" $ Mag.magnifiercz 1.15 $ Grid
standardLayout = avoidStruts $ windowNavigation $ tiled ||| Grid ||| Full ||| simpleFloat ||| spaced
tiled = Tall nmaster delta ratio
grid = layoutHints Grid
spaced = named "Spaced" $ spacing 10 $ Tall 1 (3/100) (1/2)
nmaster = 1
ratio = toRational (2/(1 + sqrt 5 :: Double))
delta = 3/100
newManageHook = myManageHook <+> manageHook defaultConfig
myDzenFont = "arial:bold:size=9"
conkyFile = "conky -c ~/.conkyrc0"
colorWhite = "snow1"
colorOrange = "orange"
colorRed = "red"
colorBrown = "#663300"
colorZburn = "#3f3f3f"
colorZburn1 = "#80d4aa"
colorZburn2 = "#f0dfaf"
colorRed1 = "#543532"
colorBlack = "#000000"
colorGrey1 = "#808080"
colorGrey2 = "#808080"
colorGrey3 = "#CCCCCC"
myManageHook = scratchpadManageHook (W.RationalRect l t w h) <+>
(composeAll $
[ className =? "MPlayer" --> doFloat
, className =? "Gimp" --> doFloat
, className =? "obshutdown" --> doIgnore
, resource =? "thunar" --> doShift "3"
, resource =? "firefox" --> doShift "1"
, resource =? "ncmpcpp" --> doShift "5"
, resource =? "chromium" --> doShift "1"
, resource =? "gedit" --> doShift "6"
, resource =? "ranger" --> doShift "3"
, className =? "Pidgin" <&&> title =? "Buddy List" --> doShift "4"
, className ~? "^libreoffice" --> doShift "7"
, className ~? "libreoffice-writer" --> doShift "7"
, resource =? "mousepad" --> doShift "6"
, className =? "stalonetray" --> doIgnore
, resource =? "desktop_window" --> doIgnore
, resource =? "kdesktop" --> doIgnore ])
where
role = stringProperty "WM_WINDOW_ROLE"
h = 0.4
w = 0.75
t = 0.85 - h
l = 0.87 - w
myStartupHook = startup
startup = do
spawn "setxkbmap gb"
spawn "stalonetray"
spawn "pidgin"
spawn "gnome-sound-applet"
spawn "nm-applet"
main = do
din <- spawnPipe myStatusBar
din2 <- spawnPipe myStatusBar2
din3 <- spawnPipe myStatusBar3
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
{ terminal = myTerminal
, normalBorderColor = myNormalBorderColor
, workspaces = myWorkspaces
, focusedBorderColor = myFocusedBorderColor
, logHook = myLogHook din
, modMask = myModMask
, layoutHook = myLayout
, focusFollowsMouse = myFocusFollowsMouse
, manageHook = newManageHook <+> manageDocks
, startupHook = myStartupHook
, keys = \c -> myKeys c
}
myLogHook h = (dynamicLogWithPP $ defaultPP {
ppSort = fmap (.scratchpadFilterOutWorkspace) getSortByTag
, ppCurrent = dzenColor colorZburn1 colorZburn . pad
, ppHidden = dzenFG colorZburn2 . pad
, ppHiddenNoWindows = namedOnly
, ppUrgent = myWrap colorRed "{" "}" . pad
, ppTitle = dzenColor colorZburn2 colorZburn . shorten 55
, ppWsSep = ""
, ppSep = " : "
, ppOutput = hPutStrLn h
, ppLayout = dzenColor colorZburn2 "".
(\x -> case x of
"Tall" -> "^i(/home/paul/icons/rob/tall.xbm)"
"Full" -> "^i(/home/paul/icons/rob/full.xbm)"
"spaced" -> "^i(/home/paul/icons/rob/float.xbm)"
"Grid" -> "^i(/home/paul/icons/rob/dragpane.xbm)"
"IM" -> "^i(/home/paul/icons/rob/msn.xbm)"
)
}) -- >> updatePointer (Relative 0.95 0.95)
where
dzenFG c = dzenColor c ""
myWrap c l r = wrap (dzenFG c l) (dzenFG c r)
namedOnly ws = if any (`elem` ws) ['a'..'z'] then pad ws else ""
myStatusBar = "/home/paul/bin/dzen2 -y '584' -w '500' -ta 'l'" ++ myDzenStyle
myStatusBar2 = "/home/paul/bin/conky -c ~/.conkyrc | /home/paul/bin/dzen2 -x '500' -y '584' -w '464' -ta 'r'" ++ myDzenStyle
myStatusBar3 = "/home/paul/bin/conky -c ~/.conkyrc1 | /home/paul/bin/dzen2 -x '0' -y '0' -w '1024'" ++ myDzenStyle
myDzenStyle = " -h '16' -fg '#777777' -bg '#3f3f3f' -fn 'arial:bold:size=9'"
|
x
Notes
XMonad