aboutsummaryrefslogtreecommitdiff
path: root/xmonad.hs
blob: 08506fc97ea675575ace3fe18b720b7b5c5d62a7 (plain)
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
import XMonad
import XMonad.Config.Gnome
import XMonad.Layout.PerScreen
import XMonad.Layout.NoFrillsDecoration
import XMonad.Layout.Tabbed
import XMonad.Layout.Named
import XMonad.Layout.Reflect
import XMonad.Layout.Spacing
import XMonad.Layout.Gaps
import XMonad.Layout.BoringWindows
import XMonad.Layout.Decoration
import XMonad.Layout.TwoPane
import XMonad.Layout.ComboP
import XMonad.Layout.ThreeColumns
import XMonad.Hooks.ManageDocks
import XMonad.Layout.WindowNavigation
import qualified Data.Map as M
import qualified XMonad.StackSet as W

addTopBar   = noFrillsDeco shrinkText topBarTheme
mySpacing   = spacing gap
myGaps      = gaps [(U, gap),(D, gap),(L, gap),(R, gap)]

base03  = "#002b36"
base02  = "#073642"
base01  = "#586e75"
base00  = "#657b83"
base0   = "#839496"
base1   = "#93a1a1"
base2   = "#eee8d5"
base3   = "#fdf6e3"
yellow  = "#b58900"
orange  = "#cb4b16"
red     = "#dc322f"
magenta = "#d33682"
violet  = "#6c71c4"
blue    = "#268bd2"
cyan    = "#2aa198"
green       = "#859900"

-- sizes
gap         = 3
topbar      = 5
border      = 0
prompt      = 20
status      = 20

myNormalBorderColor     = "#000000"
myFocusedBorderColor    = active

active      = blue
activeWarn  = red
inactive    = base02
focusColor  = blue
unfocusColor = base02

smallMonResWidth = 1366

myFont      = "-*-terminus-medium-*-*-*-*-160-*-*-*-*-*-*"
topBarTheme = def
    { fontName              = myFont
    , inactiveBorderColor   = base03
    , inactiveColor         = base03
    , inactiveTextColor     = base03
    , activeBorderColor     = active
    , activeColor           = active
    , activeTextColor       = active
    , urgentBorderColor     = red
    , urgentTextColor       = yellow
    , decoHeight            = topbar
    }

myTabTheme = def
    { fontName              = myFont
    , activeColor           = active
    , inactiveColor         = base02
    , activeBorderColor     = active
    , inactiveBorderColor   = base02
    , activeTextColor       = base03
    , inactiveTextColor     = base00
    }


smartTallTabbed = named "Smart Tall-Tabbed"
                  $ avoidStruts
                  $ ifWider smallMonResWidth wideScreen normalScreen
  where
    wideScreen   = combineTwoP (TwoPane 0.03 (3/4))
                   (smartTall)
                   (smartTabbed)
                   (ClassName "Google-chrome")
    normalScreen = combineTwoP (TwoPane 0.03 (2/3))
                   (smartTall)
                   (smartTabbed)
                   (ClassName "Google-chrome")

smartTall = named "Smart Tall"
            $ addTopBar
            $ mySpacing
            $ myGaps
            $ boringAuto
            $ ifWider smallMonResWidth wideScreen normalScreen
  where
    wideScreen = reflectHoriz $ Tall 1 0.03 (2/3)
    normalScreen = Mirror $ Tall 1 0.03 (4/5)

smartTabbed = named "Smart Tabbed"
              $ addTopBar
              $ myGaps
              $ tabbed shrinkText myTabTheme

myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList
                                                [
                                                  ((modm,                 xK_Right), sendMessage $ Go R)
                                                , ((modm,                 xK_Left ), sendMessage $ Go L)
                                                , ((modm,                 xK_Up   ), sendMessage $ Go U)
                                                , ((modm,                 xK_Down ), sendMessage $ Go D)
                                                , ((modm .|. controlMask, xK_Right), sendMessage $ Swap R)
                                                , ((modm .|. controlMask, xK_Left ), sendMessage $ Swap L)
                                                , ((modm .|. controlMask, xK_Up   ), sendMessage $ Swap U)
                                                , ((modm .|. controlMask, xK_Down ), sendMessage $ Swap D)
                                                , ((modm .|. controlMask, xK_s ), sendMessage $ SwapWindow)
                                                , ((modm .|. controlMask, xK_w ), windows W.swapUp)
                                                , ((modm .|. controlMask, xK_r ), windows W.swapDown)
                                                ]

myManageHook = composeAll [
                (className =? "Gnome-calendar") --> doShift "1"
                , (className =? "Emacs" <&&> title =? "*Org Agenda( )*") --> doShift "1"
                , (className =? "Google-chrome") --> doShift "2"
                , (className =? "Emacs") --> doShift "3"
                , (className =? "Emacs" <&&> title =? "*Group*") --> doShift "4"
                , (className =? "Gnome-terminal") --> doShift "5"
                -- , (className =? "XEyes") --> doShift "7"
               ]

-- myStartupHook = startup
-- startup = do
--           spawn "gnome-calendar"
--           spawn "emacs"
--           spawn "google-chrome"
--           -- spawn "emacsclient -c -e \'(org-agenda \" \" \" \")\'"
--           -- spawn "emacsclient -c -e \'(gnus)\'"
--           spawn "gnome-terminal"

myLayout = windowNavigation (smartTallTabbed) ||| tiled ||| Mirror tiled ||| Full ||| threeCol ||| threeColMid
  where
    -- default tiling algorithm partitions the screen into two panes
    tiled   = Tall nmaster delta ratio
    threeCol = ThreeCol nmaster delta ratio
    threeColMid = ThreeColMid nmaster delta ratio
    -- The default number of windows in the master pane
    nmaster = 1

    -- Default proportion of screen occupied by master pane
    ratio   = 1/2

    -- Percent of screen to increment by when resizing panes
    delta   = 3/100


main = xmonad $ gnomeConfig
     {
       workspaces = ["1","2","3","4","5","6","7","8","9"]
     , layoutHook = myLayout
     , modMask = mod4Mask
     , manageHook = myManageHook <+> manageHook gnomeConfig
     , keys = myKeys <+> keys def
     -- , startupHook = myStartupHook
     }