conf

view xmonad.hs @ 375:26aed4e65671

cleanup hgrc a bit
author Alexander Solovyov <alexander@solovyov.net>
date Mon Jan 23 18:20:04 2012 +0200
parents 4f97f98f2be0
children
line source
1 -- xmonad.hs
2 -- (c) Alexander Solovyov 2007-2008
3 import Graphics.X11
4 import System.IO (hPutStrLn)
5 import qualified Data.Map as M
6 import Data.Bits ((.|.))
7 -- XMonad
8 import XMonad hiding ((|||))
9 import XMonad.ManageHook
10 import XMonad.Operations
11 import qualified XMonad.StackSet as W
12 -- Extensions
13 import XMonad.Actions.DwmPromote
14 import XMonad.Actions.FloatKeys
15 import XMonad.Actions.Submap
16 import XMonad.Actions.SwapWorkspaces
17 import XMonad.Hooks.DynamicLog
18 import XMonad.Hooks.ManageDocks
19 import XMonad.Hooks.UrgencyHook
20 import XMonad.Layout.LayoutCombinators
21 import XMonad.Layout.Named
22 import XMonad.Layout.NoBorders
23 import XMonad.Layout.Tabbed
24 import XMonad.Layout.ToggleLayouts
25 import XMonad.Layout.Accordion
26 import XMonad.Prompt
27 import XMonad.Prompt.Shell
28 import XMonad.Prompt.Ssh
29 import XMonad.Prompt.Window
30 import XMonad.Prompt.XMonad
31 import XMonad.Util.EZConfig (additionalKeys, additionalKeysP)
32 import XMonad.Util.Run (spawnPipe)
33 import XMonad.Util.Scratchpad
36 statusBarCmd = "xmobar"
37 --statusBarCmd = "cat"
39 -- prompt config
40 ownXPConfig :: XPConfig
41 ownXPConfig = defaultXPConfig
42 { font = "xft:Consolas:size=12"
43 , bgColor = "#3f3c6d"
44 , fgColor = "#a8a3f7"
45 , fgHLight = "#a8a3f7"
46 , bgHLight = "blue"
47 , borderColor = "#FFFFFF"
48 , position = Top
49 }
51 -- tabbed layout config
52 tabbedConf = defaultTheme { fontName = "xft:Consolas:size=12" }
54 -- dynamic log config
55 ownPP h = defaultPP
56 { ppOutput = hPutStrLn h
57 , ppCurrent = xmobarColor "white" "" . wrap "[" "]"
58 , ppVisible = xmobarColor "yellow" "" . wrap "*" "*"
59 , ppUrgent = xmobarColor "red" "" . wrap "|" "|"
60 , ppTitle = xmobarColor "#00ee00" ""
61 , ppSep = " "
62 , ppLayout = (\x -> "")
63 }
65 -- keys config
66 addKeys =
67 [ ("M-f" , sendMessage ToggleLayout)
68 , ("M-b" , sendMessage ToggleStruts)
69 , ("M-s" , spawn "urxvt -title scratchpad")
70 , ("M-S-g" , windowPromptGoto ownXPConfig)
71 , ("M-<Right>" , withFocused (keysMoveWindow (20, 0)))
72 , ("M-<Left>" , withFocused (keysMoveWindow (-20, 0)))
73 , ("M-<Up>" , withFocused (keysMoveWindow (0, -20)))
74 , ("M-<Down>" , withFocused (keysMoveWindow (0, 20)))
75 , ("M-S-<Right>" , withFocused (keysResizeWindow (20, 0) (0, 0)))
76 , ("M-S-<Left>" , withFocused (keysResizeWindow (-20, 0) (0, 0)))
77 , ("M-S-<Up>" , withFocused (keysResizeWindow (0, -20) (0, 0)))
78 , ("M-S-<Down>" , withFocused (keysResizeWindow (0, 20) (0, 0)))
79 , ("M-<Backspace>", focusUrgent)
80 , ("M-p", shellPrompt ownXPConfig)
81 -- non-wm-specific binds
82 , ("M-<Page_Up>" , spawn "xclip -selection PRIMARY -o | xclip -selection CLIPBOARD -i")
83 , ("M-<Page_Down>" , spawn "xclip -selection CLIPBOARD -o | xclip -selection PRIMARY -i")
84 , ("M-<Insert>" , spawn "scrot 'screenshot-%F-%H-%M-%S.png' -e 'mv $f ~'")
85 ]
87 mmKeys =
88 [ ((0 , 0x1008ff11), spawn "amixer sset Master 2%-") -- XF86AudioLowerVolume
89 , ((0 , 0x1008ff12), spawn "amixer sset Master toggle") -- XF86AudioMute
90 , ((0 , 0x1008ff13), spawn "amixer sset Master 2%+") -- XF86AudioRaiseVolume
91 , ((0 , 0x1008ff14), spawn "amarok -t") -- XF86AudioPlay
92 , ((0 , 0x1008ff15), spawn "amarok -s") -- XF86AudioStop
93 , ((0 , 0x1008ff16), spawn "amarok -r") -- XF86AudioPrev
94 , ((0 , 0x1008ff17), spawn "amarok -f") -- XF86AudioNext
95 ]
98 ownManageHook = scratchpadManageHookDefault <+>
99 (composeAll . concat $
100 [ [ className =? c --> doFloat | c <- floats]
101 , [ className =? "Gecko" --> doF (W.shift "web") ] ])
102 where floats = ["MPlayer", "Gimp", "qiv", "Galculator", "Gcalctool"]
105 ownLayoutHook = smartBorders
106 $ avoidStruts
107 $ toggleLayouts (noBorders Full)
108 $ named "tiled" tiled
109 ||| named "mirror" (Mirror tiled)
110 ||| named "tabbed" (noBorders owntab)
111 where
112 owntab = tabbed shrinkText tabbedConf
113 tiled = Tall 1 (3/100) (1/2)
116 -- overall config
117 ownConfig statusbar = defaultConfig
118 { borderWidth = 1
119 , normalBorderColor = "#3f3c6d"
120 , focusedBorderColor = "#FF0000"
121 , terminal = "urxvt"
122 , modMask = mod4Mask
123 , logHook = dynamicLogWithPP $ ownPP statusbar
124 , layoutHook = ownLayoutHook
125 , manageHook = ownManageHook
128 main = do statusbar <- spawnPipe statusBarCmd
129 xmonad $ ownConfig statusbar `additionalKeysP` addKeys `additionalKeys` mmKeys
Repositories maintained by Alexander Solovyov