diff options
-rw-r--r-- | .xmonad/xmonad.hs | 30 |
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) | |||
14 | import XMonad.Layout.Spiral | 14 | import XMonad.Layout.Spiral |
15 | import Data.Ratio | 15 | import Data.Ratio |
16 | import Data.List | 16 | import Data.List |
17 | import Data.Maybe (fromMaybe, listToMaybe) | 17 | import Data.Maybe (fromMaybe, listToMaybe, catMaybes) |
18 | import XMonad.Layout.Tabbed | 18 | import XMonad.Layout.Tabbed |
19 | import XMonad.Prompt | 19 | import XMonad.Prompt |
20 | import XMonad.Util.Scratchpad | 20 | import 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 | |||
60 | defaultHost = Host { hName = "unkown" | 61 | defaultHost = 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) |
68 | hostFromName h@("vali") = defaultHost { hName = h | 70 | hostFromName 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 | ||
80 | hostFromName _ = defaultHost | 87 | hostFromName _ = defaultHost |
81 | 88 | ||
89 | wspFromMap workspaceNames = \i -> case Map.lookup i workspaceNames of | ||
90 | Just str -> show i ++ " " ++ str | ||
91 | Nothing -> show i | ||
92 | |||
93 | coWspFromMap workspaceNames = \str -> case filter ((== str) . snd) $ Map.toList workspaceNames of | ||
94 | [] -> Nothing | ||
95 | [(i, _)] -> Just $ wspFromMap workspaceNames i | ||
96 | _ -> Nothing | ||
97 | |||
98 | mkMod = foldl (.) id . catMaybes | ||
99 | |||
82 | spawnModifiers = [0, controlMask, shiftMask .|. controlMask] | 100 | spawnModifiers = [0, controlMask, shiftMask .|. controlMask] |
83 | spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds | 101 | spawnBindings conf (k, cmds) = zipWith (\m cmd -> ((modm .|. mod1Mask .|. m, k), spawn cmd)) spawnModifiers cmds |
84 | where | 102 | where |