import XMonad import System Exit import System IO import qualified XMo

 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
import XMonad
import System.Exit
import System.IO
import qualified XMonad.StackSet as W
import qualified Data.Map as M
-- Extensions
import XMonad.Prompt
import XMonad.Prompt.Input
import XMonad.Prompt.Shell
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import XMonad.Actions.Submap
import XMonad.Actions.Search
-- prompt config
ownXPConfig :: XPConfig
ownXPConfig = defaultXPConfig
{ font = "xft:Consolas:size=12"
, bgColor = "#3f3c6d"
, fgColor = "#a8a3f7"
, fgHLight = "#a8a3f7"
, bgHLight = "blue"
, borderColor = "#FFFFFF"
, position = Top
}
myTerminal = "rxvt"
myModMask = mod4Mask
myWorkspaces = ["console","web","im","rss","music","6","7","8","remote"]
myDefaultGaps = [(0,0,0,0)]
myManageHook = composeAll
[ className =? "Firefox" --> moveTo "web"
, className =? "Gajim.py" --> moveTo "im"
, className =? "Amarokapp" --> moveTo "music"
, className =? "Liferea-bin" --> moveTo "rss"
]
<+> manageDocks <+> manageHook defaultConfig
where moveTo = doF . W.shift
ownKeys conf@(XConfig {modMask = modMask}) = M.fromList $
[ ((modMask, xK_Up ), spawn "amixer -q set PCM 2dB+")
, ((modMask, xK_Down ), spawn "amixer -q set PCM 2dB-")
, ((modMask, xK_s ), spawn "/home/lorien/shot2web")
, ((modMask, xK_p ), shellPrompt ownXPConfig)
, ((0, xK_Print), spawn "shot2web")
, ((modMask, xK_slash), submap . mySearchMap $ myPromptSearch)
, ((modMask .|. controlMask, xK_slash), submap . mySearchMap $ mySelectSearch)
, ((modMask .|. controlMask, xK_u), spawn "/home/lorien/bin/toggle_usb")
]
mySearchMap method = M.fromList $
[ ((0, xK_g), method google)
, ((0, xK_w), method wikipedia)
, ((0, xK_h), method hoogle)
, ((0, xK_s), method scholar)
, ((0, xK_m), method mathworld)
]
myPromptSearch eng = inputPrompt defaultXPConfig "Search" ?+ \s ->
(io (search "firefox" eng s) >> viewWeb)
mySelectSearch eng = selectSearch "firefox" eng >> viewWeb
viewWeb = windows (W.greedyView "2:web")
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ defaultConfig {
terminal = myTerminal,
modMask = myModMask,
workspaces = myWorkspaces,
defaultGaps = myDefaultGaps,
manageHook = myManageHook,
layoutHook = avoidStruts $ layoutHook defaultConfig,
logHook = dynamicLogWithPP $ xmobarPP {
ppOutput = hPutStrLn xmproc,
ppTitle = xmobarColor "green" "" . shorten 50
},
keys = \c -> ownKeys c `M.union` keys defaultConfig c
}