summaryrefslogtreecommitdiff
path: root/.xmonad/xmonad.hs
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2015-07-15 22:26:57 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2015-07-15 22:26:57 +0200
commitb0c55c16b555aa6d5d1a30b327f77b42399ea66e (patch)
tree59ecc2c394fd2723ce7272513570e530d1667503 /.xmonad/xmonad.hs
parent8325e5ea5d93712e158568da1434b3beb42e52a2 (diff)
downloaddotfiles-b0c55c16b555aa6d5d1a30b327f77b42399ea66e.tar
dotfiles-b0c55c16b555aa6d5d1a30b327f77b42399ea66e.tar.gz
dotfiles-b0c55c16b555aa6d5d1a30b327f77b42399ea66e.tar.bz2
dotfiles-b0c55c16b555aa6d5d1a30b327f77b42399ea66e.tar.xz
dotfiles-b0c55c16b555aa6d5d1a30b327f77b42399ea66e.zip
Introduced permutations to screen numbers in order to be more intuitive
Diffstat (limited to '.xmonad/xmonad.hs')
-rw-r--r--.xmonad/xmonad.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs
index 87d780f..6ee9140 100644
--- a/.xmonad/xmonad.hs
+++ b/.xmonad/xmonad.hs
@@ -52,12 +52,13 @@ import Control.Applicative ((<$>))
52 52
53type KeyMap = Map (ButtonMask, KeySym) (X ()) 53type KeyMap = Map (ButtonMask, KeySym) (X ())
54 54
55data Host l1 l2 = Host 55data Host = Host
56 { hName :: HostName 56 { hName :: HostName
57 , hManageHook :: ManageHook 57 , hManageHook :: ManageHook
58 , hWsp :: Integer -> WorkspaceId 58 , hWsp :: Integer -> WorkspaceId
59 , hCoWsp :: String -> Maybe WorkspaceId 59 , hCoWsp :: String -> Maybe WorkspaceId
60 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap) 60 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap)
61 , hScreenPerm :: [Integer] -> [Integer]
61 } 62 }
62 63
63defaultHost = Host { hName = "unkown" 64defaultHost = Host { hName = "unkown"
@@ -65,9 +66,10 @@ defaultHost = Host { hName = "unkown"
65 , hWsp = show 66 , hWsp = show
66 , hCoWsp = const Nothing 67 , hCoWsp = const Nothing
67 , hKeysMod = const id 68 , hKeysMod = const id
69 , hScreenPerm = id
68 } 70 }
69 71
70--hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) 72hostFromName :: HostName -> Host (l1 a) (l2 a)
71hostFromName h@("vali") = defaultHost { hName = h 73hostFromName h@("vali") = defaultHost { hName = h
72 , hManageHook = composeOne $ catMaybes [ Just manageScratchTerm 74 , hManageHook = composeOne $ catMaybes [ Just manageScratchTerm
73 , (\wsp -> className =? ".dwb-wrapped" -?> doShift wsp) <$> hCoWsp "web" 75 , (\wsp -> className =? ".dwb-wrapped" -?> doShift wsp) <$> hCoWsp "web"
@@ -77,12 +79,16 @@ hostFromName h@("vali") = defaultHost { hName = h
77 , hCoWsp = hCoWsp 79 , hCoWsp = hCoWsp
78 , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"]) 80 , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"])
79 ] 81 ]
82 , hScreenPerm = hScreenPerm
80 } 83 }
81 where 84 where
82 workspaceNames = Map.fromList [ (2, "web") 85 workspaceNames = Map.fromList [ (2, "web")
83 ] 86 ]
84 hWsp = wspFromMap workspaceNames 87 hWsp = wspFromMap workspaceNames
85 hCoWsp = coWspFromMap workspaceNames 88 hCoWsp = coWspFromMap workspaceNames
89 hScreenPerm 1 = 2
90 hScreenPerm 2 = 1
91 hScreenPerm x = x
86hostFromName _ = defaultHost 92hostFromName _ = defaultHost
87 93
88wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of 94wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of
@@ -123,7 +129,7 @@ main = do
123 , layoutHook = smartBorders $ avoidStruts layout' 129 , layoutHook = smartBorders $ avoidStruts layout'
124 , logHook = dynamicLogWithPP xmobarPP' 130 , logHook = dynamicLogWithPP xmobarPP'
125 , modMask = mod4Mask 131 , modMask = mod4Mask
126 , keys = \conf -> hKeysMod host conf $ myKeys' conf 132 , keys = \conf -> hKeysMod host conf $ myKeys' conf host
127 , workspaces = take (length numKeys) $ map wsp [1..] 133 , workspaces = take (length numKeys) $ map wsp [1..]
128 , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return () 134 , startupHook = assimilateKeychain >> (sequence autostart) >> (setDefaultCursor xC_left_ptr) >> banishScreen LowerRight >> return ()
129 , normalBorderColor = "#202020" 135 , normalBorderColor = "#202020"
@@ -213,7 +219,7 @@ sshOverrides = map (\h -> mkOverride { oHost = h, oCommand = moshCmd . inTmux }
213 [ "galois", "galois.praseodym.org" 219 [ "galois", "galois.praseodym.org"
214 ] 220 ]
215 221
216myKeys' conf = Map.fromList $ 222myKeys' conf host = Map.fromList $
217 -- launch a terminal 223 -- launch a terminal
218 [ ((modm, xK_Return), spawn $ (XMonad.terminal conf) ++ " -e tmux") 224 [ ((modm, xK_Return), spawn $ (XMonad.terminal conf) ++ " -e tmux")
219 , ((modm .|. controlMask, xK_Return), scratchpadSpawnActionCustom $ (XMonad.terminal conf) ++ " -name scratchpad -title scratchpad -e tmux") 225 , ((modm .|. controlMask, xK_Return), scratchpadSpawnActionCustom $ (XMonad.terminal conf) ++ " -name scratchpad -title scratchpad -e tmux")
@@ -299,7 +305,7 @@ myKeys' conf = Map.fromList $
299 ] 305 ]
300 ++ 306 ++
301 [((m .|. modm .|. controlMask, k), screenWorkspace i >>= (flip whenJust) (windows . f)) 307 [((m .|. modm .|. controlMask, k), screenWorkspace i >>= (flip whenJust) (windows . f))
302 | (i, k) <- zip [0..] [xK_g, xK_c, xK_r, xK_l] 308 | (i, k) <- zip (hScreenPerm host [0..]) [xK_g, xK_c, xK_r, xK_l]
303 , (f, m) <- [(W.view, 0), (W.shift, shiftMask)] 309 , (f, m) <- [(W.view, 0), (W.shift, shiftMask)]
304 ] 310 ]
305 where 311 where