summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.xmonad/xmonad.hs30
1 files changed, 24 insertions, 6 deletions
diff --git a/.xmonad/xmonad.hs b/.xmonad/xmonad.hs
index 49778c5..7245ad3 100644
--- a/.xmonad/xmonad.hs
+++ b/.xmonad/xmonad.hs
@@ -14,7 +14,7 @@ import Control.Monad.State (get)
14import XMonad.Layout.Spiral 14import XMonad.Layout.Spiral
15import Data.Ratio 15import Data.Ratio
16import Data.List 16import Data.List
17import Data.Maybe (fromMaybe, listToMaybe) 17import Data.Maybe (fromMaybe, listToMaybe, catMaybes)
18import XMonad.Layout.Tabbed 18import XMonad.Layout.Tabbed
19import XMonad.Prompt 19import XMonad.Prompt
20import XMonad.Util.Scratchpad 20import XMonad.Util.Scratchpad
@@ -53,6 +53,7 @@ data Host l1 l2 = Host
53 { hName :: HostName 53 { hName :: HostName
54 , hManageHook :: ManageHook 54 , hManageHook :: ManageHook
55 , hWsp :: Integer -> WorkspaceId 55 , hWsp :: Integer -> WorkspaceId
56 , hCoWsp :: String -> Maybe WorkspaceId
56 , hLayoutMod :: l1 -> l2 57 , hLayoutMod :: l1 -> l2
57 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap) 58 , hKeysMod :: XConfig Layout -> (KeyMap -> KeyMap)
58 } 59 }
@@ -60,25 +61,42 @@ data Host l1 l2 = Host
60defaultHost = Host { hName = "unkown" 61defaultHost = Host { hName = "unkown"
61 , hManageHook = composeOne [manageScratchTerm] 62 , hManageHook = composeOne [manageScratchTerm]
62 , hWsp = show 63 , hWsp = show
64 , hCoWsp = const Nothing
63 , hLayoutMod = id 65 , hLayoutMod = id
64 , hKeysMod = const id 66 , hKeysMod = const id
65 } 67 }
66 68
67--hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a) 69--hostFromName :: (LayoutClass l1 a, LayoutClass l2 a) => HostName -> Host (l1 a) (l2 a)
68hostFromName h@("vali") = defaultHost { hName = h 70hostFromName h@("vali") = defaultHost { hName = h
69 , hManageHook = hManageHook defaultHost 71 , hManageHook = composeOne [ manageScratchTerm
70 , hWsp = \i -> case Map.lookup i workspaceNames of 72 , className =? ".dwb-wrapped" -?> doShift (wsp 2)
71 Just str -> show i ++ " " ++ str 73 , className =? "Chromium" -?> doShift (wsp 2)
72 Nothing -> show i 74 ]
73 , hLayoutMod = id 75 , hWsp = hWsp
76 , hCoWsp = hCoWsp
77 , hLayoutMod = mkMod [ hCoWsp "web" >>= \wsp -> onWorkspace wsp (noBorders Full ||| tabbedLayout tabbedBottomAlways)
78 ]
74 , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"]) 79 , hKeysMod = \conf -> Map.union $ Map.fromList $ join $ map (spawnBindings conf) [ (xK_d, ["dwb", "dwb $(xclip -o)"])
75 ] 80 ]
76 } 81 }
77 where 82 where
78 workspaceNames = Map.fromList [ (1, "web") 83 workspaceNames = Map.fromList [ (1, "web")
79 ] 84 ]
85 hWsp = wspFromMap workspaceNames
86 hCoWsp = coWspFromMap workspaceNames
80hostFromName _ = defaultHost 87hostFromName _ = defaultHost
81 88
89wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of
90 Just str -> show i ++ " " ++ str
91 Nothing -> show i
92
93coWspFromMap workspaceNames = \str -> case filter ((== str) . snd) $ Map.toList workspaceNames of
94 [] -> Nothing
95 [(i, _)] -> Just $ wspFromMap workspaceNames i
96 _ -> Nothing
97
98mkMod = foldl (.) id . catMaybes
99
82spawnModifiers = [0, controlMask, shiftMask .|. controlMask] 100spawnModifiers = [0, controlMask, shiftMask .|. controlMask]
83spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds 101spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds
84 where 102 where