~/.xmonad/xmonad.hs
This is my configuration file for xmonad which is a BSD licensed tiling window manager written in Haskell.
If you are interested, my configuration file is available for download as well.
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
-- Author: microfracture / https://linuxious.com
-- Updated: 2015-03-13
-- Import the various functions that I want to use.
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Actions.NoBorders
import XMonad.Actions.Search
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.Grid
import XMonad.Layout.Magnifier
import XMonad.Layout.NoBorders
import XMonad.Layout.Spacing
import XMonad.Prompt
import XMonad.Prompt.Shell
import XMonad.Util.Run
import XMonad.Util.EZConfig
import Control.Monad
import Data.Monoid
import System.Exit
import System.IO
import qualified Data.Map as M
import qualified XMonad.StackSet as W
-- Setup workspaces and their configurations.
myWorkspaces = [ "1:web", "2:chat", "3:media", "4:projects", "5:games", "6:misc" ]
myMouseBindings (XConfig {XMonad.modMask = modm}) = M.fromList $
[ ((modm, button1), (\w -> focus w >> mouseMoveWindow w
>> windows W.shiftMaster))
, ((modm, button2), (\w -> focus w >> windows W.shiftMaster))
, ((modm, button3), (\w -> focus w >> mouseResizeWindow w
>> windows W.shiftMaster))
, ((modm, button4), (\_ -> prevWS))
, ((modm, button5), (\_ -> nextWS))
, ((modm .|. shiftMask, button4), (\_ -> shiftToPrev))
, ((modm .|. shiftMask, button5), (\_ -> shiftToNext))
]
myManageHook = composeAll . concat $
[ [ className =? c --> doShift "1:web" | c <- myWeb ]
, [ className =? c --> viewShift "5:games" | c <- myGames ]
, [ className =? c --> doCenterFloat | c <- myFloatCenter ]
, [ className =? c --> doFullFloat | c <- myFloatFull ]
, [ resource =? r --> doIgnore | r <- myIgnores ]
, [ resource =? "dmenu" --> doFloat ]
, [ isDialog --> doCenterFloat ]
, [ isFullscreen --> doFullFloat ]
, [ manageDocks ]
]
where
viewShift = doF . liftM2 (.) W.greedyView W.shift
myFloatCenter = [ "gimp-2.8","feh","Gmrun","mplayer2","Xfce4-appfinder"
,"Xmessage","Xscreensaver-demo" ]
myFloatFull = [ "hl2_linux","Oblogout" ]
myGames = [ "net-minecraft-LauncherFrame","Steam" ]
myIgnores = [ "desktop_window","kdesktop" ]
myWeb = [ "Firefox","Chromium" ]
myLayout = avoidStruts $ smartBorders $ tiled ||| Mirror tiled ||| Grid
||| magnifier Grid ||| tileds ||| grids ||| noBorders Full
where
tiled = Tall nmaster delta ratio
tileds = spacing 5 $ Tall nmaster delta ratio
grids = spacing 5 $ Grid
nmaster = 1
ratio = 1/2
delta = 3/100
myXPConfig = defaultXPConfig
{ font = "-misc-fixed-*-*-*-*-12-*-*-*-*-*-*-*"
, bgColor = "#000000"
, fgColor = "#BFBFBF"
, fgHLight = "#000000"
, bgHLight = "#8AB4DA"
, position = Top
, promptBorderWidth = 0
, historySize = 32
, showCompletionOnTab = True
}
-- Assign my available search engines to launch via dmenu later.
ddg = searchEngine "DuckDuckGo" "https://duckduckgo.com/?q="
sp = searchEngine "Startpage" "https://startpage.com/do/search?q="
alw = searchEngine "Arch Linux Wiki" "https://wiki.archlinux.org/index.php/Special:Search?search="
-- Main options and keybinds.
main = do
xmproc <- spawnPipe "xmobar"
xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
{ workspaces = myWorkspaces
, normalBorderColor = "#DDDDDD"
, focusedBorderColor = "#8AB4DA"
, manageHook = manageDocks <+> myManageHook <+> manageHook defaultConfig
, layoutHook = myLayout
, logHook = dynamicLogWithPP $ xmobarPP
{ ppCurrent = xmobarColor "#8AB4DA" "".wrap "<" ">"
, ppHidden = xmobarColor "#FFFFFF" ""
, ppHiddenNoWindows = xmobarColor "#BFBFBF" ""
, ppLayout = xmobarColor "#BFBFBF" ""
, ppOutput = hPutStrLn xmproc
, ppSep = "<fc=#FFFFFF> | </fc>"
, ppTitle = xmobarColor "#FFFFFF" "".shorten 80
, ppUrgent = xmobarColor "#FF5555" "". xmobarStrip
, ppVisible = xmobarColor "#8AB4DA" ""
}
, modMask = mod1Mask
, mouseBindings = myMouseBindings
, startupHook = setWMName "LG3D"
} `additionalKeys`
[ ((0, xK_F12), spawn "termite")
, ((0, xK_Print), spawn "scrot '%Y-%m-%d_$(whoami).png' -t 10% -e 'feh -. $f'")
-- , ((controlMask .|. shiftMask, xK_space), spawn "xfce4-appfinder")
, ((controlMask, xK_Print), spawn "scrot -d 4 '%Y-%m-%d_$(whoami).png' -t 10% -e 'feh -. $f'")
, ((controlMask, xK_space), shellPrompt myXPConfig)
, ((mod1Mask, xK_F4), kill)
, ((mod1Mask, xK_b), sendMessage ToggleStruts)
, ((mod1Mask, xK_g), withFocused toggleBorder)
, ((mod1Mask, xK_p), shellPrompt myXPConfig)
, ((mod4Mask, xK_l), spawn "xscreensaver-command -lock")
, ((mod4Mask, xK_s), promptSearchBrowser myXPConfig "surf" ddg)
, (((mod1Mask .|. controlMask), xK_x), spawn "oblogout")
, (((mod1Mask .|. controlMask), xK_Left), prevWS)
, (((mod1Mask .|. controlMask), xK_Right), nextWS)
, (((mod1Mask .|. shiftMask), xK_Left), shiftToPrev)
, (((mod1Mask .|. shiftMask), xK_Right), shiftToNext)
, (((mod4Mask .|. controlMask), xK_s), promptSearchBrowser myXPConfig "surf" alw)
, (((mod4Mask .|. shiftMask), xK_s), promptSearchBrowser myXPConfig "surf" sp)
]