3 import XMonad.Hooks.DynamicLog
4 import XMonad.Hooks.EwmhDesktops
5 import XMonad.Hooks.ICCCMFocus
6 import XMonad.Hooks.ManageDocks
7 import XMonad.Hooks.ManageHelpers
8 import XMonad.Hooks.Script
9 import XMonad.Hooks.SetWMName
10 import XMonad.Layout.IM
11 import XMonad.Layout.LayoutHints
12 import qualified XMonad.Layout.Magnifier as Mag
13 import XMonad.Layout.Master
14 import XMonad.Layout.NoBorders
15 import XMonad.Layout.NoFrillsDecoration
16 import XMonad.Layout.PerWorkspace
17 import XMonad.Layout.Renamed
18 import XMonad.Layout.Reflect
19 import XMonad.Layout.Tabbed
20 import XMonad.Layout.ThreeColumns
21 import XMonad.Util.Run(spawnPipe)
22 import XMonad.Util.WindowProperties(getProp32s)
23 import qualified Data.Map as M
24 import qualified XMonad.StackSet as W
27 myKeys conf@(XConfig {XMonad.modMask = modm}) = M.fromList $
29 ((modm .|. shiftMask, xK_h), spawn "xfce4-session-logout"),
30 ((modm .|. shiftMask, xK_l), spawn "xscreensaver-command --lock"),
32 ((modm, xK_n), spawn "xfce4-terminal"),
33 ((modm, xK_i), spawn "firefox"),
35 ((modm .|. shiftMask, xK_c ), kill),
36 ((modm, xK_space ), sendMessage NextLayout),
37 ((modm .|. shiftMask, xK_space ), setLayout $ XMonad.layoutHook conf),
38 ((modm, xK_Tab ), windows W.focusDown),
39 ((modm, xK_j ), windows W.focusDown),
40 ((modm, xK_k ), windows W.focusUp ),
41 ((modm, xK_m ), windows W.focusMaster ),
42 ((modm, xK_Return), windows W.swapMaster),
43 ((modm .|. shiftMask, xK_j ), windows W.swapDown ),
44 ((modm .|. shiftMask, xK_k ), windows W.swapUp ),
45 ((modm, xK_h ), sendMessage Shrink),
46 ((modm, xK_l ), sendMessage Expand),
47 ((modm, xK_t ), withFocused $ windows . W.sink),
48 ((modm , xK_comma ), sendMessage (IncMasterN 1)),
49 ((modm , xK_period), sendMessage (IncMasterN (-1))),
50 ((modm , xK_b ), sendMessage ToggleStruts),
51 ((modm , xK_z ), sendMessage Mag.Toggle)
55 -- mod-{w,e,r}, Switch to physical/Xinerama screens 1, 2, or 3
56 -- mod-shift-{w,e,r}, Move client to screen 1, 2, or 3
57 [((m .|. modm, key), screenWorkspace sc >>= flip whenJust (windows . f))
58 | (key, sc) <- zip [xK_o, xK_e, xK_u] [0..]
59 , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
63 -- mod-[1..9], Switch to workspace N
64 -- mod-shift-[1..9], Move client to workspace N
65 [((m .|. modm, k), windows $ f i)
66 | (i, k) <- zip (XMonad.workspaces conf) [xK_1 .. xK_9]
67 , (f, m) <- [(W.greedyView, 0), (W.shift, shiftMask)]
71 avoidMaster = W.modify' $ \c -> case c of
72 W.Stack t [] (r:rs) -> W.Stack t [r] rs
75 isTransient = ask >>= \w -> liftX $ do
76 r <- getProp32s "WM_TRANSIENT_FOR" w
81 isSkipTaskBar = isInProperty "_NET_WM_STATE" "_NET_WM_STATE_SKIP_TASKBAR"
87 (className =? "Firefox" <&&> resource =? "Popup") -?> (ask >>= doF . W.sink),
88 (className =? "Firefox" <&&> resource =? "Navigator" <&&> currentWs =? "1") -?> (doShift "2"),
89 (className =? "Kupfer.py" <&&> resource =? "kupfer.py") -?> doFloat,
90 (className =? "Xfce4-appfinder" <&&> resource =? "xfce4-appfinder") -?> doFloatAt 0.1 0.1,
91 (isSkipTaskBar -?> doFloat),
92 (isDialog -?> doFloatAt 0.1 0.1),
93 (isTransient -?> doFloatAt 0.1 0.1),
94 (isFullscreen -?> doFullFloat),
95 (fmap Just $ doF avoidMaster)
99 myWorkspaces = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
103 ppCurrent = xmobarColor "#A01010" "" . wrap "[" "]",
104 ppTitle = xmobarColor "#10A010" ""
108 dynamicLogWithPP myPP { ppOutput = hPutStrLn h1 } >>
109 dynamicLogWithPP myPP { ppOutput = hPutStrLn h2 } >>
110 takeTopFocus -- fix for Java Swing apps
113 setWMName "LG3D" -- fix for Java Swing apps
116 goldenRatio = (toRational (2/(1+sqrt(5)::Double)))
118 myTitleTheme = defaultTheme {
119 fontName = "xft:sans-serif:size=10",
123 createLayout name layout =
124 renamed [Replace name] $
129 myFullLayout = createLayout "Full" $
132 myTiledLayout = createLayout "Tall" $
135 Tall nMaster ratioIncrement masterRatio
138 ratioIncrement = 3/100
139 masterRatio = goldenRatio
141 myTabbedLayout = createLayout "Tab" $
143 tabbed shrinkText myTitleTheme
145 myThreeColLayout = createLayout "ThreeCol" $
148 ThreeCol numMaster resizeDelta masterRatio
154 myMasterTabbedLayout = createLayout "MTab" $
157 mastered resizeDelta masterRatio $
158 tabbed shrinkText myTitleTheme
161 masterRatio = goldenRatio
163 myImLayout = createLayout "IM" $
165 noFrillsDeco shrinkText myTitleTheme $
166 withIM rosterRatio roster $
168 --- myThreeColLayout -- use this on wider screens
171 roster = (Or (Title "Buddy List") (And (Resource "main") (ClassName "psi")))
173 myGimpLayout = createLayout "Gimp" $
175 withIM (1/6) (Role "gimp-toolbox") $
177 withIM (1/6) (Role "gimp-dock") $
179 tabbed shrinkText myTitleTheme
182 -- This was the easiest way I found to avoid a compile error when I have
184 referenceAllLayoutsToAvoidErrors =
189 myMasterTabbedLayout |||
196 onWorkspace "1" (myImLayout) $
197 onWorkspace "2" (myTabbedLayout ||| myMasterTabbedLayout) $
198 onWorkspace "9" (myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout ||| myFullLayout ||| myGimpLayout) $
199 (myMasterTabbedLayout ||| myTabbedLayout ||| myTiledLayout)
203 xmonadDir <- getXMonadDir
204 xmobar <- spawnPipe ("xmobar " ++ xmonadDir ++ "/xmobar.hs")
205 xmobar2 <- spawnPipe ("xmobar -x 1 " ++ xmonadDir ++ "/xmobar.hs")
206 xmonad $ ewmh defaultConfig {
207 manageHook = myManageHook,
208 layoutHook = myLayout,
209 workspaces = myWorkspaces,
210 logHook = myLogHook xmobar xmobar2,
211 startupHook = myStartupHook,